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

Unified Diff: chrome/browser/ui/views/content_setting_bubble_contents.cc

Issue 1025503002: Use same base class for popup and plugin blocking UI (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: bauerb comments Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/views/content_setting_bubble_contents.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..04fb1046f2c265a8b21ccc72572a5d49b1190c62 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) {
+ int row = 0;
+ for (const auto& list_item : bubble_content.list_items) {
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 (list_item.has_link) {
+ views::Link* link = new views::Link(base::UTF8ToUTF16(list_item.title));
+ link->set_listener(this);
+ link->SetElideBehavior(gfx::ELIDE_MIDDLE);
+ list_item_links_[link] = row++;
msw 2015/03/23 23:54:13 Should |row| be incremented in the label case to m
meacer 2015/03/24 00:14:39 Good catch! It doesn't make a difference for this
+ layout->AddView(new Favicon(list_item.image, this, link));
+ layout->AddView(link);
+ } else {
+ views::Label* label =
+ new views::Label(base::UTF8ToUTF16(list_item.title));
+ layout->AddView(new Favicon(list_item.image, this, NULL));
+ layout->AddView(label);
+ }
bubble_content_empty = false;
}
}
@@ -295,7 +279,7 @@ void ContentSettingBubbleContents::Init() {
// Layout code for the media device menus.
if (content_setting_bubble_model_->content_type() ==
CONTENT_SETTINGS_TYPE_MEDIASTREAM) {
- const int kMediaMenuColumnSetId = 2;
+ const int kMediaMenuColumnSetId = 4;
views::ColumnSet* menu_column_set =
layout->AddColumnSet(kMediaMenuColumnSetId);
menu_column_set->AddPaddingColumn(0, views::kCheckboxIndent);
@@ -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(
« no previous file with comments | « chrome/browser/ui/views/content_setting_bubble_contents.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698