Chromium Code Reviews| Index: chrome/browser/ui/views/content_setting_bubble_contents.cc |
| diff --git a/chrome/browser/ui/views/content_setting_bubble_contents.cc b/chrome/browser/ui/views/content_setting_bubble_contents.cc |
| index 47bd73a027e009e6c543d482b58683a681a6687b..7c465c9330786e653e068546c0575ceeb8426e0f 100644 |
| --- a/chrome/browser/ui/views/content_setting_bubble_contents.cc |
| +++ b/chrome/browser/ui/views/content_setting_bubble_contents.cc |
| @@ -211,52 +211,36 @@ void ContentSettingBubbleContents::Init() { |
| bubble_content_empty = false; |
| } |
| - if (!bubble_content.plugin_names.empty()) { |
| - const int kPluginsColumnSetId = 4; |
| - layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); |
| - views::ColumnSet* plugins_column_set = |
| - layout->AddColumnSet(kPluginsColumnSetId); |
| - plugins_column_set->AddColumn(GridLayout::LEADING, GridLayout::FILL, 1, |
| - GridLayout::USE_PREF, 0, 0); |
| - plugins_column_set->AddPaddingColumn( |
| + // Layout for the item list (blocked plugins and popups). |
| + if (!bubble_content.list_items.empty()) { |
| + const int kItemListColumnSetId = 2; |
| + views::ColumnSet* item_list_column_set = |
| + layout->AddColumnSet(kItemListColumnSetId); |
| + item_list_column_set->AddColumn(GridLayout::LEADING, GridLayout::FILL, 0, |
| + GridLayout::USE_PREF, 0, 0); |
| + item_list_column_set->AddPaddingColumn( |
| 0, views::kRelatedControlHorizontalSpacing); |
| - plugins_column_set->AddColumn(GridLayout::LEADING, GridLayout::FILL, 1, |
| - GridLayout::USE_PREF, 0, 0); |
| - |
| - views::Label* plugin_names_label = |
| - new views::Label(bubble_content.plugin_names); |
| - plugin_names_label->SetMultiLine(true); |
| - plugin_names_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
| - layout->StartRow(0, kPluginsColumnSetId); |
| - layout->AddView(plugin_names_label); |
| - bubble_content_empty = false; |
| - } |
| - |
| - if (content_setting_bubble_model_->content_type() == |
| - CONTENT_SETTINGS_TYPE_POPUPS) { |
| - const int kPopupColumnSetId = 2; |
| - views::ColumnSet* popup_column_set = |
| - layout->AddColumnSet(kPopupColumnSetId); |
| - popup_column_set->AddColumn(GridLayout::LEADING, GridLayout::FILL, 0, |
| - GridLayout::USE_PREF, 0, 0); |
| - popup_column_set->AddPaddingColumn( |
| - 0, views::kRelatedControlHorizontalSpacing); |
| - popup_column_set->AddColumn(GridLayout::LEADING, GridLayout::FILL, 1, |
| - GridLayout::USE_PREF, 0, 0); |
| + item_list_column_set->AddColumn(GridLayout::LEADING, GridLayout::FILL, 1, |
| + GridLayout::USE_PREF, 0, 0); |
| - for (std::vector<ContentSettingBubbleModel::PopupItem>::const_iterator |
| - i(bubble_content.popup_items.begin()); |
| - i != bubble_content.popup_items.end(); ++i) { |
| + for (std::vector<ContentSettingBubbleModel::ListItem>::const_iterator i( |
|
msw
2015/03/20 22:06:34
ditto nit: range or auto
meacer
2015/03/20 23:39:42
Done.
|
| + bubble_content.list_items.begin()); |
| + i != bubble_content.list_items.end(); ++i) { |
| if (!bubble_content_empty) |
| layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); |
| - layout->StartRow(0, kPopupColumnSetId); |
| - |
| - views::Link* link = new views::Link(base::UTF8ToUTF16(i->title)); |
| - link->set_listener(this); |
| - link->SetElideBehavior(gfx::ELIDE_MIDDLE); |
| - popup_links_[link] = i - bubble_content.popup_items.begin(); |
| - layout->AddView(new Favicon(i->image, this, link)); |
| - layout->AddView(link); |
| + layout->StartRow(0, kItemListColumnSetId); |
| + if (i->has_link) { |
| + views::Link* link = new views::Link(base::UTF8ToUTF16(i->title)); |
| + link->set_listener(this); |
| + link->SetElideBehavior(gfx::ELIDE_MIDDLE); |
| + list_item_links_[link] = i - bubble_content.list_items.begin(); |
| + layout->AddView(new Favicon(i->image, this, link)); |
| + layout->AddView(link); |
| + } else { |
| + views::Label* label = new views::Label(base::UTF8ToUTF16(i->title)); |
| + layout->AddView(new Favicon(i->image, this, NULL)); |
| + layout->AddView(label); |
| + } |
| bubble_content_empty = false; |
| } |
| } |
| @@ -463,9 +447,9 @@ void ContentSettingBubbleContents::LinkClicked(views::Link* source, |
| return; |
| } |
| - PopupLinks::const_iterator i(popup_links_.find(source)); |
| - DCHECK(i != popup_links_.end()); |
| - content_setting_bubble_model_->OnPopupClicked(i->second); |
| + ListItemLinks::const_iterator i(list_item_links_.find(source)); |
| + DCHECK(i != list_item_links_.end()); |
| + content_setting_bubble_model_->OnListItemClicked(i->second); |
| } |
| void ContentSettingBubbleContents::OnMenuButtonClicked( |