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 ebd5a40a1b990053abe2adfe564cbe2fc1b14d20..dd7fde5d18da035a4719e857b6f020aa41e181d2 100644 |
| --- a/chrome/browser/ui/views/content_setting_bubble_contents.cc |
| +++ b/chrome/browser/ui/views/content_setting_bubble_contents.cc |
| @@ -29,6 +29,8 @@ |
| #include "ui/base/resource/resource_bundle.h" |
| #include "ui/gfx/font_list.h" |
| #include "ui/gfx/text_utils.h" |
| +#include "ui/views/controls/button/label_button.h" |
|
msw
2016/09/14 17:01:34
nit: This include is redundant
melandory
2016/09/14 19:30:12
Done.
|
| +#include "ui/views/controls/button/md_text_button.h" |
| #include "ui/views/controls/button/menu_button.h" |
| #include "ui/views/controls/button/radio_button.h" |
| #include "ui/views/controls/combobox/combobox.h" |
| @@ -161,6 +163,7 @@ ContentSettingBubbleContents::ContentSettingBubbleContents( |
| content_setting_bubble_model_(content_setting_bubble_model), |
| custom_link_(NULL), |
| manage_link_(NULL), |
| + manage_button_(NULL), |
|
msw
2016/09/14 17:01:34
nit: nullptr here and elsewhere
melandory
2016/09/14 19:30:12
Done.
|
| learn_more_link_(NULL) { |
| // Compensate for built-in vertical padding in the anchor view's image. |
| set_anchor_view_insets(gfx::Insets( |
| @@ -381,10 +384,17 @@ void ContentSettingBubbleContents::Init() { |
| } |
| views::View* ContentSettingBubbleContents::CreateExtraView() { |
| - manage_link_ = new views::Link(base::UTF8ToUTF16( |
| - content_setting_bubble_model_->bubble_content().manage_link)); |
| - manage_link_->set_listener(this); |
| - return manage_link_; |
| + if (content_setting_bubble_model_->bubble_content().manage_link_as_button) { |
|
msw
2016/09/14 17:01:34
Why make this an option? Why not just always use a
melandory
2016/09/14 19:30:12
It was set as a requirement for our particular bub
msw
2016/09/14 19:50:24
Acknowledged.
|
| + manage_button_ = views::MdTextButton::CreateSecondaryUiButton( |
| + this, base::UTF8ToUTF16( |
| + content_setting_bubble_model_->bubble_content().manage_link)); |
|
msw
2016/09/14 17:01:34
nit: rename |BubbleContent::manage_link| to |manag
melandory
2016/09/14 19:30:12
Done.
|
| + return manage_button_; |
| + } else { |
| + manage_link_ = new views::Link(base::UTF8ToUTF16( |
| + content_setting_bubble_model_->bubble_content().manage_link)); |
| + manage_link_->set_listener(this); |
| + return manage_link_; |
| + } |
| } |
| bool ContentSettingBubbleContents::Accept() { |
| @@ -415,10 +425,15 @@ void ContentSettingBubbleContents::DidNavigateMainFrame( |
| void ContentSettingBubbleContents::ButtonPressed(views::Button* sender, |
| const ui::Event& event) { |
| - RadioGroup::const_iterator i( |
| - std::find(radio_group_.begin(), radio_group_.end(), sender)); |
| - DCHECK(i != radio_group_.end()); |
| - content_setting_bubble_model_->OnRadioClicked(i - radio_group_.begin()); |
| + if (manage_button_ == sender) { |
| + GetWidget()->Close(); |
| + content_setting_bubble_model_->OnManageLinkClicked(); |
| + } else { |
| + RadioGroup::const_iterator i( |
| + std::find(radio_group_.begin(), radio_group_.end(), sender)); |
| + DCHECK(i != radio_group_.end()); |
| + content_setting_bubble_model_->OnRadioClicked(i - radio_group_.begin()); |
| + } |
| } |
| void ContentSettingBubbleContents::LinkClicked(views::Link* source, |