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

Side by Side Diff: chrome/browser/ui/select_file_dialog.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_SELECT_FILE_DIALOG_H_ 5 #ifndef CHROME_BROWSER_UI_SELECT_FILE_DIALOG_H_
6 #define CHROME_BROWSER_UI_SELECT_FILE_DIALOG_H_ 6 #define CHROME_BROWSER_UI_SELECT_FILE_DIALOG_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/file_path.h" 12 #include "base/file_path.h"
13 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
14 #include "base/string16.h" 14 #include "base/string16.h"
15 #include "chrome/browser/ui/base_shell_dialog.h" 15 #include "ui/base/dialogs/base_shell_dialog.h"
16 #include "ui/gfx/native_widget_types.h" 16 #include "ui/gfx/native_widget_types.h"
17 17
18 namespace content { 18 namespace content {
19 class WebContents; 19 class WebContents;
20 }
21
22 namespace ui {
20 struct SelectedFileInfo; 23 struct SelectedFileInfo;
21 } 24 }
22 25
23 // This function is declared extern such that it is accessible for unit tests 26 // This function is declared extern such that it is accessible for unit tests
24 // in /chrome/browser/ui/views/select_file_dialog_win_unittest.cc 27 // in /chrome/browser/ui/views/select_file_dialog_win_unittest.cc
25 extern std::wstring AppendExtensionIfNeeded(const std::wstring& filename, 28 extern std::wstring AppendExtensionIfNeeded(const std::wstring& filename,
26 const std::wstring& filter_selected, 29 const std::wstring& filter_selected,
27 const std::wstring& suggested_ext); 30 const std::wstring& suggested_ext);
28 31
29 // Shows a dialog box for selecting a file or a folder. 32 // Shows a dialog box for selecting a file or a folder.
30 class SelectFileDialog 33 class SelectFileDialog
31 : public base::RefCountedThreadSafe<SelectFileDialog>, 34 : public base::RefCountedThreadSafe<SelectFileDialog>,
32 public BaseShellDialog { 35 public ui::BaseShellDialog {
33 public: 36 public:
34 enum Type { 37 enum Type {
35 SELECT_NONE, 38 SELECT_NONE,
36 SELECT_FOLDER, 39 SELECT_FOLDER,
37 SELECT_SAVEAS_FILE, 40 SELECT_SAVEAS_FILE,
38 SELECT_OPEN_FILE, 41 SELECT_OPEN_FILE,
39 SELECT_OPEN_MULTI_FILE 42 SELECT_OPEN_MULTI_FILE
40 }; 43 };
41 44
42 // An interface implemented by a Listener object wishing to know about the 45 // An interface implemented by a Listener object wishing to know about the
43 // the result of the Select File/Folder action. These callbacks must be 46 // the result of the Select File/Folder action. These callbacks must be
44 // re-entrant. 47 // re-entrant.
45 class Listener { 48 class Listener {
46 public: 49 public:
47 // Notifies the Listener that a file/folder selection has been made. The 50 // Notifies the Listener that a file/folder selection has been made. The
48 // file/folder path is in |path|. |params| is contextual passed to 51 // file/folder path is in |path|. |params| is contextual passed to
49 // SelectFile. |index| specifies the index of the filter passed to the 52 // SelectFile. |index| specifies the index of the filter passed to the
50 // the initial call to SelectFile. 53 // the initial call to SelectFile.
51 virtual void FileSelected(const FilePath& path, 54 virtual void FileSelected(const FilePath& path,
52 int index, void* params) = 0; 55 int index, void* params) = 0;
53 56
54 // Similar to FileSelected() but takes SelectedFileInfo instead of 57 // Similar to FileSelected() but takes SelectedFileInfo instead of
55 // FilePath. Used for passing extra information (ex. display name). 58 // FilePath. Used for passing extra information (ex. display name).
56 // 59 //
57 // If not overridden, calls FileSelected() with path from |file|. 60 // If not overridden, calls FileSelected() with path from |file|.
58 virtual void FileSelectedWithExtraInfo( 61 virtual void FileSelectedWithExtraInfo(
59 const content::SelectedFileInfo& file, 62 const ui::SelectedFileInfo& file,
60 int index, 63 int index,
61 void* params); 64 void* params);
62 65
63 // Notifies the Listener that many files have been selected. The 66 // Notifies the Listener that many files have been selected. The
64 // files are in |files|. |params| is contextual passed to SelectFile. 67 // files are in |files|. |params| is contextual passed to SelectFile.
65 virtual void MultiFilesSelected( 68 virtual void MultiFilesSelected(
66 const std::vector<FilePath>& files, void* params) {} 69 const std::vector<FilePath>& files, void* params) {}
67 70
68 // Similar to MultiFilesSelected() but takes SelectedFileInfo instead of 71 // Similar to MultiFilesSelected() but takes SelectedFileInfo instead of
69 // FilePath. Used for passing extra information (ex. display name). 72 // FilePath. Used for passing extra information (ex. display name).
70 // 73 //
71 // If not overridden, calls MultiFilesSelected() with paths from |files|. 74 // If not overridden, calls MultiFilesSelected() with paths from |files|.
72 virtual void MultiFilesSelectedWithExtraInfo( 75 virtual void MultiFilesSelectedWithExtraInfo(
73 const std::vector<content::SelectedFileInfo>& files, 76 const std::vector<ui::SelectedFileInfo>& files,
74 void* params); 77 void* params);
75 78
76 // Notifies the Listener that the file/folder selection was aborted (via 79 // Notifies the Listener that the file/folder selection was aborted (via
77 // the user canceling or closing the selection dialog box, for example). 80 // the user canceling or closing the selection dialog box, for example).
78 // |params| is contextual passed to SelectFile. 81 // |params| is contextual passed to SelectFile.
79 virtual void FileSelectionCanceled(void* params) {} 82 virtual void FileSelectionCanceled(void* params) {}
80 83
81 protected: 84 protected:
82 virtual ~Listener() {} 85 virtual ~Listener() {}
83 }; 86 };
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 178
176 // Informs the |listener_| that the file selection dialog was canceled. Moved 179 // Informs the |listener_| that the file selection dialog was canceled. Moved
177 // to a function for being able to post it to the message loop. 180 // to a function for being able to post it to the message loop.
178 void CancelFileSelection(void* params); 181 void CancelFileSelection(void* params);
179 182
180 // Returns true if the dialog has multiple file type choices. 183 // Returns true if the dialog has multiple file type choices.
181 virtual bool HasMultipleFileTypeChoicesImpl() = 0; 184 virtual bool HasMultipleFileTypeChoicesImpl() = 0;
182 }; 185 };
183 186
184 #endif // CHROME_BROWSER_UI_SELECT_FILE_DIALOG_H_ 187 #endif // CHROME_BROWSER_UI_SELECT_FILE_DIALOG_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/select_file_dialog_impl_gtk.cc ('k') | chrome/browser/ui/select_file_dialog.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698