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

Side by Side Diff: extensions/common/feature_switch.cc

Issue 270153004: Introduce ActiveScriptController; track active extension scripts (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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
« no previous file with comments | « extensions/common/feature_switch.h ('k') | extensions/common/permissions/permissions_data.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "extensions/common/feature_switch.h" 5 #include "extensions/common/feature_switch.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/lazy_instance.h" 8 #include "base/lazy_instance.h"
9 #include "base/metrics/field_trial.h" 9 #include "base/metrics/field_trial.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 24 matching lines...) Expand all
35 #if defined(OS_WIN) 35 #if defined(OS_WIN)
36 FeatureSwitch::DEFAULT_ENABLED), 36 FeatureSwitch::DEFAULT_ENABLED),
37 #else 37 #else
38 FeatureSwitch::DEFAULT_DISABLED), 38 FeatureSwitch::DEFAULT_DISABLED),
39 #endif 39 #endif
40 error_console( 40 error_console(
41 switches::kErrorConsole, 41 switches::kErrorConsole,
42 FeatureSwitch::DEFAULT_DISABLED), 42 FeatureSwitch::DEFAULT_DISABLED),
43 enable_override_bookmarks_ui( 43 enable_override_bookmarks_ui(
44 switches::kEnableOverrideBookmarksUI, 44 switches::kEnableOverrideBookmarksUI,
45 FeatureSwitch::DEFAULT_DISABLED) {} 45 FeatureSwitch::DEFAULT_DISABLED),
46 scripts_require_action(switches::kScriptsRequireAction,
47 FeatureSwitch::DEFAULT_DISABLED) {}
46 48
47 // Enables extensions to be easily installed from sites other than the web 49 // Enables extensions to be easily installed from sites other than the web
48 // store. 50 // store.
49 FeatureSwitch easy_off_store_install; 51 FeatureSwitch easy_off_store_install;
50 52
51 FeatureSwitch force_dev_mode_highlighting; 53 FeatureSwitch force_dev_mode_highlighting;
52 FeatureSwitch global_commands; 54 FeatureSwitch global_commands;
53 55
54 // Should we prompt the user before allowing external extensions to install? 56 // Should we prompt the user before allowing external extensions to install?
55 // Default is yes. 57 // Default is yes.
56 FeatureSwitch prompt_for_external_extensions; 58 FeatureSwitch prompt_for_external_extensions;
57 59
58 FeatureSwitch error_console; 60 FeatureSwitch error_console;
59 FeatureSwitch enable_override_bookmarks_ui; 61 FeatureSwitch enable_override_bookmarks_ui;
62 FeatureSwitch scripts_require_action;
60 }; 63 };
61 64
62 base::LazyInstance<CommonSwitches> g_common_switches = 65 base::LazyInstance<CommonSwitches> g_common_switches =
63 LAZY_INSTANCE_INITIALIZER; 66 LAZY_INSTANCE_INITIALIZER;
64 67
65 } // namespace 68 } // namespace
66 69
67 FeatureSwitch* FeatureSwitch::force_dev_mode_highlighting() { 70 FeatureSwitch* FeatureSwitch::force_dev_mode_highlighting() {
68 return &g_common_switches.Get().force_dev_mode_highlighting; 71 return &g_common_switches.Get().force_dev_mode_highlighting;
69 } 72 }
70 FeatureSwitch* FeatureSwitch::easy_off_store_install() { 73 FeatureSwitch* FeatureSwitch::easy_off_store_install() {
71 return &g_common_switches.Get().easy_off_store_install; 74 return &g_common_switches.Get().easy_off_store_install;
72 } 75 }
73 FeatureSwitch* FeatureSwitch::global_commands() { 76 FeatureSwitch* FeatureSwitch::global_commands() {
74 return &g_common_switches.Get().global_commands; 77 return &g_common_switches.Get().global_commands;
75 } 78 }
76 FeatureSwitch* FeatureSwitch::prompt_for_external_extensions() { 79 FeatureSwitch* FeatureSwitch::prompt_for_external_extensions() {
77 return &g_common_switches.Get().prompt_for_external_extensions; 80 return &g_common_switches.Get().prompt_for_external_extensions;
78 } 81 }
79 FeatureSwitch* FeatureSwitch::error_console() { 82 FeatureSwitch* FeatureSwitch::error_console() {
80 return &g_common_switches.Get().error_console; 83 return &g_common_switches.Get().error_console;
81 } 84 }
82 FeatureSwitch* FeatureSwitch::enable_override_bookmarks_ui() { 85 FeatureSwitch* FeatureSwitch::enable_override_bookmarks_ui() {
83 return &g_common_switches.Get().enable_override_bookmarks_ui; 86 return &g_common_switches.Get().enable_override_bookmarks_ui;
84 } 87 }
85 88
89 FeatureSwitch* FeatureSwitch::scripts_require_action() {
90 return &g_common_switches.Get().scripts_require_action;
91 }
92
86 FeatureSwitch::ScopedOverride::ScopedOverride(FeatureSwitch* feature, 93 FeatureSwitch::ScopedOverride::ScopedOverride(FeatureSwitch* feature,
87 bool override_value) 94 bool override_value)
88 : feature_(feature), 95 : feature_(feature),
89 previous_value_(feature->GetOverrideValue()) { 96 previous_value_(feature->GetOverrideValue()) {
90 feature_->SetOverrideValue( 97 feature_->SetOverrideValue(
91 override_value ? OVERRIDE_ENABLED : OVERRIDE_DISABLED); 98 override_value ? OVERRIDE_ENABLED : OVERRIDE_DISABLED);
92 } 99 }
93 100
94 FeatureSwitch::ScopedOverride::~ScopedOverride() { 101 FeatureSwitch::ScopedOverride::~ScopedOverride() {
95 feature_->SetOverrideValue(previous_value_); 102 feature_->SetOverrideValue(previous_value_);
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 160
154 void FeatureSwitch::SetOverrideValue(OverrideValue override_value) { 161 void FeatureSwitch::SetOverrideValue(OverrideValue override_value) {
155 override_value_ = override_value; 162 override_value_ = override_value;
156 } 163 }
157 164
158 FeatureSwitch::OverrideValue FeatureSwitch::GetOverrideValue() const { 165 FeatureSwitch::OverrideValue FeatureSwitch::GetOverrideValue() const {
159 return override_value_; 166 return override_value_;
160 } 167 }
161 168
162 } // namespace extensions 169 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/common/feature_switch.h ('k') | extensions/common/permissions/permissions_data.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698