Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 Loading... | |
| 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: |
|
sky
2014/04/18 14:11:49
If you're going to change this (which is good) fix
limasdf
2014/04/18 14:22:59
Done.
| |
| 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(); |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 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 } |
| OLD | NEW |