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

Side by Side Diff: chrome/browser/ui/views/select_file_dialog_extension.h

Issue 10669023: Start consolidating non-port specific code to ui/base/dialogs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: clenaup Created 8 years, 5 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 | Annotate | Revision Log
OLDNEW
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 19
20 namespace content { 20 namespace content {
21 class RenderViewHost; 21 class RenderViewHost;
22 }
23
24 namespace ui {
22 struct SelectedFileInfo; 25 struct SelectedFileInfo;
23 } 26 }
24 27
25 // 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
26 // file manager extension implementation. 29 // file manager extension implementation.
27 class SelectFileDialogExtension 30 class SelectFileDialogExtension
28 : public SelectFileDialog, 31 : public SelectFileDialog,
29 public ExtensionDialogObserver { 32 public ExtensionDialogObserver {
30 public: 33 public:
31 static SelectFileDialogExtension* Create( 34 static SelectFileDialogExtension* Create(
32 SelectFileDialog::Listener* listener); 35 SelectFileDialog::Listener* listener);
33 36
34 // BaseShellDialog implementation. 37 // BaseShellDialog implementation.
35 virtual bool IsRunning(gfx::NativeWindow owner_window) const OVERRIDE; 38 virtual bool IsRunning(gfx::NativeWindow owner_window) const OVERRIDE;
36 virtual void ListenerDestroyed() OVERRIDE; 39 virtual void ListenerDestroyed() OVERRIDE;
37 40
38 // ExtensionDialog::Observer implementation. 41 // ExtensionDialog::Observer implementation.
39 virtual void ExtensionDialogClosing(ExtensionDialog* dialog) OVERRIDE; 42 virtual void ExtensionDialogClosing(ExtensionDialog* dialog) OVERRIDE;
40 virtual void ExtensionTerminated(ExtensionDialog* dialog) OVERRIDE; 43 virtual void ExtensionTerminated(ExtensionDialog* dialog) OVERRIDE;
41 44
42 // Routes callback to appropriate SelectFileDialog::Listener based on 45 // Routes callback to appropriate SelectFileDialog::Listener based on
43 // the owning |tab_id|. 46 // the owning |tab_id|.
44 static void OnFileSelected(int32 tab_id, 47 static void OnFileSelected(int32 tab_id,
45 const content::SelectedFileInfo& file, 48 const ui::SelectedFileInfo& file,
46 int index); 49 int index);
47 static void OnMultiFilesSelected( 50 static void OnMultiFilesSelected(
48 int32 tab_id, 51 int32 tab_id,
49 const std::vector<content::SelectedFileInfo>& files); 52 const std::vector<ui::SelectedFileInfo>& files);
50 static void OnFileSelectionCanceled(int32 tab_id); 53 static void OnFileSelectionCanceled(int32 tab_id);
51 54
52 // For testing, so we can inject JavaScript into the contained view. 55 // For testing, so we can inject JavaScript into the contained view.
53 content::RenderViewHost* GetRenderViewHost(); 56 content::RenderViewHost* GetRenderViewHost();
54 57
55 protected: 58 protected:
56 // SelectFileDialog implementation. 59 // SelectFileDialog implementation.
57 virtual void SelectFileImpl(Type type, 60 virtual void SelectFileImpl(Type type,
58 const string16& title, 61 const string16& title,
59 const FilePath& default_path, 62 const FilePath& default_path,
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 103
101 // We defer the callback into SelectFileDialog::Listener until the window 104 // We defer the callback into SelectFileDialog::Listener until the window
102 // closes, to match the semantics of file selection on Windows and Mac. 105 // closes, to match the semantics of file selection on Windows and Mac.
103 // These are the data passed to the listener. 106 // These are the data passed to the listener.
104 enum SelectionType { 107 enum SelectionType {
105 CANCEL = 0, 108 CANCEL = 0,
106 SINGLE_FILE, 109 SINGLE_FILE,
107 MULTIPLE_FILES 110 MULTIPLE_FILES
108 }; 111 };
109 SelectionType selection_type_; 112 SelectionType selection_type_;
110 std::vector<content::SelectedFileInfo> selection_files_; 113 std::vector<ui::SelectedFileInfo> selection_files_;
111 int selection_index_; 114 int selection_index_;
112 void* params_; 115 void* params_;
113 116
114 DISALLOW_COPY_AND_ASSIGN(SelectFileDialogExtension); 117 DISALLOW_COPY_AND_ASSIGN(SelectFileDialogExtension);
115 }; 118 };
116 119
117 #endif // CHROME_BROWSER_UI_VIEWS_SELECT_FILE_DIALOG_EXTENSION_H_ 120 #endif // CHROME_BROWSER_UI_VIEWS_SELECT_FILE_DIALOG_EXTENSION_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/color_chooser_dialog.h ('k') | chrome/browser/ui/views/select_file_dialog_extension.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698