| 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 6f9d00cf33f40f80ec62abd95456e5bbaf1468fa..7a8dedf7afea2b29c3cafdff17921821237c8256 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 {
|
| @@ -22,9 +23,40 @@ bool IsEasyOffStoreInstallEnabled() {
|
| #endif
|
| }
|
|
|
| +enum SwitchState {
|
| + USE_COMMAND_LINE,
|
| + FORCE_ENABLE,
|
| + FORCE_DISABLE
|
| +};
|
| +static SwitchState action_box_switch_state = USE_COMMAND_LINE;
|
| bool IsActionBoxEnabled() {
|
| - return CommandLine::ForCurrentProcess()->HasSwitch(
|
| - switches::kEnableActionBox);
|
| + switch (action_box_switch_state) {
|
| + case USE_COMMAND_LINE:
|
| + return CommandLine::ForCurrentProcess()->HasSwitch(
|
| + switches::kEnableActionBox);
|
| + case FORCE_ENABLE:
|
| + return true;
|
| + case FORCE_DISABLE:
|
| + return false;
|
| + }
|
| + NOTREACHED();
|
| + return false;
|
| +}
|
| +
|
| +ScopedSetActionBoxForTest::ScopedSetActionBoxForTest(EnabledState state) {
|
| + CHECK(action_box_switch_state == USE_COMMAND_LINE)
|
| + << "Can't nest ScopedSetActionBoxForTest instances.";
|
| + switch (state) {
|
| + case ENABLED:
|
| + action_box_switch_state = FORCE_ENABLE;
|
| + break;
|
| + case DISABLED:
|
| + action_box_switch_state = FORCE_DISABLE;
|
| + break;
|
| + }
|
| +}
|
| +ScopedSetActionBoxForTest::~ScopedSetActionBoxForTest() {
|
| + action_box_switch_state = USE_COMMAND_LINE;
|
| }
|
|
|
| } // switch_utils
|
|
|