| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/api/sockets_udp/udp_socket_event_dispatcher.
h" | 5 #include "chrome/browser/extensions/api/sockets_udp/udp_socket_event_dispatcher.
h" |
| 6 | 6 |
| 7 #include "chrome/browser/browser_process.h" | 7 #include "chrome/browser/browser_process.h" |
| 8 #include "chrome/browser/extensions/api/socket/udp_socket.h" | 8 #include "chrome/browser/extensions/api/socket/udp_socket.h" |
| 9 #include "chrome/browser/extensions/extension_system.h" | 9 #include "chrome/browser/extensions/extension_system.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| 11 #include "chrome/browser/profiles/profile_manager.h" | 11 #include "chrome/browser/profiles/profile_manager.h" |
| 12 #include "extensions/browser/event_router.h" | 12 #include "extensions/browser/event_router.h" |
| 13 #include "net/base/net_errors.h" | 13 #include "net/base/net_errors.h" |
| 14 | 14 |
| 15 namespace extensions { | 15 namespace extensions { |
| 16 namespace api { | 16 namespace api { |
| 17 | 17 |
| 18 using content::BrowserThread; | 18 using content::BrowserThread; |
| 19 | 19 |
| 20 static base::LazyInstance<ProfileKeyedAPIFactory<UDPSocketEventDispatcher> > | 20 static base::LazyInstance<ProfileKeyedAPIFactory<UDPSocketEventDispatcher> > |
| 21 g_factory = LAZY_INSTANCE_INITIALIZER; | 21 g_factory = LAZY_INSTANCE_INITIALIZER; |
| 22 | 22 |
| 23 // static | 23 // static |
| 24 ProfileKeyedAPIFactory<UDPSocketEventDispatcher>* | 24 ProfileKeyedAPIFactory<UDPSocketEventDispatcher>* |
| 25 UDPSocketEventDispatcher::GetFactoryInstance() { | 25 UDPSocketEventDispatcher::GetFactoryInstance() { |
| 26 return &g_factory.Get(); | 26 return g_factory.Pointer(); |
| 27 } | 27 } |
| 28 | 28 |
| 29 // static | 29 // static |
| 30 UDPSocketEventDispatcher* UDPSocketEventDispatcher::Get(Profile* profile) { | 30 UDPSocketEventDispatcher* UDPSocketEventDispatcher::Get(Profile* profile) { |
| 31 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 31 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 32 | 32 |
| 33 return ProfileKeyedAPIFactory<UDPSocketEventDispatcher>::GetForProfile( | 33 return ProfileKeyedAPIFactory<UDPSocketEventDispatcher>::GetForProfile( |
| 34 profile); | 34 profile); |
| 35 } | 35 } |
| 36 | 36 |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 if (!g_browser_process->profile_manager()->IsValidProfile(profile)) | 173 if (!g_browser_process->profile_manager()->IsValidProfile(profile)) |
| 174 return; | 174 return; |
| 175 | 175 |
| 176 EventRouter* router = ExtensionSystem::Get(profile)->event_router(); | 176 EventRouter* router = ExtensionSystem::Get(profile)->event_router(); |
| 177 if (router) | 177 if (router) |
| 178 router->DispatchEventToExtension(extension_id, event.Pass()); | 178 router->DispatchEventToExtension(extension_id, event.Pass()); |
| 179 } | 179 } |
| 180 | 180 |
| 181 } // namespace api | 181 } // namespace api |
| 182 } // namespace extensions | 182 } // namespace extensions |
| OLD | NEW |