OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "extensions/browser/api/sockets_udp/udp_socket_event_dispatcher.h" | 5 #include "extensions/browser/api/sockets_udp/udp_socket_event_dispatcher.h" |
6 | 6 |
7 #include "extensions/browser/api/socket/udp_socket.h" | 7 #include "extensions/browser/api/socket/udp_socket.h" |
8 #include "extensions/browser/event_router.h" | 8 #include "extensions/browser/event_router.h" |
9 #include "extensions/browser/extension_system.h" | |
10 #include "extensions/browser/extensions_browser_client.h" | 9 #include "extensions/browser/extensions_browser_client.h" |
11 #include "net/base/net_errors.h" | 10 #include "net/base/net_errors.h" |
12 | 11 |
13 namespace extensions { | 12 namespace extensions { |
14 namespace core_api { | 13 namespace core_api { |
15 | 14 |
16 using content::BrowserThread; | 15 using content::BrowserThread; |
17 | 16 |
18 static base::LazyInstance< | 17 static base::LazyInstance< |
19 BrowserContextKeyedAPIFactory<UDPSocketEventDispatcher> > g_factory = | 18 BrowserContextKeyedAPIFactory<UDPSocketEventDispatcher> > g_factory = |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 /*static*/ | 166 /*static*/ |
168 void UDPSocketEventDispatcher::DispatchEvent(void* browser_context_id, | 167 void UDPSocketEventDispatcher::DispatchEvent(void* browser_context_id, |
169 const std::string& extension_id, | 168 const std::string& extension_id, |
170 scoped_ptr<Event> event) { | 169 scoped_ptr<Event> event) { |
171 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 170 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
172 | 171 |
173 content::BrowserContext* context = | 172 content::BrowserContext* context = |
174 reinterpret_cast<content::BrowserContext*>(browser_context_id); | 173 reinterpret_cast<content::BrowserContext*>(browser_context_id); |
175 if (!extensions::ExtensionsBrowserClient::Get()->IsValidContext(context)) | 174 if (!extensions::ExtensionsBrowserClient::Get()->IsValidContext(context)) |
176 return; | 175 return; |
177 EventRouter* router = ExtensionSystem::Get(context)->event_router(); | 176 EventRouter* router = EventRouter::Get(context); |
178 if (router) | 177 if (router) |
179 router->DispatchEventToExtension(extension_id, event.Pass()); | 178 router->DispatchEventToExtension(extension_id, event.Pass()); |
180 } | 179 } |
181 | 180 |
182 } // namespace core_api | 181 } // namespace core_api |
183 } // namespace extensions | 182 } // namespace extensions |
OLD | NEW |