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/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 "chrome/browser/extensions/dev_mode_bubble_controller.h" | 10 #include "chrome/browser/extensions/dev_mode_bubble_controller.h" |
11 #include "chrome/browser/extensions/extension_message_bubble_controller.h" | 11 #include "chrome/browser/extensions/extension_message_bubble_controller.h" |
12 #include "chrome/browser/extensions/install_verifier.h" | 12 #include "chrome/browser/extensions/install_verifier.h" |
13 #include "chrome/browser/extensions/proxy_overridden_bubble_controller.h" | 13 #include "chrome/browser/extensions/proxy_overridden_bubble_controller.h" |
14 #include "chrome/browser/extensions/settings_api_bubble_controller.h" | 14 #include "chrome/browser/extensions/settings_api_bubble_controller.h" |
15 #include "chrome/browser/extensions/settings_api_helpers.h" | 15 #include "chrome/browser/extensions/settings_api_helpers.h" |
16 #include "chrome/browser/extensions/suspicious_extension_bubble_controller.h" | 16 #include "chrome/browser/extensions/suspicious_extension_bubble_controller.h" |
17 #include "chrome/browser/profiles/profile.h" | 17 #include "chrome/browser/profiles/profile.h" |
| 18 #include "chrome/common/channel_info.h" |
18 #include "chrome/common/chrome_switches.h" | 19 #include "chrome/common/chrome_switches.h" |
19 #include "chrome/common/chrome_version_info.h" | 20 #include "components/version_info/version_info.h" |
20 #include "extensions/common/feature_switch.h" | 21 #include "extensions/common/feature_switch.h" |
21 | 22 |
22 namespace { | 23 namespace { |
23 | 24 |
24 // A map of all profiles evaluated, so we can tell if it's the initial check. | 25 // A map of all profiles evaluated, so we can tell if it's the initial check. |
25 // TODO(devlin): It would be nice to coalesce all the "profiles evaluated" maps | 26 // TODO(devlin): It would be nice to coalesce all the "profiles evaluated" maps |
26 // that are in the different bubble controllers. | 27 // that are in the different bubble controllers. |
27 base::LazyInstance<std::set<Profile*> > g_profiles_evaluated = | 28 base::LazyInstance<std::set<Profile*> > g_profiles_evaluated = |
28 LAZY_INSTANCE_INITIALIZER; | 29 LAZY_INSTANCE_INITIALIZER; |
29 | 30 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 return g_enabled_for_tests || | 69 return g_enabled_for_tests || |
69 IsExperimentEnabled(kEnableProxyWarningExperimentName); | 70 IsExperimentEnabled(kEnableProxyWarningExperimentName); |
70 #endif | 71 #endif |
71 } | 72 } |
72 | 73 |
73 bool EnableDevModeBubble() { | 74 bool EnableDevModeBubble() { |
74 if (extensions::FeatureSwitch::force_dev_mode_highlighting()->IsEnabled()) | 75 if (extensions::FeatureSwitch::force_dev_mode_highlighting()->IsEnabled()) |
75 return true; | 76 return true; |
76 | 77 |
77 #if defined(OS_WIN) | 78 #if defined(OS_WIN) |
78 if (chrome::VersionInfo::GetChannel() >= version_info::Channel::BETA) | 79 if (chrome::GetChannel() >= version_info::Channel::BETA) |
79 return true; | 80 return true; |
80 #endif | 81 #endif |
81 | 82 |
82 return g_enabled_for_tests || | 83 return g_enabled_for_tests || |
83 IsExperimentEnabled(kEnableDevModeWarningExperimentName); | 84 IsExperimentEnabled(kEnableDevModeWarningExperimentName); |
84 } | 85 } |
85 | 86 |
86 } // namespace | 87 } // namespace |
87 | 88 |
88 ExtensionMessageBubbleFactory::ExtensionMessageBubbleFactory(Profile* profile) | 89 ExtensionMessageBubbleFactory::ExtensionMessageBubbleFactory(Profile* profile) |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 return controller.Pass(); | 146 return controller.Pass(); |
146 } | 147 } |
147 | 148 |
148 return scoped_ptr<extensions::ExtensionMessageBubbleController>(); | 149 return scoped_ptr<extensions::ExtensionMessageBubbleController>(); |
149 } | 150 } |
150 | 151 |
151 // static | 152 // static |
152 void ExtensionMessageBubbleFactory::set_enabled_for_tests(bool enabled) { | 153 void ExtensionMessageBubbleFactory::set_enabled_for_tests(bool enabled) { |
153 g_enabled_for_tests = enabled; | 154 g_enabled_for_tests = enabled; |
154 } | 155 } |
OLD | NEW |