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; |
@@ -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_; |
}; |
@@ -477,13 +487,13 @@ |
// 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, |
allow_multiple_files); |
- open_file_picker->Run(); |
+ file_picker_->Run(); |
} |
void ChromeAppViewAsh::OnDisplayFileSaveAsDialog( |
@@ -491,13 +501,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) { |
@@ -529,6 +548,19 @@ |
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, |
+ folder_picker->result())); |
+ } |
+ delete folder_picker; |
+} |
+ |
HRESULT ChromeAppViewAsh::OnActivate( |
winapp::Core::ICoreApplicationView*, |
winapp::Activation::IActivatedEventArgs* args) { |