diff options
author | gbillock@chromium.org <gbillock@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-01-23 23:43:45 +0000 |
---|---|---|
committer | gbillock@chromium.org <gbillock@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-01-23 23:43:45 +0000 |
commit | 24ad587865388d7f861187fca06c81234f5bff05 (patch) | |
tree | d367c443ef34bb61c78c1f07bfd3337b21c3d411 | |
parent | 43444d032f7d3eca247149866cde3b811c8c3c06 (diff) | |
download | chromium_src-24ad587865388d7f861187fca06c81234f5bff05.zip chromium_src-24ad587865388d7f861187fca06c81234f5bff05.tar.gz chromium_src-24ad587865388d7f861187fca06c81234f5bff05.tar.bz2 |
[WebsiteSettings] Add a flag for using bubbles for permissions requests.
R=leng@chromium.org, markusheintz@chromium.org
BUG=332115
Review URL: https://codereview.chromium.org/141003017
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@246729 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/app/generated_resources.grd | 6 | ||||
-rw-r--r-- | chrome/browser/about_flags.cc | 9 | ||||
-rw-r--r-- | chrome/browser/ui/website_settings/permission_bubble_manager.cc | 8 | ||||
-rw-r--r-- | chrome/browser/ui/website_settings/permission_bubble_manager.h | 3 | ||||
-rw-r--r-- | chrome/browser/ui/website_settings/permission_bubble_manager_unittest.cc | 9 | ||||
-rw-r--r-- | chrome/common/chrome_switches.cc | 3 | ||||
-rw-r--r-- | chrome/common/chrome_switches.h | 1 |
7 files changed, 39 insertions, 0 deletions
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd index adb8cbc..aa71607 100644 --- a/chrome/app/generated_resources.grd +++ b/chrome/app/generated_resources.grd @@ -6860,6 +6860,12 @@ Keep your key file in a safe place. You will need it to create new versions of y <message name="IDS_FLAGS_EMBED_FLASH_FULLSCREEN_DESCRIPTION" desc="Description for the about:flags option to embed flash fullscreen within the browser tab."> Embeds Flash fullscreen windows within the tab contents area and fullscreens the browser window. This makes the Flash fullscreen user experience consistent with all other browser fullscreen modes. When disabled, Flash fullscreen will open in a separate fullscreened window. </message> + <message name="IDS_FLAGS_ENABLE_PERMISSIONS_BUBBLES_NAME" desc="Title for the flag to enable showing permissions requests in bubbles."> + Use Bubbles for Permission Requests + </message> + <message name="IDS_FLAGS_ENABLE_PERMISSIONS_BUBBLES_DESCRIPTION" desc="Description for the flag to enable showing permissions requests in bubbles."> + Show content permission requests (e.g. notifications, quota, camera use, microphone use) in bubbles instead of info bars. + </message> <!-- Crashes --> <message name="IDS_CRASHES_TITLE" desc="Title for the chrome://crashes page."> diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc index 8874272..ee1f6ba 100644 --- a/chrome/browser/about_flags.cc +++ b/chrome/browser/about_flags.cc @@ -1987,6 +1987,15 @@ const Experiment kExperiments[] = { SINGLE_VALUE_TYPE(switches::kUseSystemTitleBar) }, #endif +#if defined(USE_AURA) || defined(OS_WIN) + { + "enable-permissions-bubbles", + IDS_FLAGS_ENABLE_PERMISSIONS_BUBBLES_NAME, + IDS_FLAGS_ENABLE_PERMISSIONS_BUBBLES_DESCRIPTION, + kOsCrOS | kOsWin, + SINGLE_VALUE_TYPE(switches::kEnablePermissionsBubbles) + }, +#endif }; const Experiment* experiments = kExperiments; diff --git a/chrome/browser/ui/website_settings/permission_bubble_manager.cc b/chrome/browser/ui/website_settings/permission_bubble_manager.cc index 17d1583..6143558 100644 --- a/chrome/browser/ui/website_settings/permission_bubble_manager.cc +++ b/chrome/browser/ui/website_settings/permission_bubble_manager.cc @@ -4,10 +4,18 @@ #include "chrome/browser/ui/website_settings/permission_bubble_manager.h" +#include "base/command_line.h" #include "chrome/browser/ui/website_settings/permission_bubble_delegate.h" +#include "chrome/common/chrome_switches.h" DEFINE_WEB_CONTENTS_USER_DATA_KEY(PermissionBubbleManager); +// static +bool PermissionBubbleManager::Enabled() { + return CommandLine::ForCurrentProcess()->HasSwitch( + switches::kEnablePermissionsBubbles); +} + void PermissionBubbleManager::AddPermissionBubbleDelegate( PermissionBubbleDelegate* delegate) { // Don't re-add existing delegate. diff --git a/chrome/browser/ui/website_settings/permission_bubble_manager.h b/chrome/browser/ui/website_settings/permission_bubble_manager.h index d0987d3..16fa669 100644 --- a/chrome/browser/ui/website_settings/permission_bubble_manager.h +++ b/chrome/browser/ui/website_settings/permission_bubble_manager.h @@ -29,6 +29,9 @@ class PermissionBubbleManager public content::WebContentsUserData<PermissionBubbleManager>, public PermissionBubbleView::Delegate { public: + // Return the flag-driven enabled state of permissions bubbles. + static bool Enabled(); + virtual ~PermissionBubbleManager(); // Add a new consumer delegate to the permission bubble. Ownership of the diff --git a/chrome/browser/ui/website_settings/permission_bubble_manager_unittest.cc b/chrome/browser/ui/website_settings/permission_bubble_manager_unittest.cc index 4ac8c77..9a5b615 100644 --- a/chrome/browser/ui/website_settings/permission_bubble_manager_unittest.cc +++ b/chrome/browser/ui/website_settings/permission_bubble_manager_unittest.cc @@ -2,10 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "base/command_line.h" #include "base/strings/utf_string_conversions.h" #include "chrome/browser/ui/website_settings/permission_bubble_delegate.h" #include "chrome/browser/ui/website_settings/permission_bubble_manager.h" #include "chrome/browser/ui/website_settings/permission_bubble_view.h" +#include "chrome/common/chrome_switches.h" #include "testing/gtest/include/gtest/gtest.h" namespace { @@ -116,6 +118,13 @@ PermissionBubbleManagerTest::PermissionBubbleManagerTest() : manager_(new PermissionBubbleManager(NULL)) { } +TEST_F(PermissionBubbleManagerTest, TestFlag) { + EXPECT_FALSE(PermissionBubbleManager::Enabled()); + CommandLine::ForCurrentProcess()->AppendSwitch( + switches::kEnablePermissionsBubbles); + EXPECT_TRUE(PermissionBubbleManager::Enabled()); +} + TEST_F(PermissionBubbleManagerTest, SingleRequest) { manager_->AddPermissionBubbleDelegate(&delegate1_); manager_->SetView(&view_); diff --git a/chrome/common/chrome_switches.cc b/chrome/common/chrome_switches.cc index 9dbb372..b10c26c 100644 --- a/chrome/common/chrome_switches.cc +++ b/chrome/common/chrome_switches.cc @@ -1627,6 +1627,9 @@ const char kRelauncherProcess[] = "relauncher"; const char kUseMockKeychain[] = "use-mock-keychain"; #endif +// Use bubbles for content permissions requests instead of infobars. +const char kEnablePermissionsBubbles[] = "enable-permissions-bubbles"; + #if defined(OS_WIN) // Force-enables the profile shortcut manager. This is needed for tests since // they use a custom-user-data-dir which disables this. diff --git a/chrome/common/chrome_switches.h b/chrome/common/chrome_switches.h index b3d1208..58a011c 100644 --- a/chrome/common/chrome_switches.h +++ b/chrome/common/chrome_switches.h @@ -202,6 +202,7 @@ extern const char kEnableOriginChipTrailingLocationBar[]; extern const char kEnableOriginChipLeadingMenuButton[]; extern const char kEnablePanels[]; extern const char kEnablePasswordAutofillPublicSuffixDomainMatching[]; +extern const char kEnablePermissionsBubbles[]; extern const char kEnableQueryExtraction[]; extern const char kEnablePrivetStorage[]; extern const char kEnableProfiling[]; |