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

Side by Side Diff: chrome/browser/ui/views/extensions/media_galleries_dialog_views.cc

Issue 12095074: Media Galleries: Keep media gallery permission dialogs in sync with the gallery (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix nit Created 7 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
« no previous file with comments | « chrome/browser/ui/views/extensions/media_galleries_dialog_views.h ('k') | no next file » | 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 #include "chrome/browser/ui/views/extensions/media_galleries_dialog_views.h" 5 #include "chrome/browser/ui/views/extensions/media_galleries_dialog_views.h"
6 6
7 #include "chrome/browser/ui/views/constrained_window_views.h" 7 #include "chrome/browser/ui/views/constrained_window_views.h"
8 #include "grit/generated_resources.h" 8 #include "grit/generated_resources.h"
9 #include "grit/locale_settings.h" 9 #include "grit/locale_settings.h"
10 #include "ui/base/l10n/l10n_util.h" 10 #include "ui/base/l10n/l10n_util.h"
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 } 96 }
97 97
98 void MediaGalleriesDialogViews::UpdateGallery( 98 void MediaGalleriesDialogViews::UpdateGallery(
99 const MediaGalleryPrefInfo* gallery, 99 const MediaGalleryPrefInfo* gallery,
100 bool permitted) { 100 bool permitted) {
101 // After adding a new checkbox, we have to update the size of the dialog. 101 // After adding a new checkbox, we have to update the size of the dialog.
102 if (AddOrUpdateGallery(gallery, permitted)) 102 if (AddOrUpdateGallery(gallery, permitted))
103 GetWidget()->SetSize(GetWidget()->non_client_view()->GetPreferredSize()); 103 GetWidget()->SetSize(GetWidget()->non_client_view()->GetPreferredSize());
104 } 104 }
105 105
106 void MediaGalleriesDialogViews::ForgetGallery(
107 const MediaGalleryPrefInfo* gallery) {
108 CheckboxMap::iterator iter = checkbox_map_.find(gallery);
109 if (iter == checkbox_map_.end())
110 return;
111
112 views::Checkbox* checkbox = iter->second;
113 checkbox_container_->RemoveChildView(checkbox);
114 delete checkbox;
115 checkbox_map_.erase(iter);
116 GetWidget()->SetSize(GetWidget()->non_client_view()->GetPreferredSize());
117 }
118
106 bool MediaGalleriesDialogViews::AddOrUpdateGallery( 119 bool MediaGalleriesDialogViews::AddOrUpdateGallery(
107 const MediaGalleryPrefInfo* gallery, 120 const MediaGalleryPrefInfo* gallery,
108 bool permitted) { 121 bool permitted) {
109 string16 label = 122 string16 label =
110 MediaGalleriesDialogController::GetGalleryDisplayName(*gallery); 123 MediaGalleriesDialogController::GetGalleryDisplayName(*gallery);
111 string16 tooltip_text = 124 string16 tooltip_text =
112 MediaGalleriesDialogController::GetGalleryTooltip(*gallery); 125 MediaGalleriesDialogController::GetGalleryTooltip(*gallery);
113 CheckboxMap::iterator iter = checkbox_map_.find(gallery); 126 CheckboxMap::iterator iter = checkbox_map_.find(gallery);
114 if (iter != checkbox_map_.end()) { 127 if (iter != checkbox_map_.end()) {
115 views::Checkbox* checkbox = iter->second; 128 views::Checkbox* checkbox = iter->second;
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 232
220 // MediaGalleriesDialogViewsController ----------------------------------------- 233 // MediaGalleriesDialogViewsController -----------------------------------------
221 234
222 // static 235 // static
223 MediaGalleriesDialog* MediaGalleriesDialog::Create( 236 MediaGalleriesDialog* MediaGalleriesDialog::Create(
224 MediaGalleriesDialogController* controller) { 237 MediaGalleriesDialogController* controller) {
225 return new MediaGalleriesDialogViews(controller); 238 return new MediaGalleriesDialogViews(controller);
226 } 239 }
227 240
228 } // namespace chrome 241 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/extensions/media_galleries_dialog_views.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698