diff options
author | Will Harris <wfh@chromium.org> | 2014-12-22 16:36:50 -0800 |
---|---|---|
committer | Will Harris <wfh@chromium.org> | 2014-12-23 00:37:48 +0000 |
commit | d21ad692c31e0cbee6e840aa6741090be9eb2051 (patch) | |
tree | 8f5a8ad7c07d8fad3e29c60d8c78b199f3d4bdb0 | |
parent | 67c8ce6d16f866ccfecde6f7b6e7ae92bf2bfe16 (diff) | |
download | chromium_src-d21ad692c31e0cbee6e840aa6741090be9eb2051.zip chromium_src-d21ad692c31e0cbee6e840aa6741090be9eb2051.tar.gz chromium_src-d21ad692c31e0cbee6e840aa6741090be9eb2051.tar.bz2 |
Merge: Never display unauthorized plugin info bar.
The IPC still needs to be sent because it's used by the webview permission helper to permit PPAPI plugins to run inside a webview.
Remove all the code that backed this, including UMA actions, and a test. The NPAPI purge, begun, it has.
BUG=439972
Review URL: https://codereview.chromium.org/801053003
Cr-Commit-Position: refs/heads/master@{#308433}
(cherry picked from commit 4ecfe306cc14acd30a2206bc04d203281ed1d3f3)
Review URL: https://codereview.chromium.org/788053004
Cr-Commit-Position: refs/branch-heads/2214@{#352}
Cr-Branched-From: 03655fd3f6d72165dc3c9bd2c89807305316fe6c-refs/heads/master@{#303346}
-rw-r--r-- | chrome/browser/chrome_browser_field_trials.cc | 1 | ||||
-rw-r--r-- | chrome/browser/plugins/npapi_infobar_browsertest.cc | 115 | ||||
-rw-r--r-- | chrome/browser/plugins/plugin_infobar_delegates.cc | 87 | ||||
-rw-r--r-- | chrome/browser/plugins/plugin_infobar_delegates.h | 31 | ||||
-rw-r--r-- | chrome/browser/plugins/plugin_observer.cc | 12 | ||||
-rw-r--r-- | chrome/chrome_tests.gypi | 2 | ||||
-rw-r--r-- | chrome/renderer/chrome_content_renderer_client.cc | 10 | ||||
-rw-r--r-- | tools/metrics/actions/actions.xml | 11 |
8 files changed, 13 insertions, 256 deletions
diff --git a/chrome/browser/chrome_browser_field_trials.cc b/chrome/browser/chrome_browser_field_trials.cc index 398305e..f6042c4 100644 --- a/chrome/browser/chrome_browser_field_trials.cc +++ b/chrome/browser/chrome_browser_field_trials.cc @@ -52,7 +52,6 @@ void ChromeBrowserFieldTrials::InstantiateDynamicTrials() { // Mark here so they will be sync-ed. base::FieldTrialList::FindValue("CLD1VsCLD2"); base::FieldTrialList::FindValue("MouseEventPreconnect"); - base::FieldTrialList::FindValue("UnauthorizedPluginInfoBar"); base::FieldTrialList::FindValue("DisplayList2dCanvas"); base::FieldTrialList::FindValue("V8ScriptStreaming"); // Activate the autocomplete dynamic field trials. diff --git a/chrome/browser/plugins/npapi_infobar_browsertest.cc b/chrome/browser/plugins/npapi_infobar_browsertest.cc deleted file mode 100644 index 4505c55c..0000000 --- a/chrome/browser/plugins/npapi_infobar_browsertest.cc +++ /dev/null @@ -1,115 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "base/bind.h" -#include "base/command_line.h" -#include "base/files/file_path.h" -#include "base/memory/ref_counted.h" -#include "base/metrics/field_trial.h" -#include "base/path_service.h" -#include "chrome/browser/infobars/infobar_service.h" -#include "chrome/browser/net/url_request_mock_util.h" -#include "chrome/browser/ui/browser.h" -#include "chrome/browser/ui/tabs/tab_strip_model.h" -#include "chrome/common/chrome_switches.h" -#include "chrome/common/render_messages.h" -#include "chrome/test/base/in_process_browser_test.h" -#include "chrome/test/base/ui_test_utils.h" -#include "content/public/browser/browser_thread.h" -#include "content/public/common/content_paths.h" -#include "content/public/common/content_switches.h" -#include "content/public/test/browser_test_utils.h" -#include "content/public/test/test_utils.h" -#include "net/test/url_request/url_request_mock_http_job.h" -#include "url/gurl.h" - -using content::BrowserThread; -using net::URLRequestMockHTTPJob; - -namespace { - -// Tests that the NPAPI unauthorized plugin infobar is: -// (1) Shown when the Finch trial is set to "Enabled" -// (2) Not shown when the Finch trial is set to "Disabled" -// TODO(cthomp): Remove/simplify when Finch trial is completed crbug.com/381944 -class UnauthorizedPluginInfoBarBrowserTest : public InProcessBrowserTest { - protected: - UnauthorizedPluginInfoBarBrowserTest() {} - - // Makes URLRequestMockHTTPJobs serve data from content::DIR_TEST_DATA - // instead of chrome::DIR_TEST_DATA. - void ServeContentTestData() { - base::FilePath root_http; - PathService::Get(content::DIR_TEST_DATA, &root_http); - scoped_refptr<content::MessageLoopRunner> runner = - new content::MessageLoopRunner; - BrowserThread::PostTaskAndReply( - BrowserThread::IO, - FROM_HERE, - base::Bind(URLRequestMockHTTPJob::AddUrlHandler, - root_http, - make_scoped_refptr(BrowserThread::GetBlockingPool())), - runner->QuitClosure()); - runner->Run(); - } - - public: - // Verifies that the test page exists (only present with src-internal) - bool TestPageExists() { - return base::PathExists(ui_test_utils::GetTestFilePath( - base::FilePath(FILE_PATH_LITERAL("plugin")), - base::FilePath(FILE_PATH_LITERAL("quicktime.html")))); - } - - void InfoBarCountTest(size_t number_infobars_expected, - Browser* browser) { - ServeContentTestData(); - content::WebContents* contents = - browser->tab_strip_model()->GetActiveWebContents(); - ASSERT_TRUE(contents); - InfoBarService* infobar_service = InfoBarService::FromWebContents(contents); - ASSERT_TRUE(infobar_service); - EXPECT_EQ(0u, infobar_service->infobar_count()); - - base::FilePath path(FILE_PATH_LITERAL("plugin/quicktime.html")); - GURL url(URLRequestMockHTTPJob::GetMockUrl(path)); - ui_test_utils::NavigateToURL(browser, url); - ASSERT_EQ(number_infobars_expected, infobar_service->infobar_count()); - } - - private: - DISALLOW_COPY_AND_ASSIGN(UnauthorizedPluginInfoBarBrowserTest); -}; - -// When "UnauthorizedPluginInfoBar" is "Enabled", infobar for NPAPI plugin -// should be shown. -IN_PROC_BROWSER_TEST_F(UnauthorizedPluginInfoBarBrowserTest, InfobarEnabled) { - if (!TestPageExists()) { - LOG(INFO) << - "Test skipped because plugin/quicktime.html test file wasn't found."; - return; - } - base::FieldTrialList::CreateTrialsFromString( - "UnauthorizedPluginInfoBar/Enabled/", - base::FieldTrialList::ACTIVATE_TRIALS, - std::set<std::string>()); - InfoBarCountTest(1u, browser()); -} - -// When "UnauthorizedPluginInfoBar" is "Disabled", infobar for NPAPI plugin -// should not be shown. -IN_PROC_BROWSER_TEST_F(UnauthorizedPluginInfoBarBrowserTest, InfobarDisabled) { - if (!TestPageExists()) { - LOG(INFO) << - "Test skipped because plugin/quicktime.html test file wasn't found."; - return; - } - base::FieldTrialList::CreateTrialsFromString( - "UnauthorizedPluginInfoBar/Disabled/", - base::FieldTrialList::ACTIVATE_TRIALS, - std::set<std::string>()); - InfoBarCountTest(0u, browser()); -} - -} // namespace diff --git a/chrome/browser/plugins/plugin_infobar_delegates.cc b/chrome/browser/plugins/plugin_infobar_delegates.cc index ca8efaf..789b278 100644 --- a/chrome/browser/plugins/plugin_infobar_delegates.cc +++ b/chrome/browser/plugins/plugin_infobar_delegates.cc @@ -17,7 +17,6 @@ #include "chrome/common/url_constants.h" #include "chrome/grit/generated_resources.h" #include "chrome/grit/locale_settings.h" -#include "components/content_settings/core/browser/host_content_settings_map.h" #include "components/google/core/browser/google_util.h" #include "components/infobars/core/infobar.h" #include "content/public/browser/render_process_host.h" @@ -81,92 +80,6 @@ base::string16 PluginInfoBarDelegate::GetLinkText() const { return l10n_util::GetStringUTF16(IDS_LEARN_MORE); } - -// UnauthorizedPluginInfoBarDelegate ------------------------------------------ - -// static -void UnauthorizedPluginInfoBarDelegate::Create( - InfoBarService* infobar_service, - HostContentSettingsMap* content_settings, - const base::string16& name, - const std::string& identifier) { - infobar_service->AddInfoBar(ConfirmInfoBarDelegate::CreateInfoBar( - scoped_ptr<ConfirmInfoBarDelegate>(new UnauthorizedPluginInfoBarDelegate( - content_settings, name, identifier)))); - - content::RecordAction(UserMetricsAction("BlockedPluginInfobar.Shown")); - std::string utf8_name(base::UTF16ToUTF8(name)); - if (utf8_name == PluginMetadata::kJavaGroupName) { - content::RecordAction(UserMetricsAction("BlockedPluginInfobar.Shown.Java")); - } else if (utf8_name == PluginMetadata::kQuickTimeGroupName) { - content::RecordAction( - UserMetricsAction("BlockedPluginInfobar.Shown.QuickTime")); - } else if (utf8_name == PluginMetadata::kShockwaveGroupName) { - content::RecordAction( - UserMetricsAction("BlockedPluginInfobar.Shown.Shockwave")); - } else if (utf8_name == PluginMetadata::kRealPlayerGroupName) { - content::RecordAction( - UserMetricsAction("BlockedPluginInfobar.Shown.RealPlayer")); - } else if (utf8_name == PluginMetadata::kWindowsMediaPlayerGroupName) { - content::RecordAction( - UserMetricsAction("BlockedPluginInfobar.Shown.WindowsMediaPlayer")); - } -} - -UnauthorizedPluginInfoBarDelegate::UnauthorizedPluginInfoBarDelegate( - HostContentSettingsMap* content_settings, - const base::string16& name, - const std::string& identifier) - : PluginInfoBarDelegate(identifier), - content_settings_(content_settings), - name_(name) { -} - -UnauthorizedPluginInfoBarDelegate::~UnauthorizedPluginInfoBarDelegate() { - content::RecordAction(UserMetricsAction("BlockedPluginInfobar.Closed")); -} - -std::string UnauthorizedPluginInfoBarDelegate::GetLearnMoreURL() const { - return chrome::kBlockedPluginLearnMoreURL; -} - -base::string16 UnauthorizedPluginInfoBarDelegate::GetMessageText() const { - return l10n_util::GetStringFUTF16(IDS_PLUGIN_NOT_AUTHORIZED, name_); -} - -base::string16 UnauthorizedPluginInfoBarDelegate::GetButtonLabel( - InfoBarButton button) const { - return l10n_util::GetStringUTF16((button == BUTTON_OK) ? - IDS_PLUGIN_ENABLE_TEMPORARILY : IDS_PLUGIN_ENABLE_ALWAYS); -} - -bool UnauthorizedPluginInfoBarDelegate::Accept() { - content::RecordAction( - UserMetricsAction("BlockedPluginInfobar.AllowThisTime")); - LoadBlockedPlugins(); - return true; -} - -bool UnauthorizedPluginInfoBarDelegate::Cancel() { - content::RecordAction(UserMetricsAction("BlockedPluginInfobar.AlwaysAllow")); - const GURL& url = InfoBarService::WebContentsFromInfoBar(infobar())->GetURL(); - content_settings_->AddExceptionForURL(url, url, CONTENT_SETTINGS_TYPE_PLUGINS, - CONTENT_SETTING_ALLOW); - LoadBlockedPlugins(); - return true; -} - -void UnauthorizedPluginInfoBarDelegate::InfoBarDismissed() { - content::RecordAction(UserMetricsAction("BlockedPluginInfobar.Dismissed")); -} - -bool UnauthorizedPluginInfoBarDelegate::LinkClicked( - WindowOpenDisposition disposition) { - content::RecordAction(UserMetricsAction("BlockedPluginInfobar.LearnMore")); - return PluginInfoBarDelegate::LinkClicked(disposition); -} - - #if defined(ENABLE_PLUGIN_INSTALLATION) // OutdatedPluginInfoBarDelegate ---------------------------------------------- diff --git a/chrome/browser/plugins/plugin_infobar_delegates.h b/chrome/browser/plugins/plugin_infobar_delegates.h index e5ff211..d817c2c 100644 --- a/chrome/browser/plugins/plugin_infobar_delegates.h +++ b/chrome/browser/plugins/plugin_infobar_delegates.h @@ -44,37 +44,6 @@ class PluginInfoBarDelegate : public ConfirmInfoBarDelegate { DISALLOW_COPY_AND_ASSIGN(PluginInfoBarDelegate); }; -// Infobar that's shown when a plug-in requires user authorization to run. -class UnauthorizedPluginInfoBarDelegate : public PluginInfoBarDelegate { - public: - // Creates an unauthorized plugin infobar and delegate and adds the infobar to - // |infobar_service|. - static void Create(InfoBarService* infobar_service, - HostContentSettingsMap* content_settings, - const base::string16& name, - const std::string& identifier); - - private: - UnauthorizedPluginInfoBarDelegate(HostContentSettingsMap* content_settings, - const base::string16& name, - const std::string& identifier); - ~UnauthorizedPluginInfoBarDelegate() override; - - // PluginInfoBarDelegate: - base::string16 GetMessageText() const override; - base::string16 GetButtonLabel(InfoBarButton button) const override; - bool Accept() override; - bool Cancel() override; - void InfoBarDismissed() override; - bool LinkClicked(WindowOpenDisposition disposition) override; - std::string GetLearnMoreURL() const override; - - HostContentSettingsMap* content_settings_; - base::string16 name_; - - DISALLOW_COPY_AND_ASSIGN(UnauthorizedPluginInfoBarDelegate); -}; - #if defined(ENABLE_PLUGIN_INSTALLATION) // Infobar that's shown when a plug-in is out of date. class OutdatedPluginInfoBarDelegate : public PluginInfoBarDelegate, diff --git a/chrome/browser/plugins/plugin_observer.cc b/chrome/browser/plugins/plugin_observer.cc index dc5bf0e..69c5a46 100644 --- a/chrome/browser/plugins/plugin_observer.cc +++ b/chrome/browser/plugins/plugin_observer.cc @@ -335,8 +335,6 @@ bool PluginObserver::OnMessageReceived( IPC_BEGIN_MESSAGE_MAP(PluginObserver, message) IPC_MESSAGE_HANDLER(ChromeViewHostMsg_BlockedOutdatedPlugin, OnBlockedOutdatedPlugin) - IPC_MESSAGE_HANDLER(ChromeViewHostMsg_BlockedUnauthorizedPlugin, - OnBlockedUnauthorizedPlugin) IPC_MESSAGE_HANDLER(ChromeViewHostMsg_NPAPINotSupported, OnNPAPINotSupported) #if defined(ENABLE_PLUGIN_INSTALLATION) @@ -367,16 +365,6 @@ bool PluginObserver::OnMessageReceived(const IPC::Message& message) { return true; } -void PluginObserver::OnBlockedUnauthorizedPlugin( - const base::string16& name, - const std::string& identifier) { - UnauthorizedPluginInfoBarDelegate::Create( - InfoBarService::FromWebContents(web_contents()), - Profile::FromBrowserContext(web_contents()->GetBrowserContext())-> - GetHostContentSettingsMap(), - name, identifier); -} - void PluginObserver::OnBlockedOutdatedPlugin(int placeholder_id, const std::string& identifier) { #if defined(ENABLE_PLUGIN_INSTALLATION) diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi index 430201e..56f0bee 100644 --- a/chrome/chrome_tests.gypi +++ b/chrome/chrome_tests.gypi @@ -480,7 +480,6 @@ 'browser/notifications/login_state_notification_blocker_chromeos_browsertest.cc', 'browser/notifications/message_center_notifications_browsertest.cc', 'browser/password_manager/password_manager_browsertest.cc', - 'browser/plugins/npapi_infobar_browsertest.cc', 'browser/policy/cloud/cloud_policy_browsertest.cc', 'browser/policy/cloud/cloud_policy_manager_browsertest.cc', 'browser/policy/cloud/component_cloud_policy_browsertest.cc', @@ -489,7 +488,6 @@ 'browser/policy/cloud/test_request_interceptor.h', 'browser/policy/policy_browsertest.cc', 'browser/policy/policy_prefs_browsertest.cc', - 'browser/plugins/npapi_infobar_browsertest.cc', 'browser/prefetch/prefetch_browsertest.cc', 'browser/prefs/pref_functional_browsertest.cc', 'browser/prefs/pref_service_browsertest.cc', diff --git a/chrome/renderer/chrome_content_renderer_client.cc b/chrome/renderer/chrome_content_renderer_client.cc index d6673e5..c75b90c 100644 --- a/chrome/renderer/chrome_content_renderer_client.cc +++ b/chrome/renderer/chrome_content_renderer_client.cc @@ -876,19 +876,13 @@ WebPlugin* ChromeContentRendererClient::CreatePlugin( IDR_BLOCKED_PLUGIN_HTML, l10n_util::GetStringFUTF16(IDS_PLUGIN_NOT_AUTHORIZED, group_name)); placeholder->set_allow_loading(true); - // Check to see if old infobar should be displayed. - std::string trial_group = - base::FieldTrialList::FindFullName("UnauthorizedPluginInfoBar"); - if (plugin.type != content::WebPluginInfo::PLUGIN_TYPE_NPAPI || - trial_group == "Enabled") { + if (plugin.type != content::WebPluginInfo::PLUGIN_TYPE_NPAPI) { render_frame->Send(new ChromeViewHostMsg_BlockedUnauthorizedPlugin( render_frame->GetRoutingID(), group_name, identifier)); - } else { - // Send IPC for showing blocked plugins page action. - observer->DidBlockContentType(content_type, group_name); } + observer->DidBlockContentType(content_type, group_name); break; } case ChromeViewHostMsg_GetPluginInfo_Status::kClickToPlay: { diff --git a/tools/metrics/actions/actions.xml b/tools/metrics/actions/actions.xml index a4612bf..5585df9 100644 --- a/tools/metrics/actions/actions.xml +++ b/tools/metrics/actions/actions.xml @@ -1257,56 +1257,67 @@ should be able to be added at any place in this file. <action name="BlockedPluginInfobar.AllowThisTime"> <owner>Please list the metric's owners. Add more owner tags as needed.</owner> <description>Please enter the description of this user action.</description> + <obsolete>This infobar has been removed.</obsolete> </action> <action name="BlockedPluginInfobar.AlwaysAllow"> <owner>Please list the metric's owners. Add more owner tags as needed.</owner> <description>Please enter the description of this user action.</description> + <obsolete>This infobar has been removed.</obsolete> </action> <action name="BlockedPluginInfobar.Closed"> <owner>Please list the metric's owners. Add more owner tags as needed.</owner> <description>Please enter the description of this user action.</description> + <obsolete>This infobar has been removed.</obsolete> </action> <action name="BlockedPluginInfobar.Dismissed"> <owner>Please list the metric's owners. Add more owner tags as needed.</owner> <description>Please enter the description of this user action.</description> + <obsolete>This infobar has been removed.</obsolete> </action> <action name="BlockedPluginInfobar.LearnMore"> <owner>Please list the metric's owners. Add more owner tags as needed.</owner> <description>Please enter the description of this user action.</description> + <obsolete>This infobar has been removed.</obsolete> </action> <action name="BlockedPluginInfobar.Shown"> <owner>Please list the metric's owners. Add more owner tags as needed.</owner> <description>Please enter the description of this user action.</description> + <obsolete>This infobar has been removed.</obsolete> </action> <action name="BlockedPluginInfobar.Shown.Java"> <owner>Please list the metric's owners. Add more owner tags as needed.</owner> <description>Please enter the description of this user action.</description> + <obsolete>This infobar has been removed.</obsolete> </action> <action name="BlockedPluginInfobar.Shown.QuickTime"> <owner>Please list the metric's owners. Add more owner tags as needed.</owner> <description>Please enter the description of this user action.</description> + <obsolete>This infobar has been removed.</obsolete> </action> <action name="BlockedPluginInfobar.Shown.RealPlayer"> <owner>Please list the metric's owners. Add more owner tags as needed.</owner> <description>Please enter the description of this user action.</description> + <obsolete>This infobar has been removed.</obsolete> </action> <action name="BlockedPluginInfobar.Shown.Shockwave"> <owner>Please list the metric's owners. Add more owner tags as needed.</owner> <description>Please enter the description of this user action.</description> + <obsolete>This infobar has been removed.</obsolete> </action> <action name="BlockedPluginInfobar.Shown.WindowsMediaPlayer"> <owner>Please list the metric's owners. Add more owner tags as needed.</owner> <description>Please enter the description of this user action.</description> + <obsolete>This infobar has been removed.</obsolete> </action> <action name="Bold"> |