| 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/common/channel_info.h" | 22 #include "chrome/common/channel_info.h" |
| 22 #include "components/version_info/version_info.h" | 23 #include "components/version_info/version_info.h" |
| 23 #include "extensions/common/feature_switch.h" | 24 #include "extensions/common/feature_switch.h" |
| 24 | 25 |
| 25 namespace { | 26 namespace { |
| 26 | 27 |
| 27 // A map of all profiles evaluated, so we can tell if it's the initial check. | 28 // 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 | 29 // TODO(devlin): It would be nice to coalesce all the "profiles evaluated" maps |
| 29 // that are in the different bubble controllers. | 30 // that are in the different bubble controllers. |
| 30 base::LazyInstance<std::set<Profile*> > g_profiles_evaluated = | 31 base::LazyInstance<std::set<Profile*> > g_profiles_evaluated = |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 controller.reset( | 127 controller.reset( |
| 127 new extensions::ExtensionMessageBubbleController( | 128 new extensions::ExtensionMessageBubbleController( |
| 128 new extensions::SuspiciousExtensionBubbleDelegate( | 129 new extensions::SuspiciousExtensionBubbleDelegate( |
| 129 browser_->profile()), | 130 browser_->profile()), |
| 130 browser_)); | 131 browser_)); |
| 131 if (controller->ShouldShow()) | 132 if (controller->ShouldShow()) |
| 132 return controller; | 133 return controller; |
| 133 } | 134 } |
| 134 | 135 |
| 135 if (EnableSettingsApiBubble()) { | 136 if (EnableSettingsApiBubble()) { |
| 136 // No use showing this if it's not the startup of the profile. | 137 // No use showing this if it's not the startup of the profile, and if the |
| 137 if (is_initial_check) { | 138 // browser was restarted, then we always do a session restore (rather than |
| 139 // showing normal startup pages). |
| 140 if (is_initial_check && !StartupBrowserCreator::WasRestarted()) { |
| 138 controller.reset(new extensions::ExtensionMessageBubbleController( | 141 controller.reset(new extensions::ExtensionMessageBubbleController( |
| 139 new extensions::SettingsApiBubbleDelegate( | 142 new extensions::SettingsApiBubbleDelegate( |
| 140 browser_->profile(), extensions::BUBBLE_TYPE_STARTUP_PAGES), | 143 browser_->profile(), extensions::BUBBLE_TYPE_STARTUP_PAGES), |
| 141 browser_)); | 144 browser_)); |
| 142 if (controller->ShouldShow()) | 145 if (controller->ShouldShow()) |
| 143 return controller; | 146 return controller; |
| 144 } | 147 } |
| 145 } | 148 } |
| 146 | 149 |
| 147 if (EnableProxyOverrideBubble()) { | 150 if (EnableProxyOverrideBubble()) { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 166 | 169 |
| 167 controller.reset(); | 170 controller.reset(); |
| 168 return controller; | 171 return controller; |
| 169 } | 172 } |
| 170 | 173 |
| 171 // static | 174 // static |
| 172 void ExtensionMessageBubbleFactory::set_override_for_tests( | 175 void ExtensionMessageBubbleFactory::set_override_for_tests( |
| 173 OverrideForTesting override) { | 176 OverrideForTesting override) { |
| 174 g_override_for_testing = override; | 177 g_override_for_testing = override; |
| 175 } | 178 } |
| OLD | NEW |