OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_FILE_MANAGER_DIALOG_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_FILE_MANAGER_DIALOG_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_FILE_MANAGER_DIALOG_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_FILE_MANAGER_DIALOG_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 | 10 |
11 #include "base/gtest_prod_util.h" | |
11 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
12 #include "chrome/browser/ui/shell_dialogs.h" // SelectFileDialog | 13 #include "chrome/browser/ui/shell_dialogs.h" // SelectFileDialog |
13 #include "chrome/browser/ui/views/extensions/extension_dialog_observer.h" | 14 #include "chrome/browser/ui/views/extensions/extension_dialog_observer.h" |
14 #include "ui/gfx/native_widget_types.h" // gfx::NativeWindow | 15 #include "ui/gfx/native_widget_types.h" // gfx::NativeWindow |
15 | 16 |
16 class ExtensionDialog; | 17 class ExtensionDialog; |
17 class RenderViewHost; | 18 class RenderViewHost; |
18 | 19 |
19 // Shows a dialog box for selecting a file or a folder, using the | 20 // Shows a dialog box for selecting a file or a folder, using the |
20 // file manager extension implementation. | 21 // file manager extension implementation. |
(...skipping 28 matching lines...) Expand all Loading... | |
49 const FileTypeInfo* file_types, | 50 const FileTypeInfo* file_types, |
50 int file_type_index, | 51 int file_type_index, |
51 const FilePath::StringType& default_extension, | 52 const FilePath::StringType& default_extension, |
52 gfx::NativeWindow owning_window, | 53 gfx::NativeWindow owning_window, |
53 void* params) OVERRIDE; | 54 void* params) OVERRIDE; |
54 | 55 |
55 | 56 |
56 private: | 57 private: |
57 friend class FileManagerDialogBrowserTest; | 58 friend class FileManagerDialogBrowserTest; |
58 friend class FileManagerDialogTest; | 59 friend class FileManagerDialogTest; |
60 // This test creates an additional dialog, so we need to friend explicitly. | |
61 FRIEND_TEST_ALL_PREFIXES(FileManagerDialogBrowserTest, OpenTwoDialogs); | |
achuithb
2011/11/10 20:58:40
You could add a protected method like OpenSecondDi
tbarzic
2011/11/10 22:00:48
Done.
| |
59 | 62 |
60 // Object is ref-counted, use FileManagerDialog::Create(). | 63 // Object is ref-counted, use FileManagerDialog::Create(). |
61 explicit FileManagerDialog(SelectFileDialog::Listener* listener); | 64 explicit FileManagerDialog(SelectFileDialog::Listener* listener); |
62 virtual ~FileManagerDialog(); | 65 virtual ~FileManagerDialog(); |
63 | 66 |
64 // Closes the dialog and cleans up callbacks and listeners. | 67 // Closes the dialog and cleans up callbacks and listeners. |
65 void Close(); | 68 void Close(); |
66 | 69 |
67 // Posts a task to close the dialog. | 70 // Posts a task to close the dialog. |
68 void PostTaskToClose(); | 71 void PostTaskToClose(); |
69 | 72 |
70 // Adds this to the list of pending dialogs, used for testing. | 73 // Adds this to the list of pending dialogs, used for testing. |
71 void AddPending(int32 tab_id); | 74 void AddPending(int32 tab_id); |
72 | 75 |
76 // Check if the list of pending dialogs contains dialog for |tab_id|. | |
77 bool PendingExists(int32 tab_id); | |
achuithb
2011/11/10 20:58:40
static?
James Cook
2011/11/10 21:04:54
Maybe call this IsPending()? const?
tbarzic
2011/11/10 22:00:48
Yep
tbarzic
2011/11/10 22:00:48
Hm, I don't feel IsPending would be the right name
| |
78 | |
73 // Returns if the dialog has mutiple file type choices | 79 // Returns if the dialog has mutiple file type choices |
74 virtual bool HasMultipleFileTypeChoicesImpl(); | 80 virtual bool HasMultipleFileTypeChoicesImpl(); |
75 | 81 |
76 bool hasMultipleFileTypeChoices_; | 82 bool hasMultipleFileTypeChoices_; |
77 void* params_; | 83 void* params_; |
78 | 84 |
79 // Host for the extension that implements this dialog. | 85 // Host for the extension that implements this dialog. |
80 scoped_refptr<ExtensionDialog> extension_dialog_; | 86 scoped_refptr<ExtensionDialog> extension_dialog_; |
81 | 87 |
82 // ID of the tab that spawned this dialog, used to route callbacks. | 88 // ID of the tab that spawned this dialog, used to route callbacks. |
83 int32 tab_id_; | 89 int32 tab_id_; |
84 | 90 |
85 gfx::NativeWindow owner_window_; | 91 gfx::NativeWindow owner_window_; |
86 | 92 |
87 DISALLOW_COPY_AND_ASSIGN(FileManagerDialog); | 93 DISALLOW_COPY_AND_ASSIGN(FileManagerDialog); |
88 }; | 94 }; |
89 | 95 |
90 #endif // CHROME_BROWSER_UI_VIEWS_FILE_MANAGER_DIALOG_H_ | 96 #endif // CHROME_BROWSER_UI_VIEWS_FILE_MANAGER_DIALOG_H_ |
OLD | NEW |