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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/common/extensions/extension_switch_utils.h" 5 #include "chrome/common/extensions/extension_switch_utils.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/logging.h"
8 #include "chrome/common/chrome_switches.h" 9 #include "chrome/common/chrome_switches.h"
9 10
10 namespace extensions { 11 namespace extensions {
11 12
12 namespace switch_utils { 13 namespace switch_utils {
13 14
14 bool IsEasyOffStoreInstallEnabled() { 15 bool IsEasyOffStoreInstallEnabled() {
15 // Disabling easy off-store installation is not yet implemented for Aura. Not 16 // Disabling easy off-store installation is not yet implemented for Aura. Not
16 // sure what the Aura equivalent for this UI is. 17 // sure what the Aura equivalent for this UI is.
17 #if defined(USE_AURA) 18 #if defined(USE_AURA)
18 return true; 19 return true;
19 #else 20 #else
20 return CommandLine::ForCurrentProcess()->HasSwitch( 21 return CommandLine::ForCurrentProcess()->HasSwitch(
21 switches::kEnableEasyOffStoreExtensionInstall); 22 switches::kEnableEasyOffStoreExtensionInstall);
22 #endif 23 #endif
23 } 24 }
24 25
26 enum SwitchState {
27 USE_COMMAND_LINE,
28 FORCE_ENABLE,
29 FORCE_DISABLE
30 };
31 static SwitchState action_box_switch_state = USE_COMMAND_LINE;
25 bool IsActionBoxEnabled() { 32 bool IsActionBoxEnabled() {
26 return CommandLine::ForCurrentProcess()->HasSwitch( 33 switch (action_box_switch_state) {
27 switches::kEnableActionBox); 34 case USE_COMMAND_LINE:
35 return CommandLine::ForCurrentProcess()->HasSwitch(
36 switches::kEnableActionBox);
37 case FORCE_ENABLE:
38 return true;
39 case FORCE_DISABLE:
40 return false;
41 }
42 NOTREACHED();
43 return false;
44 }
45
46 ScopedSetActionBoxForTest::ScopedSetActionBoxForTest(EnabledState state) {
47 CHECK(action_box_switch_state == USE_COMMAND_LINE)
48 << "Can't nest ScopedSetActionBoxForTest instances.";
49 switch (state) {
50 case ENABLED:
51 action_box_switch_state = FORCE_ENABLE;
52 break;
53 case DISABLED:
54 action_box_switch_state = FORCE_DISABLE;
55 break;
56 }
57 }
58 ScopedSetActionBoxForTest::~ScopedSetActionBoxForTest() {
59 action_box_switch_state = USE_COMMAND_LINE;
28 } 60 }
29 61
30 } // switch_utils 62 } // switch_utils
31 63
32 } // extensions 64 } // extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698