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

Side by Side Diff: chrome/browser/media_galleries/media_galleries_dialog_controller.h

Issue 37553002: [MediaGalleries] Add context menu for forgetting galleries. [views] (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@dlgfix
Patch Set: DidForgetGallery Created 7 years, 1 month 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
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_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 28 matching lines...) Expand all
65 70
66 // The title of the dialog view. 71 // The title of the dialog view.
67 string16 GetHeader() const; 72 string16 GetHeader() const;
68 73
69 // Explanatory text directly below the title. 74 // Explanatory text directly below the title.
70 string16 GetSubtext() const; 75 string16 GetSubtext() const;
71 76
72 // Header for unattached devices part of the dialog. 77 // Header for unattached devices part of the dialog.
73 string16 GetUnattachedLocationsHeader() const; 78 string16 GetUnattachedLocationsHeader() const;
74 79
80 // Get the text of the forget context menu command.
81 string16 GetDeleteMenuCommand() const;
82
75 // Initial state of whether the dialog's confirmation button will be enabled. 83 // Initial state of whether the dialog's confirmation button will be enabled.
76 bool HasPermittedGalleries() const; 84 bool HasPermittedGalleries() const;
77 85
78 // Get the set of permissions to attached galleries. 86 // Get the set of permissions to attached galleries.
79 virtual GalleryPermissionsVector AttachedPermissions() const; 87 virtual GalleryPermissionsVector AttachedPermissions() const;
80 88
81 // Get the set of permissions to unattached galleries. 89 // Get the set of permissions to unattached galleries.
82 virtual GalleryPermissionsVector UnattachedPermissions() const; 90 virtual GalleryPermissionsVector UnattachedPermissions() const;
83 91
84 // Called when the add-folder button in the dialog is clicked. 92 // Called when the add-folder button in the dialog is clicked.
85 virtual void OnAddFolderClicked(); 93 virtual void OnAddFolderClicked();
86 94
87 // A checkbox beside a gallery permission was checked. The full set 95 // A checkbox beside a gallery permission was checked. The full set
88 // of gallery permissions checkbox settings is sent on every checkbox toggle. 96 // of gallery permissions checkbox settings is sent on every checkbox toggle.
89 virtual void DidToggleGalleryId(MediaGalleryPrefId pref_id, 97 virtual void DidToggleGalleryId(MediaGalleryPrefId pref_id,
90 bool enabled); 98 bool enabled);
91 virtual void DidToggleNewGallery(const MediaGalleryPrefInfo& gallery, 99 virtual void DidToggleNewGallery(const MediaGalleryPrefInfo& gallery,
92 bool enabled); 100 bool enabled);
93 101
102 // The forget command in the context menu was selected.
103 virtual void DidForgetGallery(MediaGalleryPrefId pref_id);
104
94 // The dialog is being deleted. 105 // The dialog is being deleted.
95 virtual void DialogFinished(bool accepted); 106 virtual void DialogFinished(bool accepted);
96 107
97 virtual content::WebContents* web_contents(); 108 virtual content::WebContents* web_contents();
98 109
110 ui::MenuModel* GetContextMenuModel(MediaGalleryPrefId id);
111
99 protected: 112 protected:
100 // For use with tests. 113 // For use with tests.
101 explicit MediaGalleriesDialogController( 114 explicit MediaGalleriesDialogController(
102 const extensions::Extension& extension); 115 const extensions::Extension& extension);
103 116
104 virtual ~MediaGalleriesDialogController(); 117 virtual ~MediaGalleriesDialogController();
105 118
106 private: 119 private:
107 // This type keeps track of media galleries already known to the prefs system. 120 // This type keeps track of media galleries already known to the prefs system.
108 typedef std::map<MediaGalleryPrefId, GalleryPermission> 121 typedef std::map<MediaGalleryPrefId, GalleryPermission>
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 193
181 // The model that tracks galleries and extensions' permissions. 194 // The model that tracks galleries and extensions' permissions.
182 // This is the authoritative source for gallery information. 195 // This is the authoritative source for gallery information.
183 MediaGalleriesPreferences* preferences_; 196 MediaGalleriesPreferences* preferences_;
184 197
185 // The view that's showing. 198 // The view that's showing.
186 scoped_ptr<MediaGalleriesDialog> dialog_; 199 scoped_ptr<MediaGalleriesDialog> dialog_;
187 200
188 scoped_refptr<ui::SelectFileDialog> select_folder_dialog_; 201 scoped_refptr<ui::SelectFileDialog> select_folder_dialog_;
189 202
203 scoped_ptr<ui::MenuModel> context_menu_model_;
204 scoped_ptr<GalleryContextMenuModel> gallery_menu_model_;
205
190 DISALLOW_COPY_AND_ASSIGN(MediaGalleriesDialogController); 206 DISALLOW_COPY_AND_ASSIGN(MediaGalleriesDialogController);
191 }; 207 };
192 208
193 #endif // CHROME_BROWSER_MEDIA_GALLERIES_MEDIA_GALLERIES_DIALOG_CONTROLLER_H_ 209 #endif // CHROME_BROWSER_MEDIA_GALLERIES_MEDIA_GALLERIES_DIALOG_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698