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" |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 | 95 |
96 } // namespace | 96 } // namespace |
97 | 97 |
98 ExtensionMessageBubbleFactory::ExtensionMessageBubbleFactory(Browser* browser) | 98 ExtensionMessageBubbleFactory::ExtensionMessageBubbleFactory(Browser* browser) |
99 : browser_(browser) { | 99 : browser_(browser) { |
100 } | 100 } |
101 | 101 |
102 ExtensionMessageBubbleFactory::~ExtensionMessageBubbleFactory() { | 102 ExtensionMessageBubbleFactory::~ExtensionMessageBubbleFactory() { |
103 } | 103 } |
104 | 104 |
105 scoped_ptr<extensions::ExtensionMessageBubbleController> | 105 std::unique_ptr<extensions::ExtensionMessageBubbleController> |
106 ExtensionMessageBubbleFactory::GetController() { | 106 ExtensionMessageBubbleFactory::GetController() { |
107 Profile* original_profile = browser_->profile()->GetOriginalProfile(); | 107 Profile* original_profile = browser_->profile()->GetOriginalProfile(); |
108 std::set<Profile*>& profiles_evaluated = g_profiles_evaluated.Get(); | 108 std::set<Profile*>& profiles_evaluated = g_profiles_evaluated.Get(); |
109 bool is_initial_check = profiles_evaluated.count(original_profile) == 0; | 109 bool is_initial_check = profiles_evaluated.count(original_profile) == 0; |
110 profiles_evaluated.insert(original_profile); | 110 profiles_evaluated.insert(original_profile); |
111 | 111 |
112 scoped_ptr<extensions::ExtensionMessageBubbleController> controller; | 112 std::unique_ptr<extensions::ExtensionMessageBubbleController> controller; |
113 | 113 |
114 if (g_override_for_testing == OVERRIDE_DISABLED) | 114 if (g_override_for_testing == OVERRIDE_DISABLED) |
115 return controller; | 115 return controller; |
116 | 116 |
117 // The list of suspicious extensions takes priority over the dev mode bubble | 117 // The list of suspicious extensions takes priority over the dev mode bubble |
118 // and the settings API bubble, since that needs to be shown as soon as we | 118 // and the settings API bubble, since that needs to be shown as soon as we |
119 // disable something. The settings API bubble is shown on first startup after | 119 // disable something. The settings API bubble is shown on first startup after |
120 // an extension has changed the startup pages and it is acceptable if that | 120 // an extension has changed the startup pages and it is acceptable if that |
121 // waits until the next startup because of the suspicious extension bubble. | 121 // waits until the next startup because of the suspicious extension bubble. |
122 // The dev mode bubble is not time sensitive like the other two so we'll catch | 122 // The dev mode bubble is not time sensitive like the other two so we'll catch |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 | 166 |
167 controller.reset(); | 167 controller.reset(); |
168 return controller; | 168 return controller; |
169 } | 169 } |
170 | 170 |
171 // static | 171 // static |
172 void ExtensionMessageBubbleFactory::set_override_for_tests( | 172 void ExtensionMessageBubbleFactory::set_override_for_tests( |
173 OverrideForTesting override) { | 173 OverrideForTesting override) { |
174 g_override_for_testing = override; | 174 g_override_for_testing = override; |
175 } | 175 } |
OLD | NEW |