| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |