| Index: chrome/common/extensions/extension_switch_utils.cc
|
| diff --git a/chrome/common/extensions/extension_switch_utils.cc b/chrome/common/extensions/extension_switch_utils.cc
|
| index 8b41231917b059c0acb68c24542dda745838f411..42b27bb7d7388fba5a25450e502b21155c0c9947 100644
|
| --- a/chrome/common/extensions/extension_switch_utils.cc
|
| +++ b/chrome/common/extensions/extension_switch_utils.cc
|
| @@ -5,6 +5,7 @@
|
| #include "chrome/common/extensions/extension_switch_utils.h"
|
|
|
| #include "base/command_line.h"
|
| +#include "base/logging.h"
|
| #include "chrome/common/chrome_switches.h"
|
|
|
| namespace extensions {
|
| @@ -27,9 +28,42 @@ bool IsActionBoxEnabled() {
|
| switches::kEnableActionBox);
|
| }
|
|
|
| +enum SwitchState {
|
| + USE_COMMAND_LINE,
|
| + FORCE_ENABLE,
|
| + FORCE_DISABLE
|
| +};
|
| +static SwitchState script_badge_switch_state = USE_COMMAND_LINE;
|
| +
|
| +
|
| bool AreScriptBadgesEnabled() {
|
| - return CommandLine::ForCurrentProcess()->HasSwitch(
|
| - switches::kEnableScriptBadges);
|
| + switch (script_badge_switch_state) {
|
| + case USE_COMMAND_LINE:
|
| + return CommandLine::ForCurrentProcess()->HasSwitch(
|
| + switches::kEnableScriptBadges);
|
| + case FORCE_ENABLE:
|
| + return true;
|
| + case FORCE_DISABLE:
|
| + return false;
|
| + }
|
| + NOTREACHED();
|
| + return false;
|
| +}
|
| +
|
| +ScopedSetScriptBadgeForTest::ScopedSetScriptBadgeForTest(EnabledState state) {
|
| + CHECK(script_badge_switch_state == USE_COMMAND_LINE)
|
| + << "Can't nest ScopedSetScriptBadgeForTest instances.";
|
| + switch (state) {
|
| + case ENABLED:
|
| + script_badge_switch_state = FORCE_ENABLE;
|
| + break;
|
| + case DISABLED:
|
| + script_badge_switch_state = FORCE_DISABLE;
|
| + break;
|
| + }
|
| +}
|
| +ScopedSetScriptBadgeForTest::~ScopedSetScriptBadgeForTest() {
|
| + script_badge_switch_state = USE_COMMAND_LINE;
|
| }
|
|
|
| } // switch_utils
|
|
|