| 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 Browser; | 17 class Browser; |
| 18 class ExtensionDialog; | 18 class ExtensionDialog; |
| 19 |
| 20 namespace content { |
| 19 class RenderViewHost; | 21 class RenderViewHost; |
| 22 } |
| 20 | 23 |
| 21 // Shows a dialog box for selecting a file or a folder, using the | 24 // Shows a dialog box for selecting a file or a folder, using the |
| 22 // file manager extension implementation. | 25 // file manager extension implementation. |
| 23 class SelectFileDialogExtension | 26 class SelectFileDialogExtension |
| 24 : public SelectFileDialog, | 27 : public SelectFileDialog, |
| 25 public ExtensionDialogObserver { | 28 public ExtensionDialogObserver { |
| 26 public: | 29 public: |
| 27 static SelectFileDialogExtension* Create( | 30 static SelectFileDialogExtension* Create( |
| 28 SelectFileDialog::Listener* listener); | 31 SelectFileDialog::Listener* listener); |
| 29 | 32 |
| 30 // BaseShellDialog implementation. | 33 // BaseShellDialog implementation. |
| 31 virtual bool IsRunning(gfx::NativeWindow owner_window) const OVERRIDE; | 34 virtual bool IsRunning(gfx::NativeWindow owner_window) const OVERRIDE; |
| 32 virtual void ListenerDestroyed() OVERRIDE; | 35 virtual void ListenerDestroyed() OVERRIDE; |
| 33 | 36 |
| 34 // ExtensionDialog::Observer implementation. | 37 // ExtensionDialog::Observer implementation. |
| 35 virtual void ExtensionDialogClosing(ExtensionDialog* dialog) OVERRIDE; | 38 virtual void ExtensionDialogClosing(ExtensionDialog* dialog) OVERRIDE; |
| 36 virtual void ExtensionTerminated(ExtensionDialog* dialog) OVERRIDE; | 39 virtual void ExtensionTerminated(ExtensionDialog* dialog) OVERRIDE; |
| 37 | 40 |
| 38 // Routes callback to appropriate SelectFileDialog::Listener based on | 41 // Routes callback to appropriate SelectFileDialog::Listener based on |
| 39 // the owning |tab_id|. | 42 // the owning |tab_id|. |
| 40 static void OnFileSelected(int32 tab_id, const FilePath& path, int index); | 43 static void OnFileSelected(int32 tab_id, const FilePath& path, int index); |
| 41 static void OnMultiFilesSelected(int32 tab_id, | 44 static void OnMultiFilesSelected(int32 tab_id, |
| 42 const std::vector<FilePath>& files); | 45 const std::vector<FilePath>& files); |
| 43 static void OnFileSelectionCanceled(int32 tab_id); | 46 static void OnFileSelectionCanceled(int32 tab_id); |
| 44 | 47 |
| 45 // For testing, so we can inject JavaScript into the contained view. | 48 // For testing, so we can inject JavaScript into the contained view. |
| 46 RenderViewHost* GetRenderViewHost(); | 49 content::RenderViewHost* GetRenderViewHost(); |
| 47 | 50 |
| 48 protected: | 51 protected: |
| 49 // SelectFileDialog implementation. | 52 // SelectFileDialog implementation. |
| 50 virtual void SelectFileImpl(Type type, | 53 virtual void SelectFileImpl(Type type, |
| 51 const string16& title, | 54 const string16& title, |
| 52 const FilePath& default_path, | 55 const FilePath& default_path, |
| 53 const FileTypeInfo* file_types, | 56 const FileTypeInfo* file_types, |
| 54 int file_type_index, | 57 int file_type_index, |
| 55 const FilePath::StringType& default_extension, | 58 const FilePath::StringType& default_extension, |
| 56 gfx::NativeWindow owning_window, | 59 gfx::NativeWindow owning_window, |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 }; | 104 }; |
| 102 SelectionType selection_type_; | 105 SelectionType selection_type_; |
| 103 std::vector<FilePath> selection_files_; | 106 std::vector<FilePath> selection_files_; |
| 104 int selection_index_; | 107 int selection_index_; |
| 105 void* params_; | 108 void* params_; |
| 106 | 109 |
| 107 DISALLOW_COPY_AND_ASSIGN(SelectFileDialogExtension); | 110 DISALLOW_COPY_AND_ASSIGN(SelectFileDialogExtension); |
| 108 }; | 111 }; |
| 109 | 112 |
| 110 #endif // CHROME_BROWSER_UI_VIEWS_SELECT_FILE_DIALOG_EXTENSION_H_ | 113 #endif // CHROME_BROWSER_UI_VIEWS_SELECT_FILE_DIALOG_EXTENSION_H_ |
| OLD | NEW |