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

Side by Side Diff: win8/metro_driver/file_picker_ash.h

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 unified diff | Download patch
« no previous file with comments | « win8/metro_driver/file_picker.cc ('k') | win8/metro_driver/file_picker_ash.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4 #ifndef CHROME_BROWSER_UI_METRO_DRIVER_FILE_PICKER_ASH_H_
5 #define CHROME_BROWSER_UI_METRO_DRIVER_FILE_PICKER_ASH_H_
6
7 #include <vector>
8
9 #include "base/compiler_specific.h"
10 #include "base/files/file_path.h"
11 #include "base/macros.h"
12 #include "base/strings/string16.h"
13
14 class ChromeAppViewAsh;
15 struct MetroViewerHostMsg_SaveAsDialogParams;
16
17 namespace base {
18 class FilePath;
19 }
20
21 // Base class for the file pickers.
22 class FilePickerSessionBase {
23 public:
24 virtual ~FilePickerSessionBase();
25
26 // Runs the picker, returns true on success.
27 bool Run();
28
29 const base::string16& result() const { return result_; }
30
31 bool success() const { return success_; }
32
33 protected:
34 // Creates a file picker for open_file_name.
35 FilePickerSessionBase(ChromeAppViewAsh* app_view,
36 const base::string16& title,
37 const base::string16& filter,
38 const base::FilePath& default_path);
39
40 // Creates, configures and starts a file picker.
41 // If the HRESULT returned is a failure code the file picker has not started,
42 // so no callbacks should be expected.
43 virtual HRESULT StartFilePicker() = 0;
44
45 // True iff a file picker has successfully finished.
46 bool success_;
47
48 // The title of the file picker.
49 base::string16 title_;
50
51 // The file type filter.
52 base::string16 filter_;
53
54 // The starting directory/file name.
55 base::FilePath default_path_;
56
57 // Pointer to the ChromeAppViewAsh instance. We notify the ChromeAppViewAsh
58 // instance when the file open/save operations complete.
59 ChromeAppViewAsh* app_view_;
60
61 base::string16 result_;
62
63 private:
64 // Initiate a file picker, must be called on the main metro thread.
65 // Returns true on success.
66 bool DoFilePicker();
67
68 DISALLOW_COPY_AND_ASSIGN(FilePickerSessionBase);
69 };
70
71 // Provides functionality to display the open file/multiple open file pickers
72 // metro dialog.
73 class OpenFilePickerSession : public FilePickerSessionBase {
74 public:
75 OpenFilePickerSession(ChromeAppViewAsh* app_view,
76 const base::string16& title,
77 const base::string16& filter,
78 const base::FilePath& default_path,
79 bool allow_multi_select);
80 ~OpenFilePickerSession() override;
81
82 const std::vector<base::FilePath>& filenames() const {
83 return filenames_;
84 }
85
86 bool allow_multi_select() const { return allow_multi_select_; }
87
88 private:
89 HRESULT StartFilePicker() override;
90
91 typedef winfoundtn::IAsyncOperation<winstorage::StorageFile*>
92 SingleFileAsyncOp;
93 typedef winfoundtn::Collections::IVectorView<
94 winstorage::StorageFile*> StorageFileVectorCollection;
95 typedef winfoundtn::IAsyncOperation<StorageFileVectorCollection*>
96 MultiFileAsyncOp;
97
98 // Called asynchronously when a single file picker is done.
99 HRESULT SinglePickerDone(SingleFileAsyncOp* async, AsyncStatus status);
100
101 // Called asynchronously when a multi file picker is done.
102 HRESULT MultiPickerDone(MultiFileAsyncOp* async, AsyncStatus status);
103
104 // Composes a multi-file result string suitable for returning to a
105 // from a storage file collection.
106 static HRESULT ComposeMultiFileResult(StorageFileVectorCollection* files,
107 base::string16* result);
108
109 // True if the multi file picker is to be displayed.
110 bool allow_multi_select_;
111 // If multi select is true then this member contains the list of filenames
112 // to be returned back.
113 std::vector<base::FilePath> filenames_;
114
115 DISALLOW_COPY_AND_ASSIGN(OpenFilePickerSession);
116 };
117
118 // Provides functionality to display the save file picker.
119 class SaveFilePickerSession : public FilePickerSessionBase {
120 public:
121 SaveFilePickerSession(ChromeAppViewAsh* app_view,
122 const MetroViewerHostMsg_SaveAsDialogParams& params);
123
124 int filter_index() const;
125
126 private:
127 HRESULT StartFilePicker() override;
128
129 typedef winfoundtn::IAsyncOperation<winstorage::StorageFile*> SaveFileAsyncOp;
130
131 // Called asynchronously when the save file picker is done.
132 HRESULT FilePickerDone(SaveFileAsyncOp* async, AsyncStatus status);
133
134 int filter_index_;
135
136 DISALLOW_COPY_AND_ASSIGN(SaveFilePickerSession);
137 };
138
139 // Provides functionality to display the folder picker.
140 class FolderPickerSession : public FilePickerSessionBase {
141 public:
142 FolderPickerSession(ChromeAppViewAsh* app_view, const base::string16& title);
143
144 private:
145 HRESULT StartFilePicker() override;
146
147 typedef winfoundtn::IAsyncOperation<winstorage::StorageFolder*>
148 FolderPickerAsyncOp;
149
150 // Called asynchronously when the folder picker is done.
151 HRESULT FolderPickerDone(FolderPickerAsyncOp* async, AsyncStatus status);
152
153 DISALLOW_COPY_AND_ASSIGN(FolderPickerSession);
154 };
155
156 #endif // CHROME_BROWSER_UI_METRO_DRIVER_FILE_PICKER_ASH_H_
157
OLDNEW
« no previous file with comments | « win8/metro_driver/file_picker.cc ('k') | win8/metro_driver/file_picker_ash.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698