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_MEDIA_GALLERIES_MEDIA_GALLERIES_DIALOG_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_MEDIA_GALLERIES_MEDIA_GALLERIES_DIALOG_CONTROLLER_H_ |
6 #define CHROME_BROWSER_MEDIA_GALLERIES_MEDIA_GALLERIES_DIALOG_CONTROLLER_H_ | 6 #define CHROME_BROWSER_MEDIA_GALLERIES_MEDIA_GALLERIES_DIALOG_CONTROLLER_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <map> | 9 #include <map> |
10 | 10 |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "base/strings/string16.h" | 13 #include "base/strings/string16.h" |
14 #include "chrome/browser/media_galleries/media_galleries_preferences.h" | 14 #include "chrome/browser/media_galleries/media_galleries_preferences.h" |
15 #include "chrome/browser/storage_monitor/removable_storage_observer.h" | 15 #include "chrome/browser/storage_monitor/removable_storage_observer.h" |
16 #include "ui/gfx/native_widget_types.h" | 16 #include "ui/gfx/native_widget_types.h" |
17 #include "ui/shell_dialogs/select_file_dialog.h" | 17 #include "ui/shell_dialogs/select_file_dialog.h" |
18 | 18 |
19 namespace content { | 19 namespace content { |
20 class WebContents; | 20 class WebContents; |
21 } | 21 } |
22 | 22 |
23 namespace extensions { | 23 namespace extensions { |
24 class Extension; | 24 class Extension; |
25 } | 25 } |
26 | 26 |
| 27 namespace ui { |
| 28 class MenuModel; |
| 29 } |
| 30 |
| 31 class GalleryContextMenuModel; |
27 class MediaGalleriesDialogController; | 32 class MediaGalleriesDialogController; |
28 | 33 |
29 // The view. | 34 // The view. |
30 class MediaGalleriesDialog { | 35 class MediaGalleriesDialog { |
31 public: | 36 public: |
32 virtual ~MediaGalleriesDialog(); | 37 virtual ~MediaGalleriesDialog(); |
33 | 38 |
34 // Tell the dialog to update its display list of galleries. | 39 // Tell the dialog to update its display list of galleries. |
35 virtual void UpdateGalleries() = 0; | 40 virtual void UpdateGalleries() = 0; |
36 | 41 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 // Called when the add-folder button in the dialog is clicked. | 89 // Called when the add-folder button in the dialog is clicked. |
85 virtual void OnAddFolderClicked(); | 90 virtual void OnAddFolderClicked(); |
86 | 91 |
87 // A checkbox beside a gallery permission was checked. The full set | 92 // A checkbox beside a gallery permission was checked. The full set |
88 // of gallery permissions checkbox settings is sent on every checkbox toggle. | 93 // of gallery permissions checkbox settings is sent on every checkbox toggle. |
89 virtual void DidToggleGalleryId(MediaGalleryPrefId pref_id, | 94 virtual void DidToggleGalleryId(MediaGalleryPrefId pref_id, |
90 bool enabled); | 95 bool enabled); |
91 virtual void DidToggleNewGallery(const MediaGalleryPrefInfo& gallery, | 96 virtual void DidToggleNewGallery(const MediaGalleryPrefInfo& gallery, |
92 bool enabled); | 97 bool enabled); |
93 | 98 |
| 99 // The forget command in the context menu was selected. |
| 100 virtual void DidForgetGallery(MediaGalleryPrefId pref_id); |
| 101 |
94 // The dialog is being deleted. | 102 // The dialog is being deleted. |
95 virtual void DialogFinished(bool accepted); | 103 virtual void DialogFinished(bool accepted); |
96 | 104 |
97 virtual content::WebContents* web_contents(); | 105 virtual content::WebContents* web_contents(); |
98 | 106 |
| 107 ui::MenuModel* GetContextMenuModel(MediaGalleryPrefId id); |
| 108 |
99 protected: | 109 protected: |
100 // For use with tests. | 110 // For use with tests. |
101 explicit MediaGalleriesDialogController( | 111 explicit MediaGalleriesDialogController( |
102 const extensions::Extension& extension); | 112 const extensions::Extension& extension); |
103 | 113 |
104 virtual ~MediaGalleriesDialogController(); | 114 virtual ~MediaGalleriesDialogController(); |
105 | 115 |
106 private: | 116 private: |
107 // This type keeps track of media galleries already known to the prefs system. | 117 // This type keeps track of media galleries already known to the prefs system. |
108 typedef std::map<MediaGalleryPrefId, GalleryPermission> | 118 typedef std::map<MediaGalleryPrefId, GalleryPermission> |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 | 190 |
181 // The model that tracks galleries and extensions' permissions. | 191 // The model that tracks galleries and extensions' permissions. |
182 // This is the authoritative source for gallery information. | 192 // This is the authoritative source for gallery information. |
183 MediaGalleriesPreferences* preferences_; | 193 MediaGalleriesPreferences* preferences_; |
184 | 194 |
185 // The view that's showing. | 195 // The view that's showing. |
186 scoped_ptr<MediaGalleriesDialog> dialog_; | 196 scoped_ptr<MediaGalleriesDialog> dialog_; |
187 | 197 |
188 scoped_refptr<ui::SelectFileDialog> select_folder_dialog_; | 198 scoped_refptr<ui::SelectFileDialog> select_folder_dialog_; |
189 | 199 |
| 200 scoped_ptr<ui::MenuModel> context_menu_model_; |
| 201 scoped_ptr<GalleryContextMenuModel> gallery_menu_model_; |
| 202 |
190 DISALLOW_COPY_AND_ASSIGN(MediaGalleriesDialogController); | 203 DISALLOW_COPY_AND_ASSIGN(MediaGalleriesDialogController); |
191 }; | 204 }; |
192 | 205 |
193 #endif // CHROME_BROWSER_MEDIA_GALLERIES_MEDIA_GALLERIES_DIALOG_CONTROLLER_H_ | 206 #endif // CHROME_BROWSER_MEDIA_GALLERIES_MEDIA_GALLERIES_DIALOG_CONTROLLER_H_ |
OLD | NEW |