OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_process_manager.h" | 5 #include "chrome/browser/extensions/extension_process_manager.h" |
6 | 6 |
7 #include "chrome/browser/browser_window.h" | 7 #include "chrome/browser/browser_window.h" |
8 #include "chrome/browser/browsing_instance.h" | 8 #include "chrome/browser/browsing_instance.h" |
9 #if defined(OS_MACOSX) | 9 #if defined(OS_MACOSX) |
10 #include "chrome/browser/extensions/extension_host_mac.h" | 10 #include "chrome/browser/extensions/extension_host_mac.h" |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 } | 272 } |
273 | 273 |
274 bool ExtensionProcessManager::HasExtensionHost(ExtensionHost* host) const { | 274 bool ExtensionProcessManager::HasExtensionHost(ExtensionHost* host) const { |
275 return all_hosts_.find(host) != all_hosts_.end(); | 275 return all_hosts_.find(host) != all_hosts_.end(); |
276 } | 276 } |
277 | 277 |
278 void ExtensionProcessManager::Observe(NotificationType type, | 278 void ExtensionProcessManager::Observe(NotificationType type, |
279 const NotificationSource& source, | 279 const NotificationSource& source, |
280 const NotificationDetails& details) { | 280 const NotificationDetails& details) { |
281 switch (type.value) { | 281 switch (type.value) { |
282 case NotificationType::EXTENSIONS_READY: | 282 case NotificationType::EXTENSIONS_READY: { |
283 CreateBackgroundHosts(this, | 283 CreateBackgroundHosts(this, |
284 Source<Profile>(source).ptr()->GetExtensionsService()->extensions()); | 284 Source<Profile>(source).ptr()->GetExtensionsService()->extensions()); |
285 break; | 285 break; |
| 286 } |
286 | 287 |
287 case NotificationType::EXTENSION_LOADED: { | 288 case NotificationType::EXTENSION_LOADED: { |
288 ExtensionsService* service = | 289 ExtensionsService* service = |
289 Source<Profile>(source).ptr()->GetExtensionsService(); | 290 Source<Profile>(source).ptr()->GetExtensionsService(); |
290 if (service->is_ready()) { | 291 if (service->is_ready()) { |
291 const Extension* extension = Details<const Extension>(details).ptr(); | 292 const Extension* extension = Details<const Extension>(details).ptr(); |
292 ::CreateBackgroundHost(this, extension); | 293 ::CreateBackgroundHost(this, extension); |
293 } | 294 } |
294 break; | 295 break; |
295 } | 296 } |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
445 NotificationType type, | 446 NotificationType type, |
446 const NotificationSource& source, | 447 const NotificationSource& source, |
447 const NotificationDetails& details) { | 448 const NotificationDetails& details) { |
448 switch (type.value) { | 449 switch (type.value) { |
449 case NotificationType::BROWSER_WINDOW_READY: { | 450 case NotificationType::BROWSER_WINDOW_READY: { |
450 // We want to spawn our background hosts as soon as the user opens an | 451 // We want to spawn our background hosts as soon as the user opens an |
451 // incognito window. Watch for new browsers and create the hosts if | 452 // incognito window. Watch for new browsers and create the hosts if |
452 // it matches our profile. | 453 // it matches our profile. |
453 Browser* browser = Source<Browser>(source).ptr(); | 454 Browser* browser = Source<Browser>(source).ptr(); |
454 if (browser->profile() == browsing_instance_->profile()) { | 455 if (browser->profile() == browsing_instance_->profile()) { |
| 456 // On Chrome OS, a login screen is implemented as a browser. |
| 457 // This browser has no extension service. In this case, |
| 458 // service will be NULL. |
455 ExtensionsService* service = | 459 ExtensionsService* service = |
456 browsing_instance_->profile()->GetExtensionsService(); | 460 browsing_instance_->profile()->GetExtensionsService(); |
457 if (service && service->is_ready()) | 461 if (service && service->is_ready()) |
458 CreateBackgroundHosts(this, service->extensions()); | 462 CreateBackgroundHosts(this, service->extensions()); |
459 } | 463 } |
460 break; | 464 break; |
461 } | 465 } |
462 default: | 466 default: |
463 ExtensionProcessManager::Observe(type, source, details); | 467 ExtensionProcessManager::Observe(type, source, details); |
464 break; | 468 break; |
465 } | 469 } |
466 } | 470 } |
OLD | NEW |