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

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

Issue 148093011: Abstract media galleries context menu code and use it in scan result dialog. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nit Created 6 years, 10 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_SCAN_RESULT_DIALOG_CONTRO LLER_H_ 5 #ifndef CHROME_BROWSER_MEDIA_GALLERIES_MEDIA_GALLERIES_SCAN_RESULT_DIALOG_CONTRO LLER_H_
6 #define CHROME_BROWSER_MEDIA_GALLERIES_MEDIA_GALLERIES_SCAN_RESULT_DIALOG_CONTRO LLER_H_ 6 #define CHROME_BROWSER_MEDIA_GALLERIES_MEDIA_GALLERIES_SCAN_RESULT_DIALOG_CONTRO LLER_H_
7 7
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
11 11
12 #include "base/callback.h" 12 #include "base/callback.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "base/strings/string16.h" 14 #include "base/strings/string16.h"
15 #include "chrome/browser/media_galleries/media_galleries_preferences.h" 15 #include "chrome/browser/media_galleries/media_galleries_preferences.h"
16 #include "chrome/browser/storage_monitor/removable_storage_observer.h" 16 #include "chrome/browser/storage_monitor/removable_storage_observer.h"
17 17
18 namespace content { 18 namespace content {
19 class WebContents; 19 class WebContents;
20 } 20 }
21 21
22 namespace extensions { 22 namespace extensions {
23 class Extension; 23 class Extension;
24 } 24 }
25 25
26 namespace ui {
27 class MenuModel;
28 }
29
26 class MediaGalleriesScanResultDialogController; 30 class MediaGalleriesScanResultDialogController;
31 class MediaGalleryContextMenu;
27 class Profile; 32 class Profile;
28 33
29 // The view. 34 // The view.
30 class MediaGalleriesScanResultDialog { 35 class MediaGalleriesScanResultDialog {
31 public: 36 public:
32 virtual ~MediaGalleriesScanResultDialog(); 37 virtual ~MediaGalleriesScanResultDialog();
33 38
34 // Tell the dialog to update its display list of scan results. 39 // Tell the dialog to update its display list of scan results.
35 virtual void UpdateResults() = 0; 40 virtual void UpdateResults() = 0;
36 41
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 virtual void DidClickOpenFolderViewer(MediaGalleryPrefId pref_id) const; 85 virtual void DidClickOpenFolderViewer(MediaGalleryPrefId pref_id) const;
81 86
82 // The forget command in the context menu was selected. 87 // The forget command in the context menu was selected.
83 virtual void DidForgetGallery(MediaGalleryPrefId pref_id); 88 virtual void DidForgetGallery(MediaGalleryPrefId pref_id);
84 89
85 // The dialog is being deleted. 90 // The dialog is being deleted.
86 virtual void DialogFinished(bool accepted); 91 virtual void DialogFinished(bool accepted);
87 92
88 virtual content::WebContents* web_contents(); 93 virtual content::WebContents* web_contents();
89 94
95 ui::MenuModel* GetContextMenu(MediaGalleryPrefId id);
96
90 private: 97 private:
91 friend class MediaGalleriesScanResultDialogControllerTest; 98 friend class MediaGalleriesScanResultDialogControllerTest;
92 99
93 typedef std::map<MediaGalleryPrefId, ScanResult> ScanResults; 100 typedef std::map<MediaGalleryPrefId, ScanResult> ScanResults;
94 typedef base::Callback<MediaGalleriesScanResultDialog* ( 101 typedef base::Callback<MediaGalleriesScanResultDialog* (
95 MediaGalleriesScanResultDialogController*)> CreateDialogCallback; 102 MediaGalleriesScanResultDialogController*)> CreateDialogCallback;
96 103
97 // Used for unit tests. 104 // Used for unit tests.
98 MediaGalleriesScanResultDialogController( 105 MediaGalleriesScanResultDialogController(
99 const extensions::Extension& extension, 106 const extensions::Extension& extension,
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 // The model that tracks galleries and extensions' permissions. 166 // The model that tracks galleries and extensions' permissions.
160 // This is the authoritative source for gallery information. 167 // This is the authoritative source for gallery information.
161 MediaGalleriesPreferences* preferences_; 168 MediaGalleriesPreferences* preferences_;
162 169
163 // Creates the dialog. Only changed for unit tests. 170 // Creates the dialog. Only changed for unit tests.
164 CreateDialogCallback create_dialog_callback_; 171 CreateDialogCallback create_dialog_callback_;
165 172
166 // The view that's showing. 173 // The view that's showing.
167 scoped_ptr<MediaGalleriesScanResultDialog> dialog_; 174 scoped_ptr<MediaGalleriesScanResultDialog> dialog_;
168 175
176 scoped_ptr<MediaGalleryContextMenu> context_menu_;
177
169 DISALLOW_COPY_AND_ASSIGN(MediaGalleriesScanResultDialogController); 178 DISALLOW_COPY_AND_ASSIGN(MediaGalleriesScanResultDialogController);
170 }; 179 };
171 180
172 #endif // CHROME_BROWSER_MEDIA_GALLERIES_MEDIA_GALLERIES_SCAN_RESULT_DIALOG_CON TROLLER_H_ 181 #endif // CHROME_BROWSER_MEDIA_GALLERIES_MEDIA_GALLERIES_SCAN_RESULT_DIALOG_CON TROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698