OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 | 4 |
5 #ifndef CHROME_BROWSER_FILE_SELECT_HELPER_H_ | 5 #ifndef CHROME_BROWSER_FILE_SELECT_HELPER_H_ |
6 #define CHROME_BROWSER_FILE_SELECT_HELPER_H_ | 6 #define CHROME_BROWSER_FILE_SELECT_HELPER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "base/gtest_prod_util.h" | 13 #include "base/gtest_prod_util.h" |
14 #include "chrome/browser/ui/select_file_dialog.h" | 14 #include "chrome/browser/ui/select_file_dialog.h" |
15 #include "content/public/browser/notification_observer.h" | 15 #include "content/public/browser/notification_observer.h" |
16 #include "content/public/browser/notification_registrar.h" | 16 #include "content/public/browser/notification_registrar.h" |
17 #include "net/base/directory_lister.h" | 17 #include "net/base/directory_lister.h" |
18 | 18 |
19 class Profile; | 19 class Profile; |
20 | 20 |
21 namespace content { | 21 namespace content { |
22 class RenderViewHost; | 22 class RenderViewHost; |
23 struct FileChooserParams; | 23 struct FileChooserParams; |
| 24 } |
| 25 |
| 26 namespace ui { |
24 struct SelectedFileInfo; | 27 struct SelectedFileInfo; |
25 } | 28 } |
26 | 29 |
27 // This class handles file-selection requests coming from WebUI elements | 30 // This class handles file-selection requests coming from WebUI elements |
28 // (via the ExtensionHost class). It implements both the initialisation | 31 // (via the ExtensionHost class). It implements both the initialisation |
29 // and listener functions for file-selection dialogs. | 32 // and listener functions for file-selection dialogs. |
30 class FileSelectHelper | 33 class FileSelectHelper |
31 : public base::RefCountedThreadSafe<FileSelectHelper>, | 34 : public base::RefCountedThreadSafe<FileSelectHelper>, |
32 public SelectFileDialog::Listener, | 35 public SelectFileDialog::Listener, |
33 public content::NotificationObserver { | 36 public content::NotificationObserver { |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 const content::FileChooserParams& params); | 84 const content::FileChooserParams& params); |
82 | 85 |
83 // Cleans up and releases this instance. This must be called after the last | 86 // Cleans up and releases this instance. This must be called after the last |
84 // callback is received from the file chooser dialog. | 87 // callback is received from the file chooser dialog. |
85 void RunFileChooserEnd(); | 88 void RunFileChooserEnd(); |
86 | 89 |
87 // SelectFileDialog::Listener overrides. | 90 // SelectFileDialog::Listener overrides. |
88 virtual void FileSelected( | 91 virtual void FileSelected( |
89 const FilePath& path, int index, void* params) OVERRIDE; | 92 const FilePath& path, int index, void* params) OVERRIDE; |
90 virtual void FileSelectedWithExtraInfo( | 93 virtual void FileSelectedWithExtraInfo( |
91 const content::SelectedFileInfo& file, | 94 const ui::SelectedFileInfo& file, |
92 int index, | 95 int index, |
93 void* params) OVERRIDE; | 96 void* params) OVERRIDE; |
94 virtual void MultiFilesSelected(const std::vector<FilePath>& files, | 97 virtual void MultiFilesSelected(const std::vector<FilePath>& files, |
95 void* params) OVERRIDE; | 98 void* params) OVERRIDE; |
96 virtual void MultiFilesSelectedWithExtraInfo( | 99 virtual void MultiFilesSelectedWithExtraInfo( |
97 const std::vector<content::SelectedFileInfo>& files, | 100 const std::vector<ui::SelectedFileInfo>& files, |
98 void* params) OVERRIDE; | 101 void* params) OVERRIDE; |
99 virtual void FileSelectionCanceled(void* params) OVERRIDE; | 102 virtual void FileSelectionCanceled(void* params) OVERRIDE; |
100 | 103 |
101 // content::NotificationObserver overrides. | 104 // content::NotificationObserver overrides. |
102 virtual void Observe(int type, | 105 virtual void Observe(int type, |
103 const content::NotificationSource& source, | 106 const content::NotificationSource& source, |
104 const content::NotificationDetails& details) OVERRIDE; | 107 const content::NotificationDetails& details) OVERRIDE; |
105 | 108 |
106 void EnumerateDirectory(int request_id, | 109 void EnumerateDirectory(int request_id, |
107 content::RenderViewHost* render_view_host, | 110 content::RenderViewHost* render_view_host, |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 struct ActiveDirectoryEnumeration; | 158 struct ActiveDirectoryEnumeration; |
156 std::map<int, ActiveDirectoryEnumeration*> directory_enumerations_; | 159 std::map<int, ActiveDirectoryEnumeration*> directory_enumerations_; |
157 | 160 |
158 // Registrar for notifications regarding our RenderViewHost. | 161 // Registrar for notifications regarding our RenderViewHost. |
159 content::NotificationRegistrar notification_registrar_; | 162 content::NotificationRegistrar notification_registrar_; |
160 | 163 |
161 DISALLOW_COPY_AND_ASSIGN(FileSelectHelper); | 164 DISALLOW_COPY_AND_ASSIGN(FileSelectHelper); |
162 }; | 165 }; |
163 | 166 |
164 #endif // CHROME_BROWSER_FILE_SELECT_HELPER_H_ | 167 #endif // CHROME_BROWSER_FILE_SELECT_HELPER_H_ |
OLD | NEW |