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

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

Issue 1695563002: Media Galleries Partial Deprecation: Remove scan functionality. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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
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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 contents_->Layout(); 184 contents_->Layout();
185 185
186 if (ControllerHasWebContents()) 186 if (ControllerHasWebContents())
187 GetWidget()->client_view()->AsDialogClientView()->UpdateDialogButtons(); 187 GetWidget()->client_view()->AsDialogClientView()->UpdateDialogButtons();
188 } 188 }
189 189
190 bool MediaGalleriesDialogViews::AddOrUpdateGallery( 190 bool MediaGalleriesDialogViews::AddOrUpdateGallery(
191 const MediaGalleriesDialogController::Entry& gallery, 191 const MediaGalleriesDialogController::Entry& gallery,
192 views::View* container, 192 views::View* container,
193 int trailing_vertical_space) { 193 int trailing_vertical_space) {
194 bool show_folder_viewer = controller_->ShouldShowFolderViewer(gallery);
195
196 CheckboxMap::iterator iter = checkbox_map_.find(gallery.pref_info.pref_id); 194 CheckboxMap::iterator iter = checkbox_map_.find(gallery.pref_info.pref_id);
197 if (iter != checkbox_map_.end()) { 195 if (iter != checkbox_map_.end()) {
198 views::Checkbox* checkbox = iter->second->checkbox(); 196 views::Checkbox* checkbox = iter->second->checkbox();
199 checkbox->SetChecked(gallery.selected); 197 checkbox->SetChecked(gallery.selected);
200 checkbox->SetText(gallery.pref_info.GetGalleryDisplayName()); 198 checkbox->SetText(gallery.pref_info.GetGalleryDisplayName());
201 checkbox->SetTooltipText(gallery.pref_info.GetGalleryTooltip()); 199 checkbox->SetTooltipText(gallery.pref_info.GetGalleryTooltip());
202 base::string16 details = gallery.pref_info.GetGalleryAdditionalDetails(); 200 base::string16 details = gallery.pref_info.GetGalleryAdditionalDetails();
203 iter->second->secondary_text()->SetText(details); 201 iter->second->secondary_text()->SetText(details);
204 iter->second->secondary_text()->SetVisible(details.length() > 0); 202 iter->second->secondary_text()->SetVisible(details.length() > 0);
205 iter->second->folder_viewer_button()->SetVisible(show_folder_viewer);
206 return false; 203 return false;
207 } 204 }
208 205
209 MediaGalleryCheckboxView* gallery_view = 206 MediaGalleryCheckboxView* gallery_view = new MediaGalleryCheckboxView(
210 new MediaGalleryCheckboxView(gallery.pref_info, show_folder_viewer, 207 gallery.pref_info, trailing_vertical_space, this, this);
211 trailing_vertical_space, this, this);
212 gallery_view->checkbox()->SetChecked(gallery.selected); 208 gallery_view->checkbox()->SetChecked(gallery.selected);
213 container->AddChildView(gallery_view); 209 container->AddChildView(gallery_view);
214 checkbox_map_[gallery.pref_info.pref_id] = gallery_view; 210 checkbox_map_[gallery.pref_info.pref_id] = gallery_view;
215 211
216 return true; 212 return true;
217 } 213 }
218 214
219 base::string16 MediaGalleriesDialogViews::GetWindowTitle() const { 215 base::string16 MediaGalleriesDialogViews::GetWindowTitle() const {
220 return controller_->GetHeader(); 216 return controller_->GetHeader();
221 } 217 }
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 return; 279 return;
284 } 280 }
285 281
286 for (CheckboxMap::const_iterator iter = checkbox_map_.begin(); 282 for (CheckboxMap::const_iterator iter = checkbox_map_.begin();
287 iter != checkbox_map_.end(); ++iter) { 283 iter != checkbox_map_.end(); ++iter) {
288 if (sender == iter->second->checkbox()) { 284 if (sender == iter->second->checkbox()) {
289 controller_->DidToggleEntry(iter->first, 285 controller_->DidToggleEntry(iter->first,
290 iter->second->checkbox()->checked()); 286 iter->second->checkbox()->checked());
291 return; 287 return;
292 } 288 }
293 if (sender == iter->second->folder_viewer_button()) {
294 controller_->DidClickOpenFolderViewer(iter->first);
295 return;
296 }
297 } 289 }
298 } 290 }
299 291
300 void MediaGalleriesDialogViews::ShowContextMenuForView( 292 void MediaGalleriesDialogViews::ShowContextMenuForView(
301 views::View* source, 293 views::View* source,
302 const gfx::Point& point, 294 const gfx::Point& point,
303 ui::MenuSourceType source_type) { 295 ui::MenuSourceType source_type) {
304 for (CheckboxMap::const_iterator iter = checkbox_map_.begin(); 296 for (CheckboxMap::const_iterator iter = checkbox_map_.begin();
305 iter != checkbox_map_.end(); ++iter) { 297 iter != checkbox_map_.end(); ++iter) {
306 if (iter->second->Contains(source)) { 298 if (iter->second->Contains(source)) {
(...skipping 24 matching lines...) Expand all
331 return controller_->WebContents() != NULL; 323 return controller_->WebContents() != NULL;
332 } 324 }
333 325
334 // MediaGalleriesDialogViewsController ----------------------------------------- 326 // MediaGalleriesDialogViewsController -----------------------------------------
335 327
336 // static 328 // static
337 MediaGalleriesDialog* MediaGalleriesDialog::Create( 329 MediaGalleriesDialog* MediaGalleriesDialog::Create(
338 MediaGalleriesDialogController* controller) { 330 MediaGalleriesDialogController* controller) {
339 return new MediaGalleriesDialogViews(controller); 331 return new MediaGalleriesDialogViews(controller);
340 } 332 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698