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_UI_VIEWS_SELECT_FILE_DIALOG_EXTENSION_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_SELECT_FILE_DIALOG_EXTENSION_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_SELECT_FILE_DIALOG_EXTENSION_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_SELECT_FILE_DIALOG_EXTENSION_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "chrome/browser/ui/select_file_dialog.h" | 13 #include "chrome/browser/ui/select_file_dialog.h" |
14 #include "chrome/browser/ui/views/extensions/extension_dialog_observer.h" | 14 #include "chrome/browser/ui/views/extensions/extension_dialog_observer.h" |
15 #include "ui/gfx/native_widget_types.h" // gfx::NativeWindow | 15 #include "ui/gfx/native_widget_types.h" // gfx::NativeWindow |
16 | 16 |
17 class ExtensionDialog; | 17 class ExtensionDialog; |
18 class Profile; | 18 class Profile; |
19 | 19 |
20 namespace content { | 20 namespace content { |
21 class RenderViewHost; | 21 class RenderViewHost; |
22 } | 22 } |
23 | 23 |
24 namespace ui { | 24 namespace ui { |
25 struct SelectedFileInfo; | 25 struct SelectedFileInfo; |
| 26 class SelectFilePolicy; |
26 } | 27 } |
27 | 28 |
28 // Shows a dialog box for selecting a file or a folder, using the | 29 // Shows a dialog box for selecting a file or a folder, using the |
29 // file manager extension implementation. | 30 // file manager extension implementation. |
30 class SelectFileDialogExtension | 31 class SelectFileDialogExtension |
31 : public SelectFileDialog, | 32 : public SelectFileDialog, |
32 public ExtensionDialogObserver { | 33 public ExtensionDialogObserver { |
33 public: | 34 public: |
34 static SelectFileDialogExtension* Create( | 35 static SelectFileDialogExtension* Create( |
35 SelectFileDialog::Listener* listener); | 36 SelectFileDialog::Listener* listener, |
| 37 ui::SelectFilePolicy* policy); |
36 | 38 |
37 // BaseShellDialog implementation. | 39 // BaseShellDialog implementation. |
38 virtual bool IsRunning(gfx::NativeWindow owner_window) const OVERRIDE; | 40 virtual bool IsRunning(gfx::NativeWindow owner_window) const OVERRIDE; |
39 virtual void ListenerDestroyed() OVERRIDE; | 41 virtual void ListenerDestroyed() OVERRIDE; |
40 | 42 |
41 // ExtensionDialog::Observer implementation. | 43 // ExtensionDialog::Observer implementation. |
42 virtual void ExtensionDialogClosing(ExtensionDialog* dialog) OVERRIDE; | 44 virtual void ExtensionDialogClosing(ExtensionDialog* dialog) OVERRIDE; |
43 virtual void ExtensionTerminated(ExtensionDialog* dialog) OVERRIDE; | 45 virtual void ExtensionTerminated(ExtensionDialog* dialog) OVERRIDE; |
44 | 46 |
45 // Routes callback to appropriate SelectFileDialog::Listener based on | 47 // Routes callback to appropriate SelectFileDialog::Listener based on |
(...skipping 19 matching lines...) Expand all Loading... |
65 const FilePath::StringType& default_extension, | 67 const FilePath::StringType& default_extension, |
66 gfx::NativeWindow owning_window, | 68 gfx::NativeWindow owning_window, |
67 void* params) OVERRIDE; | 69 void* params) OVERRIDE; |
68 | 70 |
69 | 71 |
70 private: | 72 private: |
71 friend class SelectFileDialogExtensionBrowserTest; | 73 friend class SelectFileDialogExtensionBrowserTest; |
72 friend class SelectFileDialogExtensionTest; | 74 friend class SelectFileDialogExtensionTest; |
73 | 75 |
74 // Object is ref-counted, use Create(). | 76 // Object is ref-counted, use Create(). |
75 explicit SelectFileDialogExtension(SelectFileDialog::Listener* listener); | 77 explicit SelectFileDialogExtension(SelectFileDialog::Listener* listener, |
| 78 ui::SelectFilePolicy* policy); |
76 virtual ~SelectFileDialogExtension(); | 79 virtual ~SelectFileDialogExtension(); |
77 | 80 |
78 // Invokes the appropriate file selection callback on our listener. | 81 // Invokes the appropriate file selection callback on our listener. |
79 void NotifyListener(); | 82 void NotifyListener(); |
80 | 83 |
81 // Adds this to the list of pending dialogs, used for testing. | 84 // Adds this to the list of pending dialogs, used for testing. |
82 void AddPending(int32 tab_id); | 85 void AddPending(int32 tab_id); |
83 | 86 |
84 // Check if the list of pending dialogs contains dialog for |tab_id|. | 87 // Check if the list of pending dialogs contains dialog for |tab_id|. |
85 static bool PendingExists(int32 tab_id); | 88 static bool PendingExists(int32 tab_id); |
(...skipping 25 matching lines...) Expand all Loading... |
111 }; | 114 }; |
112 SelectionType selection_type_; | 115 SelectionType selection_type_; |
113 std::vector<ui::SelectedFileInfo> selection_files_; | 116 std::vector<ui::SelectedFileInfo> selection_files_; |
114 int selection_index_; | 117 int selection_index_; |
115 void* params_; | 118 void* params_; |
116 | 119 |
117 DISALLOW_COPY_AND_ASSIGN(SelectFileDialogExtension); | 120 DISALLOW_COPY_AND_ASSIGN(SelectFileDialogExtension); |
118 }; | 121 }; |
119 | 122 |
120 #endif // CHROME_BROWSER_UI_VIEWS_SELECT_FILE_DIALOG_EXTENSION_H_ | 123 #endif // CHROME_BROWSER_UI_VIEWS_SELECT_FILE_DIALOG_EXTENSION_H_ |
OLD | NEW |