Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9293)

Unified Diff: chrome/common/extensions/extension_switch_utils.cc

Issue 10565017: Parse the script_badge manifest section. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698