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

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

Issue 2339783003: Make 'Load full site' a button instead of link. (Closed)
Patch Set: . Created 4 years, 3 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 ebd5a40a1b990053abe2adfe564cbe2fc1b14d20..198251d336ccbce2711934eb5376e1807004f9ad 100644
--- a/chrome/browser/ui/views/content_setting_bubble_contents.cc
+++ b/chrome/browser/ui/views/content_setting_bubble_contents.cc
@@ -29,6 +29,7 @@
#include "ui/base/resource/resource_bundle.h"
#include "ui/gfx/font_list.h"
#include "ui/gfx/text_utils.h"
+#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"
@@ -159,9 +160,10 @@ ContentSettingBubbleContents::ContentSettingBubbleContents(
: content::WebContentsObserver(web_contents),
BubbleDialogDelegateView(anchor_view, arrow),
content_setting_bubble_model_(content_setting_bubble_model),
- custom_link_(NULL),
- manage_link_(NULL),
- learn_more_link_(NULL) {
+ custom_link_(nullptr),
+ manage_link_(nullptr),
+ manage_button_(nullptr),
+ learn_more_link_(nullptr) {
// Compensate for built-in vertical padding in the anchor view's image.
set_anchor_view_insets(gfx::Insets(
GetLayoutConstant(LOCATION_BAR_BUBBLE_ANCHOR_VERTICAL_INSET), 0));
@@ -381,10 +383,18 @@ 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()
+ .show_manage_text_as_button) {
+ manage_button_ = views::MdTextButton::CreateSecondaryUiButton(
+ this, base::UTF8ToUTF16(
+ content_setting_bubble_model_->bubble_content().manage_text));
+ return manage_button_;
+ } else {
+ manage_link_ = new views::Link(base::UTF8ToUTF16(
+ content_setting_bubble_model_->bubble_content().manage_text));
+ 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,
« 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