| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 #ifndef CHROME_BROWSER_UI_METRO_DRIVER_FILE_PICKER_ASH_H_ | 4 #ifndef CHROME_BROWSER_UI_METRO_DRIVER_FILE_PICKER_ASH_H_ |
| 5 #define CHROME_BROWSER_UI_METRO_DRIVER_FILE_PICKER_ASH_H_ | 5 #define CHROME_BROWSER_UI_METRO_DRIVER_FILE_PICKER_ASH_H_ |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "base/string16.h" | 11 #include "base/string16.h" |
| 12 | 12 |
| 13 class FilePath; | |
| 14 class ChromeAppViewAsh; | 13 class ChromeAppViewAsh; |
| 15 struct MetroViewerHostMsg_SaveAsDialogParams; | 14 struct MetroViewerHostMsg_SaveAsDialogParams; |
| 16 | 15 |
| 16 namespace base { |
| 17 class FilePath; |
| 18 } |
| 19 |
| 17 // Base class for the file pickers. | 20 // Base class for the file pickers. |
| 18 class FilePickerSessionBase { | 21 class FilePickerSessionBase { |
| 19 public: | 22 public: |
| 20 // Creates a file picker for open_file_name. | 23 // Creates a file picker for open_file_name. |
| 21 explicit FilePickerSessionBase(ChromeAppViewAsh* app_view, | 24 explicit FilePickerSessionBase(ChromeAppViewAsh* app_view, |
| 22 const string16& title, | 25 const string16& title, |
| 23 const string16& filter, | 26 const string16& filter, |
| 24 const string16& default_path); | 27 const string16& default_path); |
| 25 | 28 |
| 26 virtual ~FilePickerSessionBase() { | 29 virtual ~FilePickerSessionBase() { |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 // Provides functionality to display the open file/multiple open file pickers | 75 // Provides functionality to display the open file/multiple open file pickers |
| 73 // metro dialog. | 76 // metro dialog. |
| 74 class OpenFilePickerSession : public FilePickerSessionBase { | 77 class OpenFilePickerSession : public FilePickerSessionBase { |
| 75 public: | 78 public: |
| 76 explicit OpenFilePickerSession(ChromeAppViewAsh* app_view, | 79 explicit OpenFilePickerSession(ChromeAppViewAsh* app_view, |
| 77 const string16& title, | 80 const string16& title, |
| 78 const string16& filter, | 81 const string16& filter, |
| 79 const string16& default_path, | 82 const string16& default_path, |
| 80 bool allow_multi_select); | 83 bool allow_multi_select); |
| 81 | 84 |
| 82 const std::vector<FilePath>& filenames() const { | 85 const std::vector<base::FilePath>& filenames() const { |
| 83 return filenames_; | 86 return filenames_; |
| 84 } | 87 } |
| 85 | 88 |
| 86 const bool allow_multi_select() const { | 89 const bool allow_multi_select() const { |
| 87 return allow_multi_select_; | 90 return allow_multi_select_; |
| 88 } | 91 } |
| 89 | 92 |
| 90 private: | 93 private: |
| 91 virtual HRESULT StartFilePicker() OVERRIDE; | 94 virtual HRESULT StartFilePicker() OVERRIDE; |
| 92 | 95 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 106 // Composes a multi-file result string suitable for returning to a | 109 // Composes a multi-file result string suitable for returning to a |
| 107 // from a storage file collection. | 110 // from a storage file collection. |
| 108 static HRESULT ComposeMultiFileResult(StorageFileVectorCollection* files, | 111 static HRESULT ComposeMultiFileResult(StorageFileVectorCollection* files, |
| 109 string16* result); | 112 string16* result); |
| 110 | 113 |
| 111 private: | 114 private: |
| 112 // True if the multi file picker is to be displayed. | 115 // True if the multi file picker is to be displayed. |
| 113 bool allow_multi_select_; | 116 bool allow_multi_select_; |
| 114 // If multi select is true then this member contains the list of filenames | 117 // If multi select is true then this member contains the list of filenames |
| 115 // to be returned back. | 118 // to be returned back. |
| 116 std::vector<FilePath> filenames_; | 119 std::vector<base::FilePath> filenames_; |
| 117 | 120 |
| 118 DISALLOW_COPY_AND_ASSIGN(OpenFilePickerSession); | 121 DISALLOW_COPY_AND_ASSIGN(OpenFilePickerSession); |
| 119 }; | 122 }; |
| 120 | 123 |
| 121 // Provides functionality to display the save file picker. | 124 // Provides functionality to display the save file picker. |
| 122 class SaveFilePickerSession : public FilePickerSessionBase { | 125 class SaveFilePickerSession : public FilePickerSessionBase { |
| 123 public: | 126 public: |
| 124 explicit SaveFilePickerSession( | 127 explicit SaveFilePickerSession( |
| 125 ChromeAppViewAsh* app_view, | 128 ChromeAppViewAsh* app_view, |
| 126 const MetroViewerHostMsg_SaveAsDialogParams& params); | 129 const MetroViewerHostMsg_SaveAsDialogParams& params); |
| 127 | 130 |
| 128 int SaveFilePickerSession::filter_index() const; | 131 int SaveFilePickerSession::filter_index() const; |
| 129 | 132 |
| 130 private: | 133 private: |
| 131 virtual HRESULT StartFilePicker() OVERRIDE; | 134 virtual HRESULT StartFilePicker() OVERRIDE; |
| 132 | 135 |
| 133 typedef winfoundtn::IAsyncOperation<winstorage::StorageFile*> | 136 typedef winfoundtn::IAsyncOperation<winstorage::StorageFile*> |
| 134 SaveFileAsyncOp; | 137 SaveFileAsyncOp; |
| 135 | 138 |
| 136 // Called asynchronously when the save file picker is done. | 139 // Called asynchronously when the save file picker is done. |
| 137 HRESULT FilePickerDone(SaveFileAsyncOp* async, AsyncStatus status); | 140 HRESULT FilePickerDone(SaveFileAsyncOp* async, AsyncStatus status); |
| 138 | 141 |
| 139 int filter_index_; | 142 int filter_index_; |
| 140 | 143 |
| 141 DISALLOW_COPY_AND_ASSIGN(SaveFilePickerSession); | 144 DISALLOW_COPY_AND_ASSIGN(SaveFilePickerSession); |
| 142 }; | 145 }; |
| 143 | 146 |
| 144 #endif // CHROME_BROWSER_UI_METRO_DRIVER_FILE_PICKER_ASH_H_ | 147 #endif // CHROME_BROWSER_UI_METRO_DRIVER_FILE_PICKER_ASH_H_ |
| 145 | 148 |
| OLD | NEW |