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

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

Issue 2451573003: [Media Router] Update Media Router flags post-launch. (Closed)
Patch Set: Created 4 years, 1 month 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
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"
11 #include "build/build_config.h" 11 #include "build/build_config.h"
12 #include "extensions/common/switches.h" 12 #include "extensions/common/switches.h"
13 13
14 namespace extensions { 14 namespace extensions {
15 15
16 namespace { 16 namespace {
17 17
18 // The switch media-router is defined in chrome/common/chrome_switches.cc, but 18 // The switch load-media-router-component-extension is defined in
19 // we can't depend on chrome here. 19 // chrome/common/chrome_switches.cc, but we can't depend on chrome here.
20 const char kMediaRouterFlag[] = "media-router"; 20 const char kLoadMediaRouterComponentExtensionFlag[] =
21 "load-media-router-component-extension";
21 22
22 const char kEnableMediaRouterExperiment[] = "EnableMediaRouter";
23 const char kExtensionActionRedesignExperiment[] = "ExtensionActionRedesign"; 23 const char kExtensionActionRedesignExperiment[] = "ExtensionActionRedesign";
24 24
25 class CommonSwitches { 25 class CommonSwitches {
26 public: 26 public:
27 CommonSwitches() 27 CommonSwitches()
28 : easy_off_store_install(nullptr, FeatureSwitch::DEFAULT_DISABLED), 28 : easy_off_store_install(nullptr, FeatureSwitch::DEFAULT_DISABLED),
29 force_dev_mode_highlighting(switches::kForceDevModeHighlighting, 29 force_dev_mode_highlighting(switches::kForceDevModeHighlighting,
30 FeatureSwitch::DEFAULT_DISABLED), 30 FeatureSwitch::DEFAULT_DISABLED),
31 prompt_for_external_extensions( 31 prompt_for_external_extensions(
32 #if defined(CHROMIUM_BUILD) 32 #if defined(CHROMIUM_BUILD)
(...skipping 11 matching lines...) Expand all
44 FeatureSwitch::DEFAULT_DISABLED), 44 FeatureSwitch::DEFAULT_DISABLED),
45 extension_action_redesign(switches::kExtensionActionRedesign, 45 extension_action_redesign(switches::kExtensionActionRedesign,
46 kExtensionActionRedesignExperiment, 46 kExtensionActionRedesignExperiment,
47 FeatureSwitch::DEFAULT_ENABLED), 47 FeatureSwitch::DEFAULT_ENABLED),
48 scripts_require_action(switches::kScriptsRequireAction, 48 scripts_require_action(switches::kScriptsRequireAction,
49 FeatureSwitch::DEFAULT_DISABLED), 49 FeatureSwitch::DEFAULT_DISABLED),
50 embedded_extension_options(switches::kEmbeddedExtensionOptions, 50 embedded_extension_options(switches::kEmbeddedExtensionOptions,
51 FeatureSwitch::DEFAULT_DISABLED), 51 FeatureSwitch::DEFAULT_DISABLED),
52 trace_app_source(switches::kTraceAppSource, 52 trace_app_source(switches::kTraceAppSource,
53 FeatureSwitch::DEFAULT_ENABLED), 53 FeatureSwitch::DEFAULT_ENABLED),
54 media_router(kMediaRouterFlag, 54 load_media_router_component_extension(
55 kEnableMediaRouterExperiment, 55 kLoadMediaRouterComponentExtensionFlag,
Devlin 2016/10/25 20:38:02 Do we want chrome users to be able to disable this
56 FeatureSwitch::DEFAULT_ENABLED) { 56 #if defined(GOOGLE_CHROME_BUILD)
57 FeatureSwitch::DEFAULT_ENABLED)
58 #else
59 FeatureSwitch::DEFAULT_DISABLED)
60 #endif // defined(GOOGLE_CHROME_BUILD)
61 {
57 } 62 }
58 63
59 // Enables extensions to be easily installed from sites other than the web 64 // Enables extensions to be easily installed from sites other than the web
60 // store. 65 // store.
61 FeatureSwitch easy_off_store_install; 66 FeatureSwitch easy_off_store_install;
62 67
63 FeatureSwitch force_dev_mode_highlighting; 68 FeatureSwitch force_dev_mode_highlighting;
64 69
65 // Should we prompt the user before allowing external extensions to install? 70 // Should we prompt the user before allowing external extensions to install?
66 // Default is yes. 71 // Default is yes.
67 FeatureSwitch prompt_for_external_extensions; 72 FeatureSwitch prompt_for_external_extensions;
68 73
69 FeatureSwitch error_console; 74 FeatureSwitch error_console;
70 FeatureSwitch enable_override_bookmarks_ui; 75 FeatureSwitch enable_override_bookmarks_ui;
71 FeatureSwitch extension_action_redesign; 76 FeatureSwitch extension_action_redesign;
72 FeatureSwitch scripts_require_action; 77 FeatureSwitch scripts_require_action;
73 FeatureSwitch embedded_extension_options; 78 FeatureSwitch embedded_extension_options;
74 FeatureSwitch trace_app_source; 79 FeatureSwitch trace_app_source;
75 FeatureSwitch media_router; 80 FeatureSwitch load_media_router_component_extension;
76 }; 81 };
77 82
78 base::LazyInstance<CommonSwitches> g_common_switches = 83 base::LazyInstance<CommonSwitches> g_common_switches =
79 LAZY_INSTANCE_INITIALIZER; 84 LAZY_INSTANCE_INITIALIZER;
80 85
81 } // namespace 86 } // namespace
82 87
83 FeatureSwitch* FeatureSwitch::force_dev_mode_highlighting() { 88 FeatureSwitch* FeatureSwitch::force_dev_mode_highlighting() {
84 return &g_common_switches.Get().force_dev_mode_highlighting; 89 return &g_common_switches.Get().force_dev_mode_highlighting;
85 } 90 }
(...skipping 14 matching lines...) Expand all
100 } 105 }
101 FeatureSwitch* FeatureSwitch::scripts_require_action() { 106 FeatureSwitch* FeatureSwitch::scripts_require_action() {
102 return &g_common_switches.Get().scripts_require_action; 107 return &g_common_switches.Get().scripts_require_action;
103 } 108 }
104 FeatureSwitch* FeatureSwitch::embedded_extension_options() { 109 FeatureSwitch* FeatureSwitch::embedded_extension_options() {
105 return &g_common_switches.Get().embedded_extension_options; 110 return &g_common_switches.Get().embedded_extension_options;
106 } 111 }
107 FeatureSwitch* FeatureSwitch::trace_app_source() { 112 FeatureSwitch* FeatureSwitch::trace_app_source() {
108 return &g_common_switches.Get().trace_app_source; 113 return &g_common_switches.Get().trace_app_source;
109 } 114 }
110 FeatureSwitch* FeatureSwitch::media_router() { 115 FeatureSwitch* FeatureSwitch::load_media_router_component_extension() {
111 return &g_common_switches.Get().media_router; 116 return &g_common_switches.Get().load_media_router_component_extension;
112 } 117 }
113 118
114 FeatureSwitch::ScopedOverride::ScopedOverride(FeatureSwitch* feature, 119 FeatureSwitch::ScopedOverride::ScopedOverride(FeatureSwitch* feature,
115 bool override_value) 120 bool override_value)
116 : feature_(feature), 121 : feature_(feature),
117 previous_value_(feature->GetOverrideValue()) { 122 previous_value_(feature->GetOverrideValue()) {
118 feature_->SetOverrideValue( 123 feature_->SetOverrideValue(
119 override_value ? OVERRIDE_ENABLED : OVERRIDE_DISABLED); 124 override_value ? OVERRIDE_ENABLED : OVERRIDE_DISABLED);
120 } 125 }
121 126
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 207
203 void FeatureSwitch::SetOverrideValue(OverrideValue override_value) { 208 void FeatureSwitch::SetOverrideValue(OverrideValue override_value) {
204 override_value_ = override_value; 209 override_value_ = override_value;
205 } 210 }
206 211
207 FeatureSwitch::OverrideValue FeatureSwitch::GetOverrideValue() const { 212 FeatureSwitch::OverrideValue FeatureSwitch::GetOverrideValue() const {
208 return override_value_; 213 return override_value_;
209 } 214 }
210 215
211 } // namespace extensions 216 } // namespace extensions
OLDNEW
« chrome/browser/media/router/media_router_feature.cc ('K') | « extensions/common/feature_switch.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698