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

Unified Diff: win8/metro_driver/chrome_app_view_ash.cc

Issue 14282002: Added support for displaying the select folder picker in Chrome ASH on Windows 8. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 8 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 | « win8/metro_driver/chrome_app_view_ash.h ('k') | win8/metro_driver/file_picker_ash.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: win8/metro_driver/chrome_app_view_ash.cc
===================================================================
--- win8/metro_driver/chrome_app_view_ash.cc (revision 194196)
+++ win8/metro_driver/chrome_app_view_ash.cc (working copy)
@@ -81,6 +81,8 @@
OnDisplayFileOpenDialog)
IPC_MESSAGE_HANDLER(MetroViewerHostMsg_DisplayFileSaveAs,
OnDisplayFileSaveAsDialog)
+ IPC_MESSAGE_HANDLER(MetroViewerHostMsg_DisplaySelectFolder,
+ OnDisplayFolderPicker)
IPC_MESSAGE_UNHANDLED(__debugbreak())
IPC_END_MESSAGE_MAP()
return true;
@@ -101,7 +103,7 @@
void OnDisplayFileOpenDialog(const string16& title,
const string16& filter,
- const string16& default_path,
+ const base::FilePath& default_path,
bool allow_multiple_files) {
ui_proxy_->PostTask(FROM_HERE,
base::Bind(&ChromeAppViewAsh::OnDisplayFileOpenDialog,
@@ -121,6 +123,14 @@
params));
}
+ void OnDisplayFolderPicker(const string16& title) {
+ ui_proxy_->PostTask(
+ FROM_HERE,
+ base::Bind(&ChromeAppViewAsh::OnDisplayFolderPicker,
+ base::Unretained(app_view_),
+ title));
+ }
+
scoped_refptr<base::MessageLoopProxy> ui_proxy_;
ChromeAppViewAsh* app_view_;
};
@@ -468,22 +478,23 @@
::SetCursor(HCURSOR(cursor));
}
-void ChromeAppViewAsh::OnDisplayFileOpenDialog(const string16& title,
- const string16& filter,
- const string16& default_path,
- bool allow_multiple_files) {
+void ChromeAppViewAsh::OnDisplayFileOpenDialog(
+ const string16& title,
+ const string16& filter,
+ const base::FilePath& default_path,
+ bool allow_multiple_files) {
DVLOG(1) << __FUNCTION__;
// The OpenFilePickerSession instance is deleted when we receive a
// callback from the OpenFilePickerSession class about the completion of the
// operation.
- OpenFilePickerSession* open_file_picker =
+ FilePickerSessionBase* file_picker_ =
new OpenFilePickerSession(this,
title,
filter,
- default_path,
+ default_path.value(),
allow_multiple_files);
- open_file_picker->Run();
+ file_picker_->Run();
}
void ChromeAppViewAsh::OnDisplayFileSaveAsDialog(
@@ -491,13 +502,22 @@
DVLOG(1) << __FUNCTION__;
// The SaveFilePickerSession instance is deleted when we receive a
- // callback from the OpenFilePickerSession class about the completion of the
+ // callback from the SaveFilePickerSession class about the completion of the
// operation.
- SaveFilePickerSession* save_file_picker =
+ FilePickerSessionBase* file_picker_ =
new SaveFilePickerSession(this, params);
- save_file_picker->Run();
+ file_picker_->Run();
}
+void ChromeAppViewAsh::OnDisplayFolderPicker(const string16& title) {
+ DVLOG(1) << __FUNCTION__;
+ // The FolderPickerSession instance is deleted when we receive a
+ // callback from the FolderPickerSession class about the completion of the
+ // operation.
+ FilePickerSessionBase* file_picker_ = new FolderPickerSession(this, title);
+ file_picker_->Run();
+}
+
void ChromeAppViewAsh::OnOpenFileCompleted(
OpenFilePickerSession* open_file_picker,
bool success) {
@@ -509,7 +529,7 @@
success, open_file_picker->filenames()));
} else {
ui_channel_->Send(new MetroViewerHostMsg_FileOpenDone(
- success, open_file_picker->result()));
+ success, base::FilePath(open_file_picker->result())));
}
}
delete open_file_picker;
@@ -523,12 +543,25 @@
if (ui_channel_) {
ui_channel_->Send(new MetroViewerHostMsg_FileSaveAsDone(
success,
- save_file_picker->result(),
+ base::FilePath(save_file_picker->result()),
save_file_picker->filter_index()));
}
delete save_file_picker;
}
+void ChromeAppViewAsh::OnFolderPickerCompleted(
+ FolderPickerSession* folder_picker,
+ bool success) {
+ DVLOG(1) << __FUNCTION__;
+ DVLOG(1) << "Success: " << success;
+ if (ui_channel_) {
+ ui_channel_->Send(new MetroViewerHostMsg_SelectFolderDone(
+ success,
+ base::FilePath(folder_picker->result())));
+ }
+ delete folder_picker;
+}
+
HRESULT ChromeAppViewAsh::OnActivate(
winapp::Core::ICoreApplicationView*,
winapp::Activation::IActivatedEventArgs* args) {
« no previous file with comments | « win8/metro_driver/chrome_app_view_ash.h ('k') | win8/metro_driver/file_picker_ash.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698