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

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: msw 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
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..866dd2dbb261080648647ed8b702ff16e6fca2e3 100644
--- a/chrome/browser/ui/views/content_setting_bubble_contents.cc
+++ b/chrome/browser/ui/views/content_setting_bubble_contents.cc
@@ -211,52 +211,35 @@ 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;
msw 2015/03/21 00:25:19 nit: maybe keep this 4 to avoid conflict with kMed
meacer 2015/03/23 18:19:40 Made kMediaMenuColumnSetId 4 so that they are in i
+ 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 (auto i(bubble_content.list_items.begin());
Bernhard Bauer 2015/03/23 22:30:46 Can you use a C++11-style loop here as well?
meacer 2015/03/23 23:44:46 Done.
+ 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 +446,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(

Powered by Google App Engine
This is Rietveld 408576698