OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
8 #include "chrome/browser/extensions/extension_event_router.h" | 8 #include "chrome/browser/extensions/extension_event_router.h" |
9 #include "chrome/browser/extensions/extension_process_manager.h" | 9 #include "chrome/browser/extensions/extension_process_manager.h" |
10 #include "chrome/browser/extensions/extension_host.h" | 10 #include "chrome/browser/extensions/extension_host.h" |
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
447 void ExtensionProcessManager::OnUnloadAck(const std::string& extension_id) { | 447 void ExtensionProcessManager::OnUnloadAck(const std::string& extension_id) { |
448 ExtensionHost* host = GetBackgroundHostForExtension(extension_id); | 448 ExtensionHost* host = GetBackgroundHostForExtension(extension_id); |
449 if (host) | 449 if (host) |
450 CloseBackgroundHost(host); | 450 CloseBackgroundHost(host); |
451 } | 451 } |
452 | 452 |
453 void ExtensionProcessManager::OnNetworkRequestStarted( | 453 void ExtensionProcessManager::OnNetworkRequestStarted( |
454 RenderViewHost* render_view_host) { | 454 RenderViewHost* render_view_host) { |
455 ExtensionHost* host = GetBackgroundHostForExtension( | 455 ExtensionHost* host = GetBackgroundHostForExtension( |
456 GetExtensionID(render_view_host)); | 456 GetExtensionID(render_view_host)); |
457 if (host) | 457 if (host && host->render_view_host() == render_view_host) |
458 IncrementLazyKeepaliveCount(host->extension()); | 458 IncrementLazyKeepaliveCount(host->extension()); |
459 } | 459 } |
460 | 460 |
461 void ExtensionProcessManager::OnNetworkRequestDone( | 461 void ExtensionProcessManager::OnNetworkRequestDone( |
462 RenderViewHost* render_view_host) { | 462 RenderViewHost* render_view_host) { |
463 ExtensionHost* host = GetBackgroundHostForExtension( | 463 ExtensionHost* host = GetBackgroundHostForExtension( |
464 GetExtensionID(render_view_host)); | 464 GetExtensionID(render_view_host)); |
465 if (host) | 465 if (host && host->render_view_host() == render_view_host) |
466 DecrementLazyKeepaliveCount(host->extension()); | 466 DecrementLazyKeepaliveCount(host->extension()); |
467 } | 467 } |
468 | 468 |
469 void ExtensionProcessManager::Observe( | 469 void ExtensionProcessManager::Observe( |
470 int type, | 470 int type, |
471 const content::NotificationSource& source, | 471 const content::NotificationSource& source, |
472 const content::NotificationDetails& details) { | 472 const content::NotificationDetails& details) { |
473 switch (type) { | 473 switch (type) { |
474 case chrome::NOTIFICATION_EXTENSIONS_READY: { | 474 case chrome::NOTIFICATION_EXTENSIONS_READY: { |
475 CreateBackgroundHostsForProfileStartup(this, | 475 CreateBackgroundHostsForProfileStartup(this, |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
685 if (service && service->is_ready()) | 685 if (service && service->is_ready()) |
686 CreateBackgroundHostsForProfileStartup(this, service->extensions()); | 686 CreateBackgroundHostsForProfileStartup(this, service->extensions()); |
687 } | 687 } |
688 break; | 688 break; |
689 } | 689 } |
690 default: | 690 default: |
691 ExtensionProcessManager::Observe(type, source, details); | 691 ExtensionProcessManager::Observe(type, source, details); |
692 break; | 692 break; |
693 } | 693 } |
694 } | 694 } |
OLD | NEW |