 +                        new FilePickerWebDialog(type, listener));
 +}
 +
-+void FilePickerWebDialog::Close(std::string& file_path) const {
++void FilePickerWebDialog::Close(const std::string& file_path) const {
 +  if (!file_path.empty())
 +    listener_->FileSelected(base::FilePath(file_path), 0 , NULL);
 +  else

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.

This implementation allows for oz-wl to show a web based file picker UI.
Currently, the WebUI only supports basic functionality for opening a file.
File browsing UI will be added later.
---
 .../browser/resources/file_picker/file_picker.css  |  72 +++++++++
 .../browser/resources/file_picker/file_picker.html |  37 +++++
 .../browser/resources/file_picker/file_picker.js   |  51 +++++++
 .../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 +++++++++++++++++++++
 6 files changed, 395 insertions(+)
 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

+
+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 b878bd1..f8c361e 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_util.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 5121a05..1601af0 100644
--- a/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc
+++ b/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc
@@ -25,6 +25,7 @@
 #include "chrome/browser/ui/webui/crashes_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/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"
@@ -286,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
