Commit 2c245143 authored by melandory's avatar melandory Committed by Commit bot

Make 'Load full site' a button instead of link.

BUG=646762

Review-Url: https://codereview.chromium.org/2339783003
Cr-Commit-Position: refs/heads/master@{#418697}
parent aaa4fe75
...@@ -742,7 +742,7 @@ const ContentTypeToNibPath kNibPaths[] = { ...@@ -742,7 +742,7 @@ const ContentTypeToNibPath kNibPaths[] = {
- (void)initManageDoneButtons { - (void)initManageDoneButtons {
const ContentSettingBubbleModel::BubbleContent& content = const ContentSettingBubbleModel::BubbleContent& content =
contentSettingBubbleModel_->bubble_content(); contentSettingBubbleModel_->bubble_content();
[manageButton_ setTitle:base::SysUTF8ToNSString(content.manage_link)]; [manageButton_ setTitle:base::SysUTF8ToNSString(content.manage_text)];
[GTMUILocalizerAndLayoutTweaker sizeToFitView:[manageButton_ superview]]; [GTMUILocalizerAndLayoutTweaker sizeToFitView:[manageButton_ superview]];
CGFloat actualWidth = NSWidth([[[self window] contentView] frame]); CGFloat actualWidth = NSWidth([[[self window] contentView] frame]);
......
...@@ -115,7 +115,7 @@ ContentSettingSimpleBubbleModel::ContentSettingSimpleBubbleModel( ...@@ -115,7 +115,7 @@ ContentSettingSimpleBubbleModel::ContentSettingSimpleBubbleModel(
// Notifications do not have a bubble. // Notifications do not have a bubble.
DCHECK_NE(content_type, CONTENT_SETTINGS_TYPE_NOTIFICATIONS); DCHECK_NE(content_type, CONTENT_SETTINGS_TYPE_NOTIFICATIONS);
SetTitle(); SetTitle();
SetManageLink(); SetManageText();
SetCustomLink(); SetCustomLink();
} }
...@@ -162,7 +162,7 @@ void ContentSettingSimpleBubbleModel::SetTitle() { ...@@ -162,7 +162,7 @@ void ContentSettingSimpleBubbleModel::SetTitle() {
set_title(l10n_util::GetStringUTF16(title_id)); set_title(l10n_util::GetStringUTF16(title_id));
} }
void ContentSettingSimpleBubbleModel::SetManageLink() { void ContentSettingSimpleBubbleModel::SetManageText() {
static const ContentSettingsTypeIdEntry kLinkIDs[] = { static const ContentSettingsTypeIdEntry kLinkIDs[] = {
{CONTENT_SETTINGS_TYPE_COOKIES, IDS_BLOCKED_COOKIES_LINK}, {CONTENT_SETTINGS_TYPE_COOKIES, IDS_BLOCKED_COOKIES_LINK},
{CONTENT_SETTINGS_TYPE_IMAGES, IDS_BLOCKED_IMAGES_LINK}, {CONTENT_SETTINGS_TYPE_IMAGES, IDS_BLOCKED_IMAGES_LINK},
...@@ -176,7 +176,7 @@ void ContentSettingSimpleBubbleModel::SetManageLink() { ...@@ -176,7 +176,7 @@ void ContentSettingSimpleBubbleModel::SetManageLink() {
{CONTENT_SETTINGS_TYPE_AUTOMATIC_DOWNLOADS, IDS_BLOCKED_DOWNLOADS_LINK}, {CONTENT_SETTINGS_TYPE_AUTOMATIC_DOWNLOADS, IDS_BLOCKED_DOWNLOADS_LINK},
{CONTENT_SETTINGS_TYPE_MIDI_SYSEX, IDS_MIDI_SYSEX_BUBBLE_MANAGE_LINK}, {CONTENT_SETTINGS_TYPE_MIDI_SYSEX, IDS_MIDI_SYSEX_BUBBLE_MANAGE_LINK},
}; };
set_manage_link(l10n_util::GetStringUTF8( set_manage_text(l10n_util::GetStringUTF8(
GetIdForContentType(kLinkIDs, arraysize(kLinkIDs), content_type()))); GetIdForContentType(kLinkIDs, arraysize(kLinkIDs), content_type())));
} }
...@@ -617,7 +617,7 @@ ContentSettingMediaStreamBubbleModel::ContentSettingMediaStreamBubbleModel( ...@@ -617,7 +617,7 @@ ContentSettingMediaStreamBubbleModel::ContentSettingMediaStreamBubbleModel(
SetTitle(); SetTitle();
SetRadioGroup(); SetRadioGroup();
SetMediaMenus(); SetMediaMenus();
SetManageLink(); SetManageText();
SetCustomLink(); SetCustomLink();
} }
...@@ -860,7 +860,7 @@ void ContentSettingMediaStreamBubbleModel::SetMediaMenus() { ...@@ -860,7 +860,7 @@ void ContentSettingMediaStreamBubbleModel::SetMediaMenus() {
} }
} }
void ContentSettingMediaStreamBubbleModel::SetManageLink() { void ContentSettingMediaStreamBubbleModel::SetManageText() {
// By default, the manage link refers to both media types. We only need // By default, the manage link refers to both media types. We only need
// to change the link text if only one media type was accessed. // to change the link text if only one media type was accessed.
int link_id; int link_id;
...@@ -875,7 +875,7 @@ void ContentSettingMediaStreamBubbleModel::SetManageLink() { ...@@ -875,7 +875,7 @@ void ContentSettingMediaStreamBubbleModel::SetManageLink() {
return; return;
} }
set_manage_link(l10n_util::GetStringUTF8(link_id)); set_manage_text(l10n_util::GetStringUTF8(link_id));
} }
void ContentSettingMediaStreamBubbleModel::SetCustomLink() { void ContentSettingMediaStreamBubbleModel::SetCustomLink() {
...@@ -1200,7 +1200,7 @@ ContentSettingSubresourceFilterBubbleModel:: ...@@ -1200,7 +1200,7 @@ ContentSettingSubresourceFilterBubbleModel::
: ContentSettingBubbleModel(delegate, web_contents, profile) { : ContentSettingBubbleModel(delegate, web_contents, profile) {
SetTitle(); SetTitle();
SetMessage(); SetMessage();
SetManageLink(); SetManageText();
} }
ContentSettingSubresourceFilterBubbleModel:: ContentSettingSubresourceFilterBubbleModel::
...@@ -1211,10 +1211,10 @@ void ContentSettingSubresourceFilterBubbleModel::SetTitle() { ...@@ -1211,10 +1211,10 @@ void ContentSettingSubresourceFilterBubbleModel::SetTitle() {
l10n_util::GetStringUTF16(IDS_FILTERED_DECEPTIVE_CONTENT_PROMPT_TITLE)); l10n_util::GetStringUTF16(IDS_FILTERED_DECEPTIVE_CONTENT_PROMPT_TITLE));
} }
void ContentSettingSubresourceFilterBubbleModel::SetManageLink() { void ContentSettingSubresourceFilterBubbleModel::SetManageText() {
// TODO(melandory): introduce the button instead of link. set_manage_text(
set_manage_link(
l10n_util::GetStringUTF8(IDS_FILTERED_DECEPTIVE_CONTENT_PROMPT_RELOAD)); l10n_util::GetStringUTF8(IDS_FILTERED_DECEPTIVE_CONTENT_PROMPT_RELOAD));
set_show_manage_text_as_button(true);
} }
void ContentSettingSubresourceFilterBubbleModel::SetMessage() { void ContentSettingSubresourceFilterBubbleModel::SetMessage() {
...@@ -1405,8 +1405,8 @@ ContentSettingBubbleModel::MediaMenu::~MediaMenu() {} ...@@ -1405,8 +1405,8 @@ ContentSettingBubbleModel::MediaMenu::~MediaMenu() {}
ContentSettingBubbleModel::BubbleContent::BubbleContent() ContentSettingBubbleModel::BubbleContent::BubbleContent()
: radio_group_enabled(false), : radio_group_enabled(false),
custom_link_enabled(false) { custom_link_enabled(false),
} show_manage_text_as_button(false) {}
ContentSettingBubbleModel::BubbleContent::~BubbleContent() {} ContentSettingBubbleModel::BubbleContent::~BubbleContent() {}
......
...@@ -120,7 +120,8 @@ class ContentSettingBubbleModel : public content::NotificationObserver { ...@@ -120,7 +120,8 @@ class ContentSettingBubbleModel : public content::NotificationObserver {
std::vector<DomainList> domain_lists; std::vector<DomainList> domain_lists;
std::string custom_link; std::string custom_link;
bool custom_link_enabled; bool custom_link_enabled;
std::string manage_link; std::string manage_text;
bool show_manage_text_as_button;
MediaMenuMap media_menus; MediaMenuMap media_menus;
std::string learn_more_link; std::string learn_more_link;
...@@ -211,8 +212,11 @@ class ContentSettingBubbleModel : public content::NotificationObserver { ...@@ -211,8 +212,11 @@ class ContentSettingBubbleModel : public content::NotificationObserver {
void set_custom_link_enabled(bool enabled) { void set_custom_link_enabled(bool enabled) {
bubble_content_.custom_link_enabled = enabled; bubble_content_.custom_link_enabled = enabled;
} }
void set_manage_link(const std::string& link) { void set_manage_text(const std::string& link) {
bubble_content_.manage_link = link; bubble_content_.manage_text = link;
}
void set_show_manage_text_as_button(bool show_manage_text_as_button) {
bubble_content_.show_manage_text_as_button = show_manage_text_as_button;
} }
void set_learn_more_link(const std::string& link) { void set_learn_more_link(const std::string& link) {
bubble_content_.learn_more_link = link; bubble_content_.learn_more_link = link;
...@@ -233,7 +237,7 @@ class ContentSettingBubbleModel : public content::NotificationObserver { ...@@ -233,7 +237,7 @@ class ContentSettingBubbleModel : public content::NotificationObserver {
private: private:
virtual void SetTitle() = 0; virtual void SetTitle() = 0;
virtual void SetManageLink() = 0; virtual void SetManageText() = 0;
content::WebContents* web_contents_; content::WebContents* web_contents_;
Profile* profile_; Profile* profile_;
...@@ -266,7 +270,7 @@ class ContentSettingSimpleBubbleModel : public ContentSettingBubbleModel { ...@@ -266,7 +270,7 @@ class ContentSettingSimpleBubbleModel : public ContentSettingBubbleModel {
private: private:
// ContentSettingBubbleModel implementation. // ContentSettingBubbleModel implementation.
void SetTitle() override; void SetTitle() override;
void SetManageLink() override; void SetManageText() override;
void OnManageLinkClicked() override; void OnManageLinkClicked() override;
void SetCustomLink(); void SetCustomLink();
void OnCustomLinkClicked() override; void OnCustomLinkClicked() override;
...@@ -324,7 +328,7 @@ class ContentSettingSubresourceFilterBubbleModel ...@@ -324,7 +328,7 @@ class ContentSettingSubresourceFilterBubbleModel
// ContentSettingBubbleModel: // ContentSettingBubbleModel:
void SetTitle() override; void SetTitle() override;
void SetManageLink() override; void SetManageText() override;
DISALLOW_COPY_AND_ASSIGN(ContentSettingSubresourceFilterBubbleModel); DISALLOW_COPY_AND_ASSIGN(ContentSettingSubresourceFilterBubbleModel);
}; };
...@@ -350,7 +354,7 @@ class ContentSettingMediaStreamBubbleModel : public ContentSettingBubbleModel { ...@@ -350,7 +354,7 @@ class ContentSettingMediaStreamBubbleModel : public ContentSettingBubbleModel {
// ContentSettingBubbleModel: // ContentSettingBubbleModel:
void SetTitle() override; void SetTitle() override;
void SetManageLink() override; void SetManageText() override;
// Sets the data for the radio buttons of the bubble. // Sets the data for the radio buttons of the bubble.
void SetRadioGroup(); void SetRadioGroup();
......
...@@ -56,7 +56,7 @@ class ContentSettingBubbleModelTest : public ChromeRenderViewHostTestHarness { ...@@ -56,7 +56,7 @@ class ContentSettingBubbleModelTest : public ChromeRenderViewHostTestHarness {
EXPECT_NE(expect_clear_link || expect_reload_hint, EXPECT_NE(expect_clear_link || expect_reload_hint,
bubble_content.custom_link.empty()); bubble_content.custom_link.empty());
EXPECT_EQ(expect_clear_link, bubble_content.custom_link_enabled); EXPECT_EQ(expect_clear_link, bubble_content.custom_link_enabled);
EXPECT_FALSE(bubble_content.manage_link.empty()); EXPECT_FALSE(bubble_content.manage_text.empty());
} }
std::string GetDefaultAudioDevice() { std::string GetDefaultAudioDevice() {
...@@ -84,7 +84,7 @@ TEST_F(ContentSettingBubbleModelTest, ImageRadios) { ...@@ -84,7 +84,7 @@ TEST_F(ContentSettingBubbleModelTest, ImageRadios) {
EXPECT_EQ(2U, bubble_content.radio_group.radio_items.size()); EXPECT_EQ(2U, bubble_content.radio_group.radio_items.size());
EXPECT_EQ(0, bubble_content.radio_group.default_item); EXPECT_EQ(0, bubble_content.radio_group.default_item);
EXPECT_TRUE(bubble_content.custom_link.empty()); EXPECT_TRUE(bubble_content.custom_link.empty());
EXPECT_FALSE(bubble_content.manage_link.empty()); EXPECT_FALSE(bubble_content.manage_text.empty());
} }
TEST_F(ContentSettingBubbleModelTest, Cookies) { TEST_F(ContentSettingBubbleModelTest, Cookies) {
...@@ -102,7 +102,7 @@ TEST_F(ContentSettingBubbleModelTest, Cookies) { ...@@ -102,7 +102,7 @@ TEST_F(ContentSettingBubbleModelTest, Cookies) {
ASSERT_EQ(2U, bubble_content.radio_group.radio_items.size()); ASSERT_EQ(2U, bubble_content.radio_group.radio_items.size());
EXPECT_FALSE(bubble_content.custom_link.empty()); EXPECT_FALSE(bubble_content.custom_link.empty());
EXPECT_TRUE(bubble_content.custom_link_enabled); EXPECT_TRUE(bubble_content.custom_link_enabled);
EXPECT_FALSE(bubble_content.manage_link.empty()); EXPECT_FALSE(bubble_content.manage_text.empty());
content_settings->ClearCookieSpecificContentSettings(); content_settings->ClearCookieSpecificContentSettings();
content_settings->OnContentAllowed(CONTENT_SETTINGS_TYPE_COOKIES); content_settings->OnContentAllowed(CONTENT_SETTINGS_TYPE_COOKIES);
...@@ -124,7 +124,7 @@ TEST_F(ContentSettingBubbleModelTest, Cookies) { ...@@ -124,7 +124,7 @@ TEST_F(ContentSettingBubbleModelTest, Cookies) {
web_contents()->GetURL()))); web_contents()->GetURL())));
EXPECT_FALSE(bubble_content_2.custom_link.empty()); EXPECT_FALSE(bubble_content_2.custom_link.empty());
EXPECT_TRUE(bubble_content_2.custom_link_enabled); EXPECT_TRUE(bubble_content_2.custom_link_enabled);
EXPECT_FALSE(bubble_content_2.manage_link.empty()); EXPECT_FALSE(bubble_content_2.manage_text.empty());
} }
TEST_F(ContentSettingBubbleModelTest, MediastreamMicAndCamera) { TEST_F(ContentSettingBubbleModelTest, MediastreamMicAndCamera) {
...@@ -164,7 +164,7 @@ TEST_F(ContentSettingBubbleModelTest, MediastreamMicAndCamera) { ...@@ -164,7 +164,7 @@ TEST_F(ContentSettingBubbleModelTest, MediastreamMicAndCamera) {
EXPECT_EQ(0, bubble_content.radio_group.default_item); EXPECT_EQ(0, bubble_content.radio_group.default_item);
EXPECT_TRUE(bubble_content.custom_link.empty()); EXPECT_TRUE(bubble_content.custom_link.empty());
EXPECT_FALSE(bubble_content.custom_link_enabled); EXPECT_FALSE(bubble_content.custom_link_enabled);
EXPECT_FALSE(bubble_content.manage_link.empty()); EXPECT_FALSE(bubble_content.manage_text.empty());
EXPECT_EQ(2U, bubble_content.media_menus.size()); EXPECT_EQ(2U, bubble_content.media_menus.size());
} }
...@@ -523,7 +523,7 @@ TEST_F(ContentSettingBubbleModelTest, MediastreamMic) { ...@@ -523,7 +523,7 @@ TEST_F(ContentSettingBubbleModelTest, MediastreamMic) {
EXPECT_EQ(0, bubble_content.radio_group.default_item); EXPECT_EQ(0, bubble_content.radio_group.default_item);
EXPECT_TRUE(bubble_content.custom_link.empty()); EXPECT_TRUE(bubble_content.custom_link.empty());
EXPECT_FALSE(bubble_content.custom_link_enabled); EXPECT_FALSE(bubble_content.custom_link_enabled);
EXPECT_FALSE(bubble_content.manage_link.empty()); EXPECT_FALSE(bubble_content.manage_text.empty());
EXPECT_EQ(1U, bubble_content.media_menus.size()); EXPECT_EQ(1U, bubble_content.media_menus.size());
EXPECT_EQ(content::MEDIA_DEVICE_AUDIO_CAPTURE, EXPECT_EQ(content::MEDIA_DEVICE_AUDIO_CAPTURE,
bubble_content.media_menus.begin()->first); bubble_content.media_menus.begin()->first);
...@@ -554,7 +554,7 @@ TEST_F(ContentSettingBubbleModelTest, MediastreamMic) { ...@@ -554,7 +554,7 @@ TEST_F(ContentSettingBubbleModelTest, MediastreamMic) {
EXPECT_EQ(1, new_bubble_content.radio_group.default_item); EXPECT_EQ(1, new_bubble_content.radio_group.default_item);
EXPECT_TRUE(new_bubble_content.custom_link.empty()); EXPECT_TRUE(new_bubble_content.custom_link.empty());
EXPECT_FALSE(new_bubble_content.custom_link_enabled); EXPECT_FALSE(new_bubble_content.custom_link_enabled);
EXPECT_FALSE(new_bubble_content.manage_link.empty()); EXPECT_FALSE(new_bubble_content.manage_text.empty());
EXPECT_EQ(1U, new_bubble_content.media_menus.size()); EXPECT_EQ(1U, new_bubble_content.media_menus.size());
EXPECT_EQ(content::MEDIA_DEVICE_AUDIO_CAPTURE, EXPECT_EQ(content::MEDIA_DEVICE_AUDIO_CAPTURE,
new_bubble_content.media_menus.begin()->first); new_bubble_content.media_menus.begin()->first);
...@@ -596,7 +596,7 @@ TEST_F(ContentSettingBubbleModelTest, MediastreamCamera) { ...@@ -596,7 +596,7 @@ TEST_F(ContentSettingBubbleModelTest, MediastreamCamera) {
EXPECT_EQ(0, bubble_content.radio_group.default_item); EXPECT_EQ(0, bubble_content.radio_group.default_item);
EXPECT_TRUE(bubble_content.custom_link.empty()); EXPECT_TRUE(bubble_content.custom_link.empty());
EXPECT_FALSE(bubble_content.custom_link_enabled); EXPECT_FALSE(bubble_content.custom_link_enabled);
EXPECT_FALSE(bubble_content.manage_link.empty()); EXPECT_FALSE(bubble_content.manage_text.empty());
EXPECT_EQ(1U, bubble_content.media_menus.size()); EXPECT_EQ(1U, bubble_content.media_menus.size());
EXPECT_EQ(content::MEDIA_DEVICE_VIDEO_CAPTURE, EXPECT_EQ(content::MEDIA_DEVICE_VIDEO_CAPTURE,
bubble_content.media_menus.begin()->first); bubble_content.media_menus.begin()->first);
...@@ -627,7 +627,7 @@ TEST_F(ContentSettingBubbleModelTest, MediastreamCamera) { ...@@ -627,7 +627,7 @@ TEST_F(ContentSettingBubbleModelTest, MediastreamCamera) {
EXPECT_EQ(1, new_bubble_content.radio_group.default_item); EXPECT_EQ(1, new_bubble_content.radio_group.default_item);
EXPECT_TRUE(new_bubble_content.custom_link.empty()); EXPECT_TRUE(new_bubble_content.custom_link.empty());
EXPECT_FALSE(new_bubble_content.custom_link_enabled); EXPECT_FALSE(new_bubble_content.custom_link_enabled);
EXPECT_FALSE(new_bubble_content.manage_link.empty()); EXPECT_FALSE(new_bubble_content.manage_text.empty());
EXPECT_EQ(1U, new_bubble_content.media_menus.size()); EXPECT_EQ(1U, new_bubble_content.media_menus.size());
EXPECT_EQ(content::MEDIA_DEVICE_VIDEO_CAPTURE, EXPECT_EQ(content::MEDIA_DEVICE_VIDEO_CAPTURE,
new_bubble_content.media_menus.begin()->first); new_bubble_content.media_menus.begin()->first);
...@@ -721,7 +721,7 @@ TEST_F(ContentSettingBubbleModelTest, Plugins) { ...@@ -721,7 +721,7 @@ TEST_F(ContentSettingBubbleModelTest, Plugins) {
EXPECT_EQ(2U, bubble_content.radio_group.radio_items.size()); EXPECT_EQ(2U, bubble_content.radio_group.radio_items.size());
EXPECT_FALSE(bubble_content.custom_link.empty()); EXPECT_FALSE(bubble_content.custom_link.empty());
EXPECT_TRUE(bubble_content.custom_link_enabled); EXPECT_TRUE(bubble_content.custom_link_enabled);
EXPECT_FALSE(bubble_content.manage_link.empty()); EXPECT_FALSE(bubble_content.manage_text.empty());
EXPECT_FALSE(bubble_content.learn_more_link.empty()); EXPECT_FALSE(bubble_content.learn_more_link.empty());
} }
...@@ -742,7 +742,7 @@ TEST_F(ContentSettingBubbleModelTest, PepperBroker) { ...@@ -742,7 +742,7 @@ TEST_F(ContentSettingBubbleModelTest, PepperBroker) {
std::string radio1 = bubble_content.radio_group.radio_items[0]; std::string radio1 = bubble_content.radio_group.radio_items[0];
std::string radio2 = bubble_content.radio_group.radio_items[1]; std::string radio2 = bubble_content.radio_group.radio_items[1];
EXPECT_FALSE(bubble_content.custom_link_enabled); EXPECT_FALSE(bubble_content.custom_link_enabled);
EXPECT_FALSE(bubble_content.manage_link.empty()); EXPECT_FALSE(bubble_content.manage_text.empty());
content_settings->ClearBlockedContentSettingsExceptForCookies(); content_settings->ClearBlockedContentSettingsExceptForCookies();
content_settings->OnContentAllowed(CONTENT_SETTINGS_TYPE_PPAPI_BROKER); content_settings->OnContentAllowed(CONTENT_SETTINGS_TYPE_PPAPI_BROKER);
...@@ -759,7 +759,7 @@ TEST_F(ContentSettingBubbleModelTest, PepperBroker) { ...@@ -759,7 +759,7 @@ TEST_F(ContentSettingBubbleModelTest, PepperBroker) {
EXPECT_NE(radio1, bubble_content_2.radio_group.radio_items[0]); EXPECT_NE(radio1, bubble_content_2.radio_group.radio_items[0]);
EXPECT_NE(radio2, bubble_content_2.radio_group.radio_items[1]); EXPECT_NE(radio2, bubble_content_2.radio_group.radio_items[1]);
EXPECT_FALSE(bubble_content_2.custom_link_enabled); EXPECT_FALSE(bubble_content_2.custom_link_enabled);
EXPECT_FALSE(bubble_content_2.manage_link.empty()); EXPECT_FALSE(bubble_content_2.manage_text.empty());
} }
TEST_F(ContentSettingBubbleModelTest, Geolocation) { TEST_F(ContentSettingBubbleModelTest, Geolocation) {
...@@ -831,7 +831,7 @@ TEST_F(ContentSettingBubbleModelTest, RegisterProtocolHandler) { ...@@ -831,7 +831,7 @@ TEST_F(ContentSettingBubbleModelTest, RegisterProtocolHandler) {
EXPECT_TRUE(bubble_content.domain_lists.empty()); EXPECT_TRUE(bubble_content.domain_lists.empty());
EXPECT_TRUE(bubble_content.custom_link.empty()); EXPECT_TRUE(bubble_content.custom_link.empty());
EXPECT_FALSE(bubble_content.custom_link_enabled); EXPECT_FALSE(bubble_content.custom_link_enabled);
EXPECT_FALSE(bubble_content.manage_link.empty()); EXPECT_FALSE(bubble_content.manage_text.empty());
} }
class FakeDelegate : public ProtocolHandlerRegistry::Delegate { class FakeDelegate : public ProtocolHandlerRegistry::Delegate {
...@@ -937,7 +937,7 @@ TEST_F(ContentSettingBubbleModelTest, SubresourceFilter) { ...@@ -937,7 +937,7 @@ TEST_F(ContentSettingBubbleModelTest, SubresourceFilter) {
EXPECT_TRUE(bubble_content.custom_link.empty()); EXPECT_TRUE(bubble_content.custom_link.empty());
EXPECT_FALSE(bubble_content.custom_link_enabled); EXPECT_FALSE(bubble_content.custom_link_enabled);
EXPECT_EQ( EXPECT_EQ(
bubble_content.manage_link, bubble_content.manage_text,
l10n_util::GetStringUTF8(IDS_FILTERED_DECEPTIVE_CONTENT_PROMPT_RELOAD)); l10n_util::GetStringUTF8(IDS_FILTERED_DECEPTIVE_CONTENT_PROMPT_RELOAD));
EXPECT_EQ(0U, bubble_content.media_menus.size()); EXPECT_EQ(0U, bubble_content.media_menus.size());
} }
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include "ui/base/resource/resource_bundle.h" #include "ui/base/resource/resource_bundle.h"
#include "ui/gfx/font_list.h" #include "ui/gfx/font_list.h"
#include "ui/gfx/text_utils.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/menu_button.h"
#include "ui/views/controls/button/radio_button.h" #include "ui/views/controls/button/radio_button.h"
#include "ui/views/controls/combobox/combobox.h" #include "ui/views/controls/combobox/combobox.h"
...@@ -159,9 +160,10 @@ ContentSettingBubbleContents::ContentSettingBubbleContents( ...@@ -159,9 +160,10 @@ ContentSettingBubbleContents::ContentSettingBubbleContents(
: content::WebContentsObserver(web_contents), : content::WebContentsObserver(web_contents),
BubbleDialogDelegateView(anchor_view, arrow), BubbleDialogDelegateView(anchor_view, arrow),
content_setting_bubble_model_(content_setting_bubble_model), content_setting_bubble_model_(content_setting_bubble_model),
custom_link_(NULL), custom_link_(nullptr),
manage_link_(NULL), manage_link_(nullptr),
learn_more_link_(NULL) { manage_button_(nullptr),
learn_more_link_(nullptr) {
// Compensate for built-in vertical padding in the anchor view's image. // Compensate for built-in vertical padding in the anchor view's image.
set_anchor_view_insets(gfx::Insets( set_anchor_view_insets(gfx::Insets(
GetLayoutConstant(LOCATION_BAR_BUBBLE_ANCHOR_VERTICAL_INSET), 0)); GetLayoutConstant(LOCATION_BAR_BUBBLE_ANCHOR_VERTICAL_INSET), 0));
...@@ -381,10 +383,18 @@ void ContentSettingBubbleContents::Init() { ...@@ -381,10 +383,18 @@ void ContentSettingBubbleContents::Init() {
} }
views::View* ContentSettingBubbleContents::CreateExtraView() { views::View* ContentSettingBubbleContents::CreateExtraView() {
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( manage_link_ = new views::Link(base::UTF8ToUTF16(
content_setting_bubble_model_->bubble_content().manage_link)); content_setting_bubble_model_->bubble_content().manage_text));
manage_link_->set_listener(this); manage_link_->set_listener(this);
return manage_link_; return manage_link_;
}
} }
bool ContentSettingBubbleContents::Accept() { bool ContentSettingBubbleContents::Accept() {
...@@ -415,10 +425,15 @@ void ContentSettingBubbleContents::DidNavigateMainFrame( ...@@ -415,10 +425,15 @@ void ContentSettingBubbleContents::DidNavigateMainFrame(
void ContentSettingBubbleContents::ButtonPressed(views::Button* sender, void ContentSettingBubbleContents::ButtonPressed(views::Button* sender,
const ui::Event& event) { const ui::Event& event) {
if (manage_button_ == sender) {
GetWidget()->Close();
content_setting_bubble_model_->OnManageLinkClicked();
} else {
RadioGroup::const_iterator i( RadioGroup::const_iterator i(
std::find(radio_group_.begin(), radio_group_.end(), sender)); std::find(radio_group_.begin(), radio_group_.end(), sender));
DCHECK(i != radio_group_.end()); DCHECK(i != radio_group_.end());
content_setting_bubble_model_->OnRadioClicked(i - radio_group_.begin()); content_setting_bubble_model_->OnRadioClicked(i - radio_group_.begin());
}
} }
void ContentSettingBubbleContents::LinkClicked(views::Link* source, void ContentSettingBubbleContents::LinkClicked(views::Link* source,
......
...@@ -28,6 +28,7 @@ class ContentSettingBubbleViewsBridge; ...@@ -28,6 +28,7 @@ class ContentSettingBubbleViewsBridge;
namespace views { namespace views {
class RadioButton; class RadioButton;
class LabelButton;
} }
// ContentSettingBubbleContents is used when the user turns on different kinds // ContentSettingBubbleContents is used when the user turns on different kinds
...@@ -116,6 +117,7 @@ class ContentSettingBubbleContents : public content::WebContentsObserver, ...@@ -116,6 +117,7 @@ class ContentSettingBubbleContents : public content::WebContentsObserver,
RadioGroup radio_group_; RadioGroup radio_group_;
views::Link* custom_link_; views::Link* custom_link_;
views::Link* manage_link_; views::Link* manage_link_;
views::LabelButton* manage_button_;
views::Link* learn_more_link_; views::Link* learn_more_link_;
// Combobox models the bubble owns. // Combobox models the bubble owns.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment