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