Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(329)

Unified Diff: ui/shell_dialogs/select_file_dialog_win.cc

Issue 1602403002: Revert of Remove remote tree host and some related input and metro_driver code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@metro-mode-3
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/shell_dialogs/BUILD.gn ('k') | ui/shell_dialogs/shell_dialogs.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/shell_dialogs/select_file_dialog_win.cc
diff --git a/ui/shell_dialogs/select_file_dialog_win.cc b/ui/shell_dialogs/select_file_dialog_win.cc
index 4cd8896b02515ba9edc7e3cb332d9324247ffa1c..40215a344fee59fc74d0d75987bfd0e974dbb43a 100644
--- a/ui/shell_dialogs/select_file_dialog_win.cc
+++ b/ui/shell_dialogs/select_file_dialog_win.cc
@@ -30,6 +30,7 @@
#include "ui/shell_dialogs/base_shell_dialog_win.h"
#include "ui/shell_dialogs/shell_dialogs_delegate.h"
#include "ui/strings/grit/ui_strings.h"
+#include "win8/viewer/metro_viewer_process_host.h"
namespace {
@@ -327,6 +328,59 @@
void* params) {
has_multiple_file_type_choices_ =
file_types ? file_types->extensions.size() > 1 : true;
+ // If the owning_window passed in is in metro then we need to forward the
+ // file open/save operations to metro.
+ if (GetShellDialogsDelegate() &&
+ GetShellDialogsDelegate()->IsWindowInMetro(owning_window)) {
+ if (type == SELECT_SAVEAS_FILE) {
+ win8::MetroViewerProcessHost::HandleSaveFile(
+ title,
+ default_path,
+ GetFilterForFileTypes(file_types),
+ file_type_index,
+ default_extension,
+ base::Bind(&ui::SelectFileDialog::Listener::FileSelected,
+ base::Unretained(listener_)),
+ base::Bind(&ui::SelectFileDialog::Listener::FileSelectionCanceled,
+ base::Unretained(listener_)));
+ return;
+ } else if (type == SELECT_OPEN_FILE) {
+ win8::MetroViewerProcessHost::HandleOpenFile(
+ title,
+ default_path,
+ GetFilterForFileTypes(file_types),
+ base::Bind(&ui::SelectFileDialog::Listener::FileSelected,
+ base::Unretained(listener_)),
+ base::Bind(&ui::SelectFileDialog::Listener::FileSelectionCanceled,
+ base::Unretained(listener_)));
+ return;
+ } else if (type == SELECT_OPEN_MULTI_FILE) {
+ win8::MetroViewerProcessHost::HandleOpenMultipleFiles(
+ title,
+ default_path,
+ GetFilterForFileTypes(file_types),
+ base::Bind(&ui::SelectFileDialog::Listener::MultiFilesSelected,
+ base::Unretained(listener_)),
+ base::Bind(&ui::SelectFileDialog::Listener::FileSelectionCanceled,
+ base::Unretained(listener_)));
+ return;
+ } else if (type == SELECT_FOLDER || type == SELECT_UPLOAD_FOLDER) {
+ base::string16 title_string = title;
+ if (type == SELECT_UPLOAD_FOLDER && title_string.empty()) {
+ // If it's for uploading don't use default dialog title to
+ // make sure we clearly tell it's for uploading.
+ title_string = l10n_util::GetStringUTF16(
+ IDS_SELECT_UPLOAD_FOLDER_DIALOG_TITLE);
+ }
+ win8::MetroViewerProcessHost::HandleSelectFolder(
+ title_string,
+ base::Bind(&ui::SelectFileDialog::Listener::FileSelected,
+ base::Unretained(listener_)),
+ base::Bind(&ui::SelectFileDialog::Listener::FileSelectionCanceled,
+ base::Unretained(listener_)));
+ return;
+ }
+ }
HWND owner = owning_window && owning_window->GetRootWindow()
? owning_window->GetHost()->GetAcceleratedWidget() : NULL;
« no previous file with comments | « ui/shell_dialogs/BUILD.gn ('k') | ui/shell_dialogs/shell_dialogs.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698