OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/browser/ui/extensions/extension_message_bubble_factory.h" | 5 #include "chrome/browser/ui/extensions/extension_message_bubble_factory.h" |
6 | 6 |
7 #include "base/base_switches.h" | 7 #include "base/base_switches.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
10 #include "base/metrics/field_trial.h" | 10 #include "base/metrics/field_trial.h" |
11 #include "build/build_config.h" | 11 #include "build/build_config.h" |
12 #include "chrome/browser/extensions/dev_mode_bubble_delegate.h" | 12 #include "chrome/browser/extensions/dev_mode_bubble_delegate.h" |
13 #include "chrome/browser/extensions/extension_message_bubble_controller.h" | 13 #include "chrome/browser/extensions/extension_message_bubble_controller.h" |
14 #include "chrome/browser/extensions/install_verifier.h" | 14 #include "chrome/browser/extensions/install_verifier.h" |
15 #include "chrome/browser/extensions/proxy_overridden_bubble_delegate.h" | 15 #include "chrome/browser/extensions/proxy_overridden_bubble_delegate.h" |
16 #include "chrome/browser/extensions/settings_api_bubble_delegate.h" | 16 #include "chrome/browser/extensions/settings_api_bubble_delegate.h" |
17 #include "chrome/browser/extensions/settings_api_helpers.h" | 17 #include "chrome/browser/extensions/settings_api_helpers.h" |
18 #include "chrome/browser/extensions/suspicious_extension_bubble_delegate.h" | 18 #include "chrome/browser/extensions/suspicious_extension_bubble_delegate.h" |
19 #include "chrome/browser/profiles/profile.h" | 19 #include "chrome/browser/profiles/profile.h" |
20 #include "chrome/browser/ui/browser.h" | 20 #include "chrome/browser/ui/browser.h" |
21 #include "chrome/browser/ui/startup/startup_browser_creator.h" | 21 #include "chrome/browser/ui/startup/startup_browser_creator.h" |
22 #include "chrome/common/channel_info.h" | 22 #include "chrome/common/channel_info.h" |
| 23 #include "chrome/common/chrome_switches.h" |
23 #include "components/version_info/version_info.h" | 24 #include "components/version_info/version_info.h" |
24 #include "extensions/common/feature_switch.h" | 25 #include "extensions/common/feature_switch.h" |
25 | 26 |
26 namespace { | 27 namespace { |
27 | 28 |
28 // A map of all profiles evaluated, so we can tell if it's the initial check. | 29 // A map of all profiles evaluated, so we can tell if it's the initial check. |
29 // TODO(devlin): It would be nice to coalesce all the "profiles evaluated" maps | 30 // TODO(devlin): It would be nice to coalesce all the "profiles evaluated" maps |
30 // that are in the different bubble controllers. | 31 // that are in the different bubble controllers. |
31 base::LazyInstance<std::set<Profile*> > g_profiles_evaluated = | 32 base::LazyInstance<std::set<Profile*> > g_profiles_evaluated = |
32 LAZY_INSTANCE_INITIALIZER; | 33 LAZY_INSTANCE_INITIALIZER; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 return g_override_for_testing == | 78 return g_override_for_testing == |
78 ExtensionMessageBubbleFactory::OVERRIDE_ENABLED || | 79 ExtensionMessageBubbleFactory::OVERRIDE_ENABLED || |
79 IsExperimentEnabled(kEnableProxyWarningExperimentName); | 80 IsExperimentEnabled(kEnableProxyWarningExperimentName); |
80 #endif | 81 #endif |
81 } | 82 } |
82 | 83 |
83 bool EnableDevModeBubble() { | 84 bool EnableDevModeBubble() { |
84 if (extensions::FeatureSwitch::force_dev_mode_highlighting()->IsEnabled()) | 85 if (extensions::FeatureSwitch::force_dev_mode_highlighting()->IsEnabled()) |
85 return true; | 86 return true; |
86 | 87 |
| 88 // If an automated test is controlling the browser, we don't show the dev mode |
| 89 // bubble because it interferes with focus. This isn't a security concern |
| 90 // because we'll instead show an (even scarier) infobar. See also |
| 91 // AutomationInfoBarDelegate. |
| 92 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
| 93 if (command_line->HasSwitch(switches::kEnableAutomation)) |
| 94 return false; |
| 95 |
87 #if defined(OS_WIN) | 96 #if defined(OS_WIN) |
88 if (chrome::GetChannel() >= version_info::Channel::BETA) | 97 if (chrome::GetChannel() >= version_info::Channel::BETA) |
89 return true; | 98 return true; |
90 #endif | 99 #endif |
91 | 100 |
92 return g_override_for_testing == | 101 return g_override_for_testing == |
93 ExtensionMessageBubbleFactory::OVERRIDE_ENABLED || | 102 ExtensionMessageBubbleFactory::OVERRIDE_ENABLED || |
94 IsExperimentEnabled(kEnableDevModeWarningExperimentName); | 103 IsExperimentEnabled(kEnableDevModeWarningExperimentName); |
95 } | 104 } |
96 | 105 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 | 178 |
170 controller.reset(); | 179 controller.reset(); |
171 return controller; | 180 return controller; |
172 } | 181 } |
173 | 182 |
174 // static | 183 // static |
175 void ExtensionMessageBubbleFactory::set_override_for_tests( | 184 void ExtensionMessageBubbleFactory::set_override_for_tests( |
176 OverrideForTesting override) { | 185 OverrideForTesting override) { |
177 g_override_for_testing = override; | 186 g_override_for_testing = override; |
178 } | 187 } |
OLD | NEW |