Commit 0c0936f5 authored by Tim Judkins's avatar Tim Judkins Committed by Commit Bot

[Extensions] Remove "learn more" from the developer mode warning bubble

Bug: 747715
Change-Id: I957d86b986d2da087c0ade85e8cc04228a7a4eff
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1725050
Commit-Queue: Tim Judkins <tjudkins@chromium.org>
Reviewed-by: default avatarDevlin <rdevlin.cronin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#684069}
parent 7daf8796
......@@ -66,8 +66,12 @@ base::string16 DevModeBubbleDelegate::GetOverflowText(
overflow_count);
}
base::string16 DevModeBubbleDelegate::GetLearnMoreLabel() const {
return base::string16();
}
GURL DevModeBubbleDelegate::GetLearnMoreUrl() const {
return GURL(chrome::kChromeUIExtensionsURL);
return GURL();
}
base::string16 DevModeBubbleDelegate::GetActionButtonLabel() const {
......
......@@ -33,6 +33,7 @@ class DevModeBubbleDelegate
int extension_count) const override;
base::string16 GetOverflowText(
const base::string16& overflow_count) const override;
base::string16 GetLearnMoreLabel() const override;
GURL GetLearnMoreUrl() const override;
base::string16 GetActionButtonLabel() const override;
base::string16 GetDismissButtonLabel() const override;
......
......@@ -256,10 +256,12 @@ void ExtensionMessageBubbleController::OnLinkClicked() {
// perform our cleanup here before opening the new tab.
OnClose();
if (!g_should_ignore_learn_more_for_testing) {
browser_->OpenURL(content::OpenURLParams(
delegate_->GetLearnMoreUrl(), content::Referrer(),
WindowOpenDisposition::NEW_FOREGROUND_TAB, ui::PAGE_TRANSITION_LINK,
false));
GURL learn_more_url = delegate_->GetLearnMoreUrl();
DCHECK(learn_more_url.is_valid());
browser_->OpenURL(
content::OpenURLParams(learn_more_url, content::Referrer(),
WindowOpenDisposition::NEW_FOREGROUND_TAB,
ui::PAGE_TRANSITION_LINK, false));
}
// Warning: |this| may be deleted here!
}
......
......@@ -654,26 +654,6 @@ TEST_F(ExtensionMessageBubbleTest, DevModeControllerTest) {
service_->EnableExtension(kId1);
service_->EnableExtension(kId2);
// Show the dialog a third time, but now press the learn more link.
bubble.set_action_on_show(
FakeExtensionMessageBubble::BUBBLE_ACTION_CLICK_LINK);
controller.reset(
new TestExtensionMessageBubbleController(
new DevModeBubbleDelegate(browser()->profile()),
browser()));
controller->SetIsActiveBubble();
controller->delegate()->ClearProfileSetForTesting();
EXPECT_TRUE(controller->ShouldShow());
dev_mode_extensions = controller->GetExtensionList();
EXPECT_EQ(2U, dev_mode_extensions.size());
bubble.set_controller(controller.get());
bubble.Show(); // Simulate showing the bubble.
EXPECT_EQ(1U, controller->link_click_count());
EXPECT_EQ(0U, controller->action_click_count());
EXPECT_EQ(0U, controller->dismiss_click_count());
EXPECT_TRUE(registry->enabled_extensions().GetByID(kId1) != NULL);
EXPECT_TRUE(registry->enabled_extensions().GetByID(kId2) != NULL);
// Now disable the unpacked extension.
service_->DisableExtension(kId1, disable_reason::DISABLE_USER_ACTION);
service_->DisableExtension(kId2, disable_reason::DISABLE_USER_ACTION);
......
......@@ -365,21 +365,29 @@ void ExtensionMessageBubbleBrowserTest::TestBubbleWithMultipleWindows() {
void ExtensionMessageBubbleBrowserTest::TestClickingLearnMoreButton() {
CheckBubbleIsNotPresent(browser(), false, false);
LoadExtension(test_data_dir_.AppendASCII("simple_with_popup"));
scoped_refptr<const extensions::Extension> no_action_extension =
extensions::ExtensionBuilder("no_action_extension")
.SetLocation(extensions::Manifest::INTERNAL)
.Build();
extension_service()->AddExtension(no_action_extension.get());
extension_service()->DisableExtension(
no_action_extension->id(),
extensions::disable_reason::DISABLE_NOT_VERIFIED);
Browser* second_browser = new Browser(Browser::CreateParams(profile(), true));
ASSERT_TRUE(second_browser);
second_browser->window()->Show();
base::RunLoop().RunUntilIdle();
CheckBubble(second_browser, ANCHOR_BROWSER_ACTION, true);
ClickLearnMoreButton(second_browser);
base::RunLoop().RunUntilIdle();
CheckBubbleIsNotPresent(second_browser, false, false);
// The learn more link goes to the chrome://extensions page, so it should be
// opened in the active tab.
// The learn more link goes to the information page about 'suspicious
// extensions', so it should be opened in the active tab.
content::WebContents* active_web_contents =
second_browser->tab_strip_model()->GetActiveWebContents();
content::WaitForLoadStop(active_web_contents);
EXPECT_EQ(GURL(chrome::kChromeUIExtensionsURL),
EXPECT_EQ(GURL(chrome::kRemoveNonCWSExtensionURL),
active_web_contents->GetLastCommittedURL());
}
......
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