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" | |
18 #include "chrome/browser/extensions/extension_tabs_module.h" | 16 #include "chrome/browser/extensions/extension_tabs_module.h" |
19 #include "chrome/browser/extensions/api/webrequest/webrequest_api.h" | 17 #include "chrome/browser/extensions/api/webrequest/webrequest_api.h" |
20 #include "chrome/browser/extensions/process_map.h" | 18 #include "chrome/browser/extensions/process_map.h" |
21 #include "chrome/browser/profiles/profile.h" | 19 #include "chrome/browser/profiles/profile.h" |
22 #include "chrome/common/chrome_notification_types.h" | 20 #include "chrome/common/chrome_notification_types.h" |
23 #include "chrome/common/chrome_switches.h" | 21 #include "chrome/common/chrome_switches.h" |
24 #include "chrome/common/chrome_view_type.h" | 22 #include "chrome/common/chrome_view_type.h" |
25 #include "chrome/common/extensions/extension.h" | 23 #include "chrome/common/extensions/extension.h" |
26 #include "chrome/common/extensions/extension_messages.h" | 24 #include "chrome/common/extensions/extension_messages.h" |
27 #include "chrome/common/extensions/api/extension_api.h" | 25 #include "chrome/common/extensions/api/extension_api.h" |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 ListValue args; | 93 ListValue args; |
96 args.Set(0, Value::CreateStringValue(event_name)); | 94 args.Set(0, Value::CreateStringValue(event_name)); |
97 args.Set(1, Value::CreateStringValue(event_args)); | 95 args.Set(1, Value::CreateStringValue(event_args)); |
98 ipc_sender->Send(new ExtensionMsg_MessageInvoke(MSG_ROUTING_CONTROL, | 96 ipc_sender->Send(new ExtensionMsg_MessageInvoke(MSG_ROUTING_CONTROL, |
99 extension_id, kDispatchEvent, args, event_url, | 97 extension_id, kDispatchEvent, args, event_url, |
100 user_gesture == USER_GESTURE_ENABLED)); | 98 user_gesture == USER_GESTURE_ENABLED)); |
101 } | 99 } |
102 | 100 |
103 ExtensionEventRouter::ExtensionEventRouter(Profile* profile) | 101 ExtensionEventRouter::ExtensionEventRouter(Profile* profile) |
104 : profile_(profile), | 102 : profile_(profile), |
105 extension_devtools_manager_( | 103 extension_devtools_manager_(profile->GetExtensionDevToolsManager()) { |
106 ExtensionSystemFactory::GetForProfile(profile)->devtools_manager()) { | |
107 registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_TERMINATED, | 104 registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_TERMINATED, |
108 content::NotificationService::AllSources()); | 105 content::NotificationService::AllSources()); |
109 registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_CLOSED, | 106 registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_CLOSED, |
110 content::NotificationService::AllSources()); | 107 content::NotificationService::AllSources()); |
111 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING, | 108 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING, |
112 content::Source<Profile>(profile_)); | 109 content::Source<Profile>(profile_)); |
113 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, | 110 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, |
114 content::Source<Profile>(profile_)); | 111 content::Source<Profile>(profile_)); |
115 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, | 112 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, |
116 content::Source<Profile>(profile_)); | 113 content::Source<Profile>(profile_)); |
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
523 extension->id(), kOnInstalledEvent, "[]", NULL, GURL()); | 520 extension->id(), kOnInstalledEvent, "[]", NULL, GURL()); |
524 break; | 521 break; |
525 } | 522 } |
526 | 523 |
527 // TODO(tessamac): if background page crashed/failed clear queue. | 524 // TODO(tessamac): if background page crashed/failed clear queue. |
528 default: | 525 default: |
529 NOTREACHED(); | 526 NOTREACHED(); |
530 return; | 527 return; |
531 } | 528 } |
532 } | 529 } |
OLD | NEW |