| 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 "chrome/browser/extensions/extension_event_router.h" | 5 #include "chrome/browser/extensions/extension_event_router.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "chrome/browser/extensions/api/runtime/runtime_api.h" | 10 #include "chrome/browser/extensions/api/runtime/runtime_api.h" |
| (...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 416 const Extension* extension = profile->GetExtensionService()->extensions()-> | 416 const Extension* extension = profile->GetExtensionService()->extensions()-> |
| 417 GetByID(extension_id); | 417 GetByID(extension_id); |
| 418 if (extension && extension->has_lazy_background_page()) { | 418 if (extension && extension->has_lazy_background_page()) { |
| 419 profile->GetExtensionProcessManager()->DecrementLazyKeepaliveCount( | 419 profile->GetExtensionProcessManager()->DecrementLazyKeepaliveCount( |
| 420 extension); | 420 extension); |
| 421 } | 421 } |
| 422 } | 422 } |
| 423 | 423 |
| 424 void ExtensionEventRouter::DispatchPendingEvent( | 424 void ExtensionEventRouter::DispatchPendingEvent( |
| 425 const linked_ptr<ExtensionEvent>& event, ExtensionHost* host) { | 425 const linked_ptr<ExtensionEvent>& event, ExtensionHost* host) { |
| 426 if (!host) |
| 427 return; |
| 428 |
| 426 ListenerProcess listener(host->render_process_host(), | 429 ListenerProcess listener(host->render_process_host(), |
| 427 host->extension()->id()); | 430 host->extension()->id()); |
| 428 if (listeners_[event->event_name].count(listener) > 0u) | 431 if (listeners_[event->event_name].count(listener) > 0u) |
| 429 DispatchEventToListener(listener, event); | 432 DispatchEventToListener(listener, event); |
| 430 } | 433 } |
| 431 | 434 |
| 432 void ExtensionEventRouter::Observe( | 435 void ExtensionEventRouter::Observe( |
| 433 int type, | 436 int type, |
| 434 const content::NotificationSource& source, | 437 const content::NotificationSource& source, |
| 435 const content::NotificationDetails& details) { | 438 const content::NotificationDetails& details) { |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 486 content::Details<const Extension>(details).ptr(); | 489 content::Details<const Extension>(details).ptr(); |
| 487 extensions::RuntimeEventRouter::DispatchOnInstalledEvent( | 490 extensions::RuntimeEventRouter::DispatchOnInstalledEvent( |
| 488 profile_, extension); | 491 profile_, extension); |
| 489 break; | 492 break; |
| 490 } | 493 } |
| 491 default: | 494 default: |
| 492 NOTREACHED(); | 495 NOTREACHED(); |
| 493 return; | 496 return; |
| 494 } | 497 } |
| 495 } | 498 } |
| OLD | NEW |