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/content_setting_bubble_contents.h" | 5 #include "chrome/browser/ui/views/content_setting_bubble_contents.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 GridLayout::USE_PREF, 0, 0); | 196 GridLayout::USE_PREF, 0, 0); |
197 column_set->AddPaddingColumn(0, views::kRelatedControlHorizontalSpacing); | 197 column_set->AddPaddingColumn(0, views::kRelatedControlHorizontalSpacing); |
198 column_set->AddColumn(GridLayout::LEADING, GridLayout::FILL, 1, | 198 column_set->AddColumn(GridLayout::LEADING, GridLayout::FILL, 1, |
199 GridLayout::USE_PREF, 0, 0); | 199 GridLayout::USE_PREF, 0, 0); |
200 | 200 |
201 const ContentSettingBubbleModel::BubbleContent& bubble_content = | 201 const ContentSettingBubbleModel::BubbleContent& bubble_content = |
202 content_setting_bubble_model_->bubble_content(); | 202 content_setting_bubble_model_->bubble_content(); |
203 bool bubble_content_empty = true; | 203 bool bubble_content_empty = true; |
204 | 204 |
205 if (!bubble_content.title.empty()) { | 205 if (!bubble_content.title.empty()) { |
206 views::Label* title_label = new views::Label(base::UTF8ToUTF16( | 206 views::Label* title_label = new views::Label(bubble_content.title); |
207 bubble_content.title)); | |
208 title_label->SetMultiLine(true); | 207 title_label->SetMultiLine(true); |
209 title_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 208 title_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
210 layout->StartRow(0, kSingleColumnSetId); | 209 layout->StartRow(0, kSingleColumnSetId); |
211 layout->AddView(title_label); | 210 layout->AddView(title_label); |
212 bubble_content_empty = false; | 211 bubble_content_empty = false; |
213 } | 212 } |
214 | 213 |
| 214 if (!bubble_content.message.empty()) { |
| 215 views::Label* message_label = new views::Label(bubble_content.message); |
| 216 layout->AddPaddingRow(0, views::kUnrelatedControlVerticalSpacing); |
| 217 message_label->SetMultiLine(true); |
| 218 message_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
| 219 layout->StartRow(0, kSingleColumnSetId); |
| 220 layout->AddView(message_label); |
| 221 bubble_content_empty = false; |
| 222 } |
| 223 |
215 if (!bubble_content.learn_more_link.empty()) { | 224 if (!bubble_content.learn_more_link.empty()) { |
216 learn_more_link_ = | 225 learn_more_link_ = |
217 new views::Link(base::UTF8ToUTF16(bubble_content.learn_more_link)); | 226 new views::Link(base::UTF8ToUTF16(bubble_content.learn_more_link)); |
218 learn_more_link_->set_listener(this); | 227 learn_more_link_->set_listener(this); |
219 learn_more_link_->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 228 learn_more_link_->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
220 layout->AddView(learn_more_link_); | 229 layout->AddView(learn_more_link_); |
221 bubble_content_empty = false; | 230 bubble_content_empty = false; |
222 } | 231 } |
223 | 232 |
224 // Layout for the item list (blocked plugins and popups). | 233 // Layout for the item list (blocked plugins and popups). |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
436 DCHECK(i != list_item_links_.end()); | 445 DCHECK(i != list_item_links_.end()); |
437 content_setting_bubble_model_->OnListItemClicked(i->second); | 446 content_setting_bubble_model_->OnListItemClicked(i->second); |
438 } | 447 } |
439 | 448 |
440 void ContentSettingBubbleContents::OnPerformAction(views::Combobox* combobox) { | 449 void ContentSettingBubbleContents::OnPerformAction(views::Combobox* combobox) { |
441 MediaComboboxModel* model = | 450 MediaComboboxModel* model = |
442 static_cast<MediaComboboxModel*>(combobox->model()); | 451 static_cast<MediaComboboxModel*>(combobox->model()); |
443 content_setting_bubble_model_->OnMediaMenuClicked( | 452 content_setting_bubble_model_->OnMediaMenuClicked( |
444 model->type(), model->GetDevices()[combobox->selected_index()].id); | 453 model->type(), model->GetDevices()[combobox->selected_index()].id); |
445 } | 454 } |
OLD | NEW |