| Index: chrome/browser/extensions/dev_mode_bubble_controller.cc
|
| diff --git a/chrome/browser/extensions/dev_mode_bubble_controller.cc b/chrome/browser/extensions/dev_mode_bubble_controller.cc
|
| index d6914e503a83524f100fc598604e207161009ae6..8457fd3fd18f979b4bcd2ae756c2fadbb4bcec30 100644
|
| --- a/chrome/browser/extensions/dev_mode_bubble_controller.cc
|
| +++ b/chrome/browser/extensions/dev_mode_bubble_controller.cc
|
| @@ -4,7 +4,9 @@
|
|
|
| #include "chrome/browser/extensions/dev_mode_bubble_controller.h"
|
|
|
| +#include "base/command_line.h"
|
| #include "base/lazy_instance.h"
|
| +#include "base/metrics/field_trial.h"
|
| #include "base/metrics/histogram.h"
|
| #include "chrome/browser/extensions/extension_action_manager.h"
|
| #include "chrome/browser/extensions/extension_message_bubble.h"
|
| @@ -12,6 +14,7 @@
|
| #include "chrome/browser/extensions/extension_toolbar_model.h"
|
| #include "chrome/browser/profiles/profile.h"
|
| #include "chrome/browser/ui/browser.h"
|
| +#include "chrome/common/chrome_switches.h"
|
| #include "chrome/common/chrome_version_info.h"
|
| #include "chrome/common/url_constants.h"
|
| #include "chrome/grit/generated_resources.h"
|
| @@ -28,6 +31,27 @@ namespace {
|
| base::LazyInstance<std::set<Profile*> > g_shown_for_profiles =
|
| LAZY_INSTANCE_INITIALIZER;
|
|
|
| +const char kEnableDevModeWarningExperimentName[] =
|
| + "ExtensionDeveloperModeWarning";
|
| +
|
| +bool ShouldEnableBubble() {
|
| + if (FeatureSwitch::force_dev_mode_highlighting()->IsEnabled())
|
| + return true;
|
| +
|
| + // Don't allow turning it off via command line.
|
| + base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
|
| + if (command_line->HasSwitch(switches::kForceFieldTrials)) {
|
| + std::string forced_trials =
|
| + command_line->GetSwitchValueASCII(switches::kForceFieldTrials);
|
| + if (forced_trials.find(kEnableDevModeWarningExperimentName))
|
| + return true;
|
| + }
|
| +
|
| + const std::string group = base::FieldTrialList::FindFullName(
|
| + kEnableDevModeWarningExperimentName);
|
| + return group == "Enabled";
|
| +}
|
| +
|
| ////////////////////////////////////////////////////////////////////////////////
|
| // DevModeBubbleDelegate
|
|
|
| @@ -77,7 +101,8 @@ bool DevModeBubbleDelegate::ShouldIncludeExtension(
|
| const Extension* extension = service_->GetExtensionById(extension_id, false);
|
| if (!extension)
|
| return false;
|
| - return DevModeBubbleController::IsDevModeExtension(extension);
|
| + return (extension->location() == Manifest::UNPACKED ||
|
| + extension->location() == Manifest::COMMAND_LINE);
|
| }
|
|
|
| void DevModeBubbleDelegate::AcknowledgeExtension(
|
| @@ -154,17 +179,6 @@ void DevModeBubbleController::ClearProfileListForTesting() {
|
| g_shown_for_profiles.Get().clear();
|
| }
|
|
|
| -// static
|
| -bool DevModeBubbleController::IsDevModeExtension(
|
| - const Extension* extension) {
|
| - if (!FeatureSwitch::force_dev_mode_highlighting()->IsEnabled()) {
|
| - if (chrome::VersionInfo::GetChannel() < chrome::VersionInfo::CHANNEL_BETA)
|
| - return false;
|
| - }
|
| - return extension->location() == Manifest::UNPACKED ||
|
| - extension->location() == Manifest::COMMAND_LINE;
|
| -}
|
| -
|
| DevModeBubbleController::DevModeBubbleController(Profile* profile)
|
| : ExtensionMessageBubbleController(new DevModeBubbleDelegate(profile),
|
| profile),
|
| @@ -174,6 +188,9 @@ DevModeBubbleController::~DevModeBubbleController() {
|
| }
|
|
|
| bool DevModeBubbleController::ShouldShow() {
|
| + if (!ShouldEnableBubble())
|
| + return false;
|
| +
|
| return !g_shown_for_profiles.Get().count(profile_->GetOriginalProfile()) &&
|
| !GetExtensionList().empty();
|
| }
|
|
|