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/event_router_forwarder.h" | 5 #include "chrome/browser/extensions/event_router_forwarder.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/values.h" | 8 #include "base/values.h" |
9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
10 #include "chrome/browser/extensions/event_router.h" | 10 #include "chrome/browser/extensions/event_router.h" |
| 11 #include "chrome/browser/extensions/extension_system.h" |
11 #include "chrome/browser/profiles/profile_manager.h" | 12 #include "chrome/browser/profiles/profile_manager.h" |
12 #include "googleurl/src/gurl.h" | 13 #include "googleurl/src/gurl.h" |
13 | 14 |
14 using content::BrowserThread; | 15 using content::BrowserThread; |
15 | 16 |
16 namespace extensions { | 17 namespace extensions { |
17 | 18 |
18 EventRouterForwarder::EventRouterForwarder() { | 19 EventRouterForwarder::EventRouterForwarder() { |
19 } | 20 } |
20 | 21 |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 | 102 |
102 void EventRouterForwarder::CallEventRouter(Profile* profile, | 103 void EventRouterForwarder::CallEventRouter(Profile* profile, |
103 const std::string& extension_id, | 104 const std::string& extension_id, |
104 const std::string& event_name, | 105 const std::string& event_name, |
105 scoped_ptr<ListValue> event_args, | 106 scoped_ptr<ListValue> event_args, |
106 Profile* restrict_to_profile, | 107 Profile* restrict_to_profile, |
107 const GURL& event_url) { | 108 const GURL& event_url) { |
108 // We may not have an extension in cases like chromeos login | 109 // We may not have an extension in cases like chromeos login |
109 // (crosbug.com/12856), chrome_frame_net_tests.exe which reuses the chrome | 110 // (crosbug.com/12856), chrome_frame_net_tests.exe which reuses the chrome |
110 // browser single process framework. | 111 // browser single process framework. |
111 if (!profile->GetExtensionEventRouter()) | 112 if (!extensions::ExtensionSystem::Get(profile)->event_router()) |
112 return; | 113 return; |
113 | 114 |
114 if (extension_id.empty()) { | 115 if (extension_id.empty()) { |
115 profile->GetExtensionEventRouter()-> | 116 extensions::ExtensionSystem::Get(profile)->event_router()-> |
116 DispatchEventToRenderers( | 117 DispatchEventToRenderers( |
117 event_name, event_args.Pass(), restrict_to_profile, event_url, | 118 event_name, event_args.Pass(), restrict_to_profile, event_url, |
118 EventFilteringInfo()); | 119 EventFilteringInfo()); |
119 } else { | 120 } else { |
120 profile->GetExtensionEventRouter()-> | 121 extensions::ExtensionSystem::Get(profile)->event_router()-> |
121 DispatchEventToExtension( | 122 DispatchEventToExtension( |
122 extension_id, | 123 extension_id, |
123 event_name, event_args.Pass(), restrict_to_profile, event_url); | 124 event_name, event_args.Pass(), restrict_to_profile, event_url); |
124 } | 125 } |
125 } | 126 } |
126 | 127 |
127 } // namespace extensions | 128 } // namespace extensions |
OLD | NEW |