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

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

Issue 10854150: Cocoa: Media gallery dialog unit test (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 4 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
« no previous file with comments | « no previous file | chrome/browser/media_gallery/media_galleries_dialog_controller.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_GALLERY_MEDIA_GALLERIES_DIALOG_CONTROLLER_H_ 5 #ifndef CHROME_BROWSER_MEDIA_GALLERY_MEDIA_GALLERIES_DIALOG_CONTROLLER_H_
6 #define CHROME_BROWSER_MEDIA_GALLERY_MEDIA_GALLERIES_DIALOG_CONTROLLER_H_ 6 #define CHROME_BROWSER_MEDIA_GALLERY_MEDIA_GALLERIES_DIALOG_CONTROLLER_H_
7 7
8 #include <list> 8 #include <list>
9 #include <map> 9 #include <map>
10 10
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 // This type keeps track of media galleries already known to the prefs system. 59 // This type keeps track of media galleries already known to the prefs system.
60 typedef std::map<MediaGalleryPrefId, GalleryPermission> 60 typedef std::map<MediaGalleryPrefId, GalleryPermission>
61 KnownGalleryPermissions; 61 KnownGalleryPermissions;
62 62
63 // The constructor creates a dialog controller which owns itself. 63 // The constructor creates a dialog controller which owns itself.
64 MediaGalleriesDialogController(TabContents* tab_contents, 64 MediaGalleriesDialogController(TabContents* tab_contents,
65 const extensions::Extension& extension, 65 const extensions::Extension& extension,
66 const base::Callback<void(void)>& on_finish); 66 const base::Callback<void(void)>& on_finish);
67 67
68 // Called by the view. 68 // Called by the view.
69 string16 GetHeader() const; 69 virtual string16 GetHeader() const;
70 string16 GetSubtext() const; 70 virtual string16 GetSubtext() const;
71 bool HasPermittedGalleries() const; 71 virtual bool HasPermittedGalleries() const;
72 void OnAddFolderClicked(); 72 virtual void OnAddFolderClicked();
73 virtual void DidToggleGallery(const MediaGalleryPrefInfo* pref_info, 73 virtual void DidToggleGallery(const MediaGalleryPrefInfo* pref_info,
74 bool enabled); 74 bool enabled);
75 virtual void DialogFinished(bool accepted); 75 virtual void DialogFinished(bool accepted);
76 virtual const KnownGalleryPermissions& permissions() const;
76 77
77 // SelectFileDialog::Listener implementation: 78 // SelectFileDialog::Listener implementation:
78 virtual void FileSelected(const FilePath& path, 79 virtual void FileSelected(const FilePath& path,
79 int index, 80 int index,
80 void* params) OVERRIDE; 81 void* params) OVERRIDE;
81 const KnownGalleryPermissions& permissions() const {
82 return known_galleries_;
83 }
84
85 TabContents* tab_contents() const { 82 TabContents* tab_contents() const {
86 return tab_contents_; 83 return tab_contents_;
87 } 84 }
88 85
89 protected: 86 protected:
90 // For use with tests. 87 // For use with tests.
91 MediaGalleriesDialogController(); 88 MediaGalleriesDialogController();
92 89
93 virtual ~MediaGalleriesDialogController(); 90 virtual ~MediaGalleriesDialogController();
94 91
95 // This map excludes those galleries which have been blacklisted; it only
96 // counts active known galleries.
97 KnownGalleryPermissions known_galleries_;
98
99 private: 92 private:
100 // This type is for media galleries that have been added via "add gallery" 93 // This type is for media galleries that have been added via "add gallery"
101 // button, but have not yet been committed to the prefs system and will be 94 // button, but have not yet been committed to the prefs system and will be
102 // forgotten if the user Cancels. Since they don't have IDs assigned yet, it's 95 // forgotten if the user Cancels. Since they don't have IDs assigned yet, it's
103 // just a list and not a map. 96 // just a list and not a map.
104 typedef std::list<GalleryPermission> NewGalleryPermissions; 97 typedef std::list<GalleryPermission> NewGalleryPermissions;
105 98
106 // Populates |known_galleries_|. 99 // Populates |known_galleries_|.
107 void LookUpPermissions(); 100 void LookUpPermissions();
108 101
109 // Saves state of |known_galleries_| and |new_galleries_| to model. 102 // Saves state of |known_galleries_| and |new_galleries_| to model.
110 void SavePermissions(); 103 void SavePermissions();
111 104
112 // The tab contents from which the request originated. 105 // The tab contents from which the request originated.
113 TabContents* tab_contents_; 106 TabContents* tab_contents_;
114 107
115 // This is just a reference, but it's assumed that it won't become invalid 108 // This is just a reference, but it's assumed that it won't become invalid
116 // while the dialog is showing. Will be NULL only during tests. 109 // while the dialog is showing. Will be NULL only during tests.
117 const extensions::Extension* extension_; 110 const extensions::Extension* extension_;
118 111
112 // This map excludes those galleries which have been blacklisted; it only
113 // counts active known galleries.
114 KnownGalleryPermissions known_galleries_;
119 NewGalleryPermissions new_galleries_; 115 NewGalleryPermissions new_galleries_;
120 116
121 // We run this callback when done. 117 // We run this callback when done.
122 base::Callback<void(void)> on_finish_; 118 base::Callback<void(void)> on_finish_;
123 119
124 // The model that tracks galleries and extensions' permissions. 120 // The model that tracks galleries and extensions' permissions.
125 MediaGalleriesPreferences* preferences_; 121 MediaGalleriesPreferences* preferences_;
126 122
127 // The view that's showing. 123 // The view that's showing.
128 scoped_ptr<MediaGalleriesDialog> dialog_; 124 scoped_ptr<MediaGalleriesDialog> dialog_;
129 125
130 scoped_refptr<ui::SelectFileDialog> select_folder_dialog_; 126 scoped_refptr<ui::SelectFileDialog> select_folder_dialog_;
131 127
132 DISALLOW_COPY_AND_ASSIGN(MediaGalleriesDialogController); 128 DISALLOW_COPY_AND_ASSIGN(MediaGalleriesDialogController);
133 }; 129 };
134 130
135 } // namespace chrome 131 } // namespace chrome
136 132
137 #endif // CHROME_BROWSER_MEDIA_GALLERY_MEDIA_GALLERIES_DIALOG_CONTROLLER_H_ 133 #endif // CHROME_BROWSER_MEDIA_GALLERY_MEDIA_GALLERIES_DIALOG_CONTROLLER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/media_gallery/media_galleries_dialog_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698