 +
 +document.addEventListener('DOMContentLoaded',
 +                          filePicker.initialize);
-diff --git a/chrome/browser/ui/aura/chrome_browser_main_extra_parts_aura.cc b/chrome/browser/ui/aura/chrome_browser_main_extra_parts_aura.cc
-index c0cd472..e641bc8 100644
---- a/chrome/browser/ui/aura/chrome_browser_main_extra_parts_aura.cc
-+++ b/chrome/browser/ui/aura/chrome_browser_main_extra_parts_aura.cc
-@@ -19,17 +19,21 @@
- #include "ui/gfx/screen.h"
- #include "ui/views/widget/native_widget_aura.h"
- 
--#if defined(USE_X11) && !defined(OS_CHROMEOS)
-+#if defined(OS_LINUX) && !defined(OS_CHROMEOS)
- #include "base/prefs/pref_service.h"
- #include "chrome/browser/profiles/profile.h"
--#include "chrome/browser/ui/libgtk2ui/gtk2_ui.h"
- #include "chrome/common/pref_names.h"
-+#include "ozone/ui/webui/ozone_webui.h"
- #include "ui/aura/window.h"
- #include "ui/base/ime/input_method_initializer.h"
- #include "ui/native_theme/native_theme_aura.h"
- #include "ui/views/linux_ui/linux_ui.h"
- #endif
- 
-+#if defined(USE_X11)
-+#include "chrome/browser/ui/libgtk2ui/gtk2_ui.h"
-+#endif
-+
- #if defined(USE_ASH)
- #include "chrome/browser/ui/ash/ash_init.h"
- #endif  // defined(USE_ASH)
-@@ -99,6 +103,10 @@ void ChromeBrowserMainExtraPartsAura::PreEarlyInitialization() {
-     ui::InitializeInputMethodForTesting();
-   }
- #endif
-+
-+#if defined(OS_LINUX) && defined(USE_OZONE)
-+    views::LinuxUI::SetInstance(BuildWebUI());
-+#endif
- }
- 
- void ChromeBrowserMainExtraPartsAura::ToolkitInitialized() {
-diff --git a/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc b/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc
-index 50bffa6..7d41190 100644
---- a/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc
-+++ b/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc
-@@ -26,6 +26,9 @@
- #include "chrome/browser/ui/webui/devtools_ui.h"
- #include "chrome/browser/ui/webui/domain_reliability_internals_ui.h"
- #include "chrome/browser/ui/webui/downloads_ui.h"
-+#include "chrome/browser/ui/webui/extensions/extension_info_ui.h"
-+#include "chrome/browser/ui/webui/extensions/extensions_ui.h"
-+#include "chrome/browser/ui/webui/file_picker/file_picker_ui.h"
- #include "chrome/browser/ui/webui/flags_ui.h"
- #include "chrome/browser/ui/webui/flash_ui.h"
- #include "chrome/browser/ui/webui/gcm_internals_ui.h"
-@@ -284,6 +287,8 @@ WebUIFactoryFunction GetWebUIFactoryFunction(WebUI* web_ui,
-     return &NewWebUI<DomainReliabilityInternalsUI>;
-   if (url.host() == chrome::kChromeUIFlagsHost)
-     return &NewWebUI<FlagsUI>;
-+  if (url.host() == chrome::kChromeUIFilePickerHost)
-+      return &NewWebUI<ui::FilePickerUI>;
-   if (url.host() == chrome::kChromeUIHistoryFrameHost)
-     return &NewWebUI<HistoryUI>;
-   if (url.host() == chrome::kChromeUIInstantHost)
 diff --git a/chrome/browser/ui/webui/file_picker/file_picker_ui.cc b/chrome/browser/ui/webui/file_picker/file_picker_ui.cc
 new file mode 100644
 index 0000000..d151be1

Currently, the WebUI only supports basic functionality for opening a file.
File browsing UI will be added later.
---
 chrome/app/generated_resources.grd                 |    7 +
 chrome/browser/browser_resources.grd               |    3 +
 .../browser/download/save_package_file_picker.cc   |    2 +-
 .../browser/resources/file_picker/file_picker.css  |   72 +++++++++
 .../browser/resources/file_picker/file_picker.html |   37 +++++
 .../browser/resources/file_picker/file_picker.js   |   51 ++++++
 .../aura/chrome_browser_main_extra_parts_aura.cc   |   12 +-
 .../ui/webui/chrome_web_ui_controller_factory.cc   |    5 +
 .../browser/ui/webui/file_picker/file_picker_ui.cc |   46 ++++++
 .../browser/ui/webui/file_picker/file_picker_ui.h  |   24 +++
 .../ui/webui/file_picker/file_picker_web_dialog.cc |  165 ++++++++++++++++++++
 chrome/chrome_browser_ui.gypi                      |    4 +
 chrome/common/url_constants.cc                     |    3 +
 chrome/common/url_constants.h                      |    2 +
 tools/gritsettings/resource_ids                    |    2 +-
 15 files changed, 431 insertions(+), 4 deletions(-)
 create mode 100644 chrome/browser/resources/file_picker/file_picker.css
 create mode 100644 chrome/browser/resources/file_picker/file_picker.html
 create mode 100644 chrome/browser/resources/file_picker/file_picker.js

From 1cc6b741d664fced4fafcdf656b5766419e12382 Mon Sep 17 00:00:00 2001
From: Joone Hur <joone.hur@intel.com>
Date: Thu, 23 Oct 2014 19:25:14 -0700
Subject: [PATCH] Add file picker support using WebUI

File-picker has not been supported in oz-wl because Gtk+2 does not work under
Wayland. Chromium Linux version still uses Gtk+ for file-picker.
