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

Side by Side Diff: chrome/browser/extensions/extension_test_notification_observer.cc

Issue 242613004: Replace NOTIFICATION_EXTENSION_LOADED to NOTIFICATION_EXTENSION_LOADED_DEPRECATED (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 years, 8 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/extensions/extension_test_notification_observer.h" 5 #include "chrome/browser/extensions/extension_test_notification_observer.h"
6 6
7 #include "base/callback_list.h" 7 #include "base/callback_list.h"
8 #include "chrome/browser/extensions/extension_service.h" 8 #include "chrome/browser/extensions/extension_service.h"
9 #include "chrome/browser/profiles/profile_manager.h" 9 #include "chrome/browser/profiles/profile_manager.h"
10 #include "chrome/browser/ui/browser.h" 10 #include "chrome/browser/ui/browser.h"
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 191
192 bool ExtensionTestNotificationObserver::WaitForExtensionInstallError() { 192 bool ExtensionTestNotificationObserver::WaitForExtensionInstallError() {
193 int before = extension_installs_observed_; 193 int before = extension_installs_observed_;
194 content::WindowedNotificationObserver( 194 content::WindowedNotificationObserver(
195 chrome::NOTIFICATION_EXTENSION_INSTALL_ERROR, 195 chrome::NOTIFICATION_EXTENSION_INSTALL_ERROR,
196 content::NotificationService::AllSources()).Wait(); 196 content::NotificationService::AllSources()).Wait();
197 return extension_installs_observed_ == before; 197 return extension_installs_observed_ == before;
198 } 198 }
199 199
200 void ExtensionTestNotificationObserver::WaitForExtensionLoad() { 200 void ExtensionTestNotificationObserver::WaitForExtensionLoad() {
201 WaitForNotification(chrome::NOTIFICATION_EXTENSION_LOADED); 201 WaitForNotification(chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED);
202 } 202 }
203 203
204 void ExtensionTestNotificationObserver::WaitForExtensionAndViewLoad() { 204 void ExtensionTestNotificationObserver::WaitForExtensionAndViewLoad() {
205 this->WaitForExtensionLoad(); 205 this->WaitForExtensionLoad();
206 WaitForExtensionViewsToLoad(); 206 WaitForExtensionViewsToLoad();
207 } 207 }
208 208
209 bool ExtensionTestNotificationObserver::WaitForExtensionLoadError() { 209 bool ExtensionTestNotificationObserver::WaitForExtensionLoadError() {
210 int before = extension_load_errors_observed_; 210 int before = extension_load_errors_observed_;
211 WaitForNotification(chrome::NOTIFICATION_EXTENSION_LOAD_ERROR); 211 WaitForNotification(chrome::NOTIFICATION_EXTENSION_LOAD_ERROR);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 246
247 registrar_.RemoveAll(); 247 registrar_.RemoveAll();
248 observer_.reset(); 248 observer_.reset();
249 } 249 }
250 250
251 void ExtensionTestNotificationObserver::Observe( 251 void ExtensionTestNotificationObserver::Observe(
252 int type, 252 int type,
253 const content::NotificationSource& source, 253 const content::NotificationSource& source,
254 const content::NotificationDetails& details) { 254 const content::NotificationDetails& details) {
255 switch (type) { 255 switch (type) {
256 case chrome::NOTIFICATION_EXTENSION_LOADED: 256 case chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED:
257 last_loaded_extension_id_ = 257 last_loaded_extension_id_ =
258 content::Details<const Extension>(details).ptr()->id(); 258 content::Details<const Extension>(details).ptr()->id();
259 VLOG(1) << "Got EXTENSION_LOADED notification."; 259 VLOG(1) << "Got EXTENSION_LOADED notification.";
260 break; 260 break;
261 261
262 case chrome::NOTIFICATION_CRX_INSTALLER_DONE: 262 case chrome::NOTIFICATION_CRX_INSTALLER_DONE:
263 VLOG(1) << "Got CRX_INSTALLER_DONE notification."; 263 VLOG(1) << "Got CRX_INSTALLER_DONE notification.";
264 { 264 {
265 const Extension* extension = 265 const Extension* extension =
266 content::Details<const Extension>(details).ptr(); 266 content::Details<const Extension>(details).ptr();
267 if (extension) 267 if (extension)
268 last_loaded_extension_id_ = extension->id(); 268 last_loaded_extension_id_ = extension->id();
269 else 269 else
270 last_loaded_extension_id_.clear(); 270 last_loaded_extension_id_.clear();
271 } 271 }
272 ++crx_installers_done_observed_; 272 ++crx_installers_done_observed_;
273 break; 273 break;
274 274
275 case chrome::NOTIFICATION_EXTENSION_INSTALLED: 275 case chrome::NOTIFICATION_EXTENSION_INSTALLED:
276 VLOG(1) << "Got EXTENSION_INSTALLED notification."; 276 VLOG(1) << "Got EXTENSION_INSTALLED notification.";
277 ++extension_installs_observed_; 277 ++extension_installs_observed_;
278 break; 278 break;
279 279
280 case chrome::NOTIFICATION_EXTENSION_LOAD_ERROR: 280 case chrome::NOTIFICATION_EXTENSION_LOAD_ERROR:
281 VLOG(1) << "Got EXTENSION_LOAD_ERROR notification."; 281 VLOG(1) << "Got EXTENSION_LOAD_ERROR notification.";
282 ++extension_load_errors_observed_; 282 ++extension_load_errors_observed_;
283 break; 283 break;
284 284
285 default: 285 default:
286 NOTREACHED(); 286 NOTREACHED();
287 break; 287 break;
288 } 288 }
289 } 289 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_service_unittest.cc ('k') | chrome/browser/extensions/extension_toolbar_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698