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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_TERMINATED, | 107 registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_TERMINATED, |
108 content::NotificationService::AllSources()); | 108 content::NotificationService::AllSources()); |
109 registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_CLOSED, | 109 registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_CLOSED, |
110 content::NotificationService::AllSources()); | 110 content::NotificationService::AllSources()); |
111 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, | 111 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, |
112 content::Source<Profile>(profile_)); | 112 content::Source<Profile>(profile_)); |
113 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, | 113 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, |
114 content::Source<Profile>(profile_)); | 114 content::Source<Profile>(profile_)); |
115 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_INSTALLED, | 115 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_INSTALLED, |
116 content::Source<Profile>(profile_)); | 116 content::Source<Profile>(profile_)); |
117 // TODO(tessamac): also get notified for background page crash/failure. | |
118 } | 117 } |
119 | 118 |
120 ExtensionEventRouter::~ExtensionEventRouter() {} | 119 ExtensionEventRouter::~ExtensionEventRouter() {} |
121 | 120 |
122 void ExtensionEventRouter::AddEventListener( | 121 void ExtensionEventRouter::AddEventListener( |
123 const std::string& event_name, | 122 const std::string& event_name, |
124 content::RenderProcessHost* process, | 123 content::RenderProcessHost* process, |
125 const std::string& extension_id) { | 124 const std::string& extension_id) { |
126 ListenerProcess listener(process, extension_id); | 125 ListenerProcess listener(process, extension_id); |
127 DCHECK_EQ(listeners_[event_name].count(listener), 0u) << event_name; | 126 DCHECK_EQ(listeners_[event_name].count(listener), 0u) << event_name; |
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
482 break; | 481 break; |
483 } | 482 } |
484 case chrome::NOTIFICATION_EXTENSION_INSTALLED: { | 483 case chrome::NOTIFICATION_EXTENSION_INSTALLED: { |
485 // Dispatch the onInstalled event. | 484 // Dispatch the onInstalled event. |
486 const Extension* extension = | 485 const Extension* extension = |
487 content::Details<const Extension>(details).ptr(); | 486 content::Details<const Extension>(details).ptr(); |
488 extensions::RuntimeEventRouter::DispatchOnInstalledEvent( | 487 extensions::RuntimeEventRouter::DispatchOnInstalledEvent( |
489 profile_, extension); | 488 profile_, extension); |
490 break; | 489 break; |
491 } | 490 } |
492 | |
493 // TODO(tessamac): if background page crashed/failed clear queue. | |
494 default: | 491 default: |
495 NOTREACHED(); | 492 NOTREACHED(); |
496 return; | 493 return; |
497 } | 494 } |
498 } | 495 } |
OLD | NEW |