Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(92)

Side by Side Diff: chrome/browser/ui/extensions/extension_message_bubble_factory.cc

Issue 1550053002: Convert Pass()→std::move() in //chrome/browser/ui (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 scoped_ptr<extensions::ExtensionMessageBubbleController> 105 scoped_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 scoped_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.Pass(); 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
123 // the dev mode extensions on the next startup/next window that opens. That 123 // the dev mode extensions on the next startup/next window that opens. That
124 // way, we're not too spammy with the bubbles. 124 // way, we're not too spammy with the bubbles.
125 if (EnableSuspiciousExtensionsBubble()) { 125 if (EnableSuspiciousExtensionsBubble()) {
126 controller.reset( 126 controller.reset(
127 new extensions::ExtensionMessageBubbleController( 127 new extensions::ExtensionMessageBubbleController(
128 new extensions::SuspiciousExtensionBubbleDelegate( 128 new extensions::SuspiciousExtensionBubbleDelegate(
129 browser_->profile()), 129 browser_->profile()),
130 browser_)); 130 browser_));
131 if (controller->ShouldShow()) 131 if (controller->ShouldShow())
132 return controller.Pass(); 132 return controller;
133 } 133 }
134 134
135 if (EnableSettingsApiBubble()) { 135 if (EnableSettingsApiBubble()) {
136 // No use showing this if it's not the startup of the profile. 136 // No use showing this if it's not the startup of the profile.
137 if (is_initial_check) { 137 if (is_initial_check) {
138 controller.reset(new extensions::ExtensionMessageBubbleController( 138 controller.reset(new extensions::ExtensionMessageBubbleController(
139 new extensions::SettingsApiBubbleDelegate( 139 new extensions::SettingsApiBubbleDelegate(
140 browser_->profile(), extensions::BUBBLE_TYPE_STARTUP_PAGES), 140 browser_->profile(), extensions::BUBBLE_TYPE_STARTUP_PAGES),
141 browser_)); 141 browser_));
142 if (controller->ShouldShow()) 142 if (controller->ShouldShow())
143 return controller.Pass(); 143 return controller;
144 } 144 }
145 } 145 }
146 146
147 if (EnableProxyOverrideBubble()) { 147 if (EnableProxyOverrideBubble()) {
148 controller.reset( 148 controller.reset(
149 new extensions::ExtensionMessageBubbleController( 149 new extensions::ExtensionMessageBubbleController(
150 new extensions::ProxyOverriddenBubbleDelegate( 150 new extensions::ProxyOverriddenBubbleDelegate(
151 browser_->profile()), 151 browser_->profile()),
152 browser_)); 152 browser_));
153 if (controller->ShouldShow()) 153 if (controller->ShouldShow())
154 return controller.Pass(); 154 return controller;
155 } 155 }
156 156
157 if (EnableDevModeBubble()) { 157 if (EnableDevModeBubble()) {
158 controller.reset( 158 controller.reset(
159 new extensions::ExtensionMessageBubbleController( 159 new extensions::ExtensionMessageBubbleController(
160 new extensions::DevModeBubbleDelegate( 160 new extensions::DevModeBubbleDelegate(
161 browser_->profile()), 161 browser_->profile()),
162 browser_)); 162 browser_));
163 if (controller->ShouldShow()) 163 if (controller->ShouldShow())
164 return controller.Pass(); 164 return controller;
165 } 165 }
166 166
167 controller.reset(); 167 controller.reset();
168 return controller.Pass(); 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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698