Chromium Code Reviews| 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/browser_process.h" | |
|
Devlin
2016/09/21 01:50:58
Whoops - will clean up these includes
Finnur
2016/09/21 10:05:10
OK.
Remember the BUG= also.
Devlin
2016/09/21 17:07:31
Done and done. :)
| |
| 12 #include "chrome/browser/extensions/dev_mode_bubble_delegate.h" | 13 #include "chrome/browser/extensions/dev_mode_bubble_delegate.h" |
| 13 #include "chrome/browser/extensions/extension_message_bubble_controller.h" | 14 #include "chrome/browser/extensions/extension_message_bubble_controller.h" |
| 14 #include "chrome/browser/extensions/install_verifier.h" | 15 #include "chrome/browser/extensions/install_verifier.h" |
| 15 #include "chrome/browser/extensions/proxy_overridden_bubble_delegate.h" | 16 #include "chrome/browser/extensions/proxy_overridden_bubble_delegate.h" |
| 16 #include "chrome/browser/extensions/settings_api_bubble_delegate.h" | 17 #include "chrome/browser/extensions/settings_api_bubble_delegate.h" |
| 17 #include "chrome/browser/extensions/settings_api_helpers.h" | 18 #include "chrome/browser/extensions/settings_api_helpers.h" |
| 18 #include "chrome/browser/extensions/suspicious_extension_bubble_delegate.h" | 19 #include "chrome/browser/extensions/suspicious_extension_bubble_delegate.h" |
| 19 #include "chrome/browser/profiles/profile.h" | 20 #include "chrome/browser/profiles/profile.h" |
| 20 #include "chrome/browser/ui/browser.h" | 21 #include "chrome/browser/ui/browser.h" |
| 22 #include "chrome/browser/ui/startup/startup_browser_creator.h" | |
| 21 #include "chrome/common/channel_info.h" | 23 #include "chrome/common/channel_info.h" |
| 24 #include "chrome/common/pref_names.h" | |
| 25 #include "components/prefs/pref_service.h" | |
| 22 #include "components/version_info/version_info.h" | 26 #include "components/version_info/version_info.h" |
| 23 #include "extensions/common/feature_switch.h" | 27 #include "extensions/common/feature_switch.h" |
| 24 | 28 |
| 25 namespace { | 29 namespace { |
| 26 | 30 |
| 27 // A map of all profiles evaluated, so we can tell if it's the initial check. | 31 // A map of all profiles evaluated, so we can tell if it's the initial check. |
| 28 // TODO(devlin): It would be nice to coalesce all the "profiles evaluated" maps | 32 // TODO(devlin): It would be nice to coalesce all the "profiles evaluated" maps |
| 29 // that are in the different bubble controllers. | 33 // that are in the different bubble controllers. |
| 30 base::LazyInstance<std::set<Profile*> > g_profiles_evaluated = | 34 base::LazyInstance<std::set<Profile*> > g_profiles_evaluated = |
| 31 LAZY_INSTANCE_INITIALIZER; | 35 LAZY_INSTANCE_INITIALIZER; |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 126 controller.reset( | 130 controller.reset( |
| 127 new extensions::ExtensionMessageBubbleController( | 131 new extensions::ExtensionMessageBubbleController( |
| 128 new extensions::SuspiciousExtensionBubbleDelegate( | 132 new extensions::SuspiciousExtensionBubbleDelegate( |
| 129 browser_->profile()), | 133 browser_->profile()), |
| 130 browser_)); | 134 browser_)); |
| 131 if (controller->ShouldShow()) | 135 if (controller->ShouldShow()) |
| 132 return controller; | 136 return controller; |
| 133 } | 137 } |
| 134 | 138 |
| 135 if (EnableSettingsApiBubble()) { | 139 if (EnableSettingsApiBubble()) { |
| 136 // No use showing this if it's not the startup of the profile. | 140 // No use showing this if it's not the startup of the profile, and if the |
| 137 if (is_initial_check) { | 141 // browser was restarted, then we always do a session restore (rather than |
| 142 // showing normal startup pages). | |
| 143 if (is_initial_check && !StartupBrowserCreator::WasRestarted()) { | |
| 138 controller.reset(new extensions::ExtensionMessageBubbleController( | 144 controller.reset(new extensions::ExtensionMessageBubbleController( |
| 139 new extensions::SettingsApiBubbleDelegate( | 145 new extensions::SettingsApiBubbleDelegate( |
| 140 browser_->profile(), extensions::BUBBLE_TYPE_STARTUP_PAGES), | 146 browser_->profile(), extensions::BUBBLE_TYPE_STARTUP_PAGES), |
| 141 browser_)); | 147 browser_)); |
| 142 if (controller->ShouldShow()) | 148 if (controller->ShouldShow()) |
| 143 return controller; | 149 return controller; |
| 144 } | 150 } |
| 145 } | 151 } |
| 146 | 152 |
| 147 if (EnableProxyOverrideBubble()) { | 153 if (EnableProxyOverrideBubble()) { |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 166 | 172 |
| 167 controller.reset(); | 173 controller.reset(); |
| 168 return controller; | 174 return controller; |
| 169 } | 175 } |
| 170 | 176 |
| 171 // static | 177 // static |
| 172 void ExtensionMessageBubbleFactory::set_override_for_tests( | 178 void ExtensionMessageBubbleFactory::set_override_for_tests( |
| 173 OverrideForTesting override) { | 179 OverrideForTesting override) { |
| 174 g_override_for_testing = override; | 180 g_override_for_testing = override; |
| 175 } | 181 } |
| OLD | NEW |