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 "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
8 #include "extensions/browser/api/socket/udp_socket.h" | 8 #include "extensions/browser/api/socket/udp_socket.h" |
9 #include "extensions/browser/event_router.h" | 9 #include "extensions/browser/event_router.h" |
10 #include "extensions/browser/extensions_browser_client.h" | 10 #include "extensions/browser/extensions_browser_client.h" |
11 #include "net/base/net_errors.h" | 11 #include "net/base/net_errors.h" |
12 | 12 |
13 namespace extensions { | 13 namespace extensions { |
14 namespace core_api { | 14 namespace api { |
15 | 15 |
16 using content::BrowserThread; | 16 using content::BrowserThread; |
17 | 17 |
18 static base::LazyInstance< | 18 static base::LazyInstance< |
19 BrowserContextKeyedAPIFactory<UDPSocketEventDispatcher> > g_factory = | 19 BrowserContextKeyedAPIFactory<UDPSocketEventDispatcher> > g_factory = |
20 LAZY_INSTANCE_INITIALIZER; | 20 LAZY_INSTANCE_INITIALIZER; |
21 | 21 |
22 // static | 22 // static |
23 BrowserContextKeyedAPIFactory<UDPSocketEventDispatcher>* | 23 BrowserContextKeyedAPIFactory<UDPSocketEventDispatcher>* |
24 UDPSocketEventDispatcher::GetFactoryInstance() { | 24 UDPSocketEventDispatcher::GetFactoryInstance() { |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 | 174 |
175 content::BrowserContext* context = | 175 content::BrowserContext* context = |
176 reinterpret_cast<content::BrowserContext*>(browser_context_id); | 176 reinterpret_cast<content::BrowserContext*>(browser_context_id); |
177 if (!extensions::ExtensionsBrowserClient::Get()->IsValidContext(context)) | 177 if (!extensions::ExtensionsBrowserClient::Get()->IsValidContext(context)) |
178 return; | 178 return; |
179 EventRouter* router = EventRouter::Get(context); | 179 EventRouter* router = EventRouter::Get(context); |
180 if (router) | 180 if (router) |
181 router->DispatchEventToExtension(extension_id, event.Pass()); | 181 router->DispatchEventToExtension(extension_id, event.Pass()); |
182 } | 182 } |
183 | 183 |
184 } // namespace core_api | 184 } // namespace api |
185 } // namespace extensions | 185 } // namespace extensions |
OLD | NEW |