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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 bool MediaGalleriesDialogViews::AddOrUpdateGallery( | 106 bool MediaGalleriesDialogViews::AddOrUpdateGallery( |
107 const MediaGalleryPrefInfo* gallery, | 107 const MediaGalleryPrefInfo* gallery, |
108 bool permitted) { | 108 bool permitted) { |
109 string16 label = | 109 string16 label = |
110 MediaGalleriesDialogController::GetGalleryDisplayName(*gallery); | 110 MediaGalleriesDialogController::GetGalleryDisplayName(*gallery); |
111 string16 tooltip_text = | |
112 MediaGalleriesDialogController::GetGalleryTooltip(*gallery); | |
Greg Billock
2013/01/31 23:01:21
Good. I did this in my change as well. It'll merge
| |
111 CheckboxMap::iterator iter = checkbox_map_.find(gallery); | 113 CheckboxMap::iterator iter = checkbox_map_.find(gallery); |
112 if (iter != checkbox_map_.end()) { | 114 if (iter != checkbox_map_.end()) { |
113 views::Checkbox* checkbox = iter->second; | 115 views::Checkbox* checkbox = iter->second; |
114 checkbox->SetChecked(permitted); | 116 checkbox->SetChecked(permitted); |
115 checkbox->SetText(label); | 117 checkbox->SetText(label); |
118 checkbox->SetTooltipText(tooltip_text); | |
116 return false; | 119 return false; |
117 } | 120 } |
118 | 121 |
119 views::Checkbox* checkbox = new views::Checkbox(label); | 122 views::Checkbox* checkbox = new views::Checkbox(label); |
120 checkbox->set_listener(this); | 123 checkbox->set_listener(this); |
121 checkbox->SetTooltipText( | 124 checkbox->SetTooltipText(tooltip_text); |
122 MediaGalleriesDialogController::GetGalleryTooltip(*gallery)); | |
123 checkbox_container_->AddChildView(checkbox); | 125 checkbox_container_->AddChildView(checkbox); |
124 checkbox->SetChecked(permitted); | 126 checkbox->SetChecked(permitted); |
125 checkbox_map_[gallery] = checkbox; | 127 checkbox_map_[gallery] = checkbox; |
126 | 128 |
127 return true; | 129 return true; |
128 } | 130 } |
129 | 131 |
130 string16 MediaGalleriesDialogViews::GetWindowTitle() const { | 132 string16 MediaGalleriesDialogViews::GetWindowTitle() const { |
131 return controller_->GetHeader(); | 133 return controller_->GetHeader(); |
132 } | 134 } |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
217 | 219 |
218 // MediaGalleriesDialogViewsController ----------------------------------------- | 220 // MediaGalleriesDialogViewsController ----------------------------------------- |
219 | 221 |
220 // static | 222 // static |
221 MediaGalleriesDialog* MediaGalleriesDialog::Create( | 223 MediaGalleriesDialog* MediaGalleriesDialog::Create( |
222 MediaGalleriesDialogController* controller) { | 224 MediaGalleriesDialogController* controller) { |
223 return new MediaGalleriesDialogViews(controller); | 225 return new MediaGalleriesDialogViews(controller); |
224 } | 226 } |
225 | 227 |
226 } // namespace chrome | 228 } // namespace chrome |
OLD | NEW |