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/extension_devtools_manager.h" | 10 #include "chrome/browser/extensions/extension_devtools_manager.h" |
11 #include "chrome/browser/extensions/extension_host.h" | 11 #include "chrome/browser/extensions/extension_host.h" |
12 #include "chrome/browser/extensions/extension_process_manager.h" | 12 #include "chrome/browser/extensions/extension_process_manager.h" |
13 #include "chrome/browser/extensions/extension_processes_api.h" | 13 #include "chrome/browser/extensions/extension_processes_api.h" |
14 #include "chrome/browser/extensions/extension_processes_api_constants.h" | 14 #include "chrome/browser/extensions/extension_processes_api_constants.h" |
15 #include "chrome/browser/extensions/extension_service.h" | 15 #include "chrome/browser/extensions/extension_service.h" |
| 16 #include "chrome/browser/extensions/extension_system.h" |
| 17 #include "chrome/browser/extensions/extension_system_factory.h" |
16 #include "chrome/browser/extensions/extension_tabs_module.h" | 18 #include "chrome/browser/extensions/extension_tabs_module.h" |
17 #include "chrome/browser/extensions/api/webrequest/webrequest_api.h" | 19 #include "chrome/browser/extensions/api/webrequest/webrequest_api.h" |
18 #include "chrome/browser/extensions/process_map.h" | 20 #include "chrome/browser/extensions/process_map.h" |
19 #include "chrome/browser/profiles/profile.h" | 21 #include "chrome/browser/profiles/profile.h" |
20 #include "chrome/common/chrome_notification_types.h" | 22 #include "chrome/common/chrome_notification_types.h" |
21 #include "chrome/common/chrome_switches.h" | 23 #include "chrome/common/chrome_switches.h" |
22 #include "chrome/common/chrome_view_type.h" | 24 #include "chrome/common/chrome_view_type.h" |
23 #include "chrome/common/extensions/extension.h" | 25 #include "chrome/common/extensions/extension.h" |
24 #include "chrome/common/extensions/extension_messages.h" | 26 #include "chrome/common/extensions/extension_messages.h" |
25 #include "chrome/common/extensions/api/extension_api.h" | 27 #include "chrome/common/extensions/api/extension_api.h" |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 const GURL& event_url) { | 89 const GURL& event_url) { |
88 ListValue args; | 90 ListValue args; |
89 args.Set(0, Value::CreateStringValue(event_name)); | 91 args.Set(0, Value::CreateStringValue(event_name)); |
90 args.Set(1, Value::CreateStringValue(event_args)); | 92 args.Set(1, Value::CreateStringValue(event_args)); |
91 ipc_sender->Send(new ExtensionMsg_MessageInvoke(MSG_ROUTING_CONTROL, | 93 ipc_sender->Send(new ExtensionMsg_MessageInvoke(MSG_ROUTING_CONTROL, |
92 extension_id, kDispatchEvent, args, event_url)); | 94 extension_id, kDispatchEvent, args, event_url)); |
93 } | 95 } |
94 | 96 |
95 ExtensionEventRouter::ExtensionEventRouter(Profile* profile) | 97 ExtensionEventRouter::ExtensionEventRouter(Profile* profile) |
96 : profile_(profile), | 98 : profile_(profile), |
97 extension_devtools_manager_(profile->GetExtensionDevToolsManager()) { | 99 extension_devtools_manager_( |
| 100 ExtensionSystemFactory::GetForProfile(profile)->devtools_manager()) { |
98 registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_TERMINATED, | 101 registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_TERMINATED, |
99 content::NotificationService::AllSources()); | 102 content::NotificationService::AllSources()); |
100 registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_CLOSED, | 103 registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_CLOSED, |
101 content::NotificationService::AllSources()); | 104 content::NotificationService::AllSources()); |
102 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING, | 105 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING, |
103 content::Source<Profile>(profile_)); | 106 content::Source<Profile>(profile_)); |
104 // TODO(tessamac): also get notified for background page crash/failure. | 107 // TODO(tessamac): also get notified for background page crash/failure. |
105 } | 108 } |
106 | 109 |
107 ExtensionEventRouter::~ExtensionEventRouter() {} | 110 ExtensionEventRouter::~ExtensionEventRouter() {} |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
425 DispatchPendingEvents(eh->extension_id()); | 428 DispatchPendingEvents(eh->extension_id()); |
426 } | 429 } |
427 break; | 430 break; |
428 } | 431 } |
429 // TODO(tessamac): if background page crashed/failed clear queue. | 432 // TODO(tessamac): if background page crashed/failed clear queue. |
430 default: | 433 default: |
431 NOTREACHED(); | 434 NOTREACHED(); |
432 return; | 435 return; |
433 } | 436 } |
434 } | 437 } |
OLD | NEW |