Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(45)

Side by Side Diff: chrome/browser/extensions/api/sockets_tcp/tcp_socket_event_dispatcher.cc

Issue 178193030: Rename ProfileKeyedAPI to BrowserContextKeyedAPI and GetProfile to Get. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nits Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_tcp/tcp_socket_event_dispatcher. h" 5 #include "chrome/browser/extensions/api/sockets_tcp/tcp_socket_event_dispatcher. h"
6 6
7 #include "chrome/browser/extensions/api/socket/tcp_socket.h" 7 #include "chrome/browser/extensions/api/socket/tcp_socket.h"
8 #include "extensions/browser/event_router.h" 8 #include "extensions/browser/event_router.h"
9 #include "extensions/browser/extension_system.h" 9 #include "extensions/browser/extension_system.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 { 13 namespace {
14 int kDefaultBufferSize = 4096; 14 int kDefaultBufferSize = 4096;
15 } 15 }
16 16
17 namespace extensions { 17 namespace extensions {
18 namespace api { 18 namespace api {
19 19
20 using content::BrowserThread; 20 using content::BrowserThread;
21 21
22 static base::LazyInstance<ProfileKeyedAPIFactory<TCPSocketEventDispatcher> > 22 static base::LazyInstance<
23 g_factory = LAZY_INSTANCE_INITIALIZER; 23 BrowserContextKeyedAPIFactory<TCPSocketEventDispatcher> > g_factory =
24 LAZY_INSTANCE_INITIALIZER;
24 25
25 // static 26 // static
26 ProfileKeyedAPIFactory<TCPSocketEventDispatcher>* 27 BrowserContextKeyedAPIFactory<TCPSocketEventDispatcher>*
27 TCPSocketEventDispatcher::GetFactoryInstance() { 28 TCPSocketEventDispatcher::GetFactoryInstance() {
28 return g_factory.Pointer(); 29 return g_factory.Pointer();
29 } 30 }
30 31
31 // static 32 // static
32 TCPSocketEventDispatcher* TCPSocketEventDispatcher::Get( 33 TCPSocketEventDispatcher* TCPSocketEventDispatcher::Get(
33 content::BrowserContext* context) { 34 content::BrowserContext* context) {
34 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 35 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
35 36
36 return ProfileKeyedAPIFactory<TCPSocketEventDispatcher>::GetForProfile( 37 return BrowserContextKeyedAPIFactory<TCPSocketEventDispatcher>::Get(context);
37 context);
38 } 38 }
39 39
40 TCPSocketEventDispatcher::TCPSocketEventDispatcher( 40 TCPSocketEventDispatcher::TCPSocketEventDispatcher(
41 content::BrowserContext* context) 41 content::BrowserContext* context)
42 : thread_id_(Socket::kThreadId), browser_context_(context) { 42 : thread_id_(Socket::kThreadId), browser_context_(context) {
43 ApiResourceManager<ResumableTCPSocket>* manager = 43 ApiResourceManager<ResumableTCPSocket>* manager =
44 ApiResourceManager<ResumableTCPSocket>::Get(browser_context_); 44 ApiResourceManager<ResumableTCPSocket>::Get(browser_context_);
45 DCHECK(manager) << "There is no socket manager. " 45 DCHECK(manager) << "There is no socket manager. "
46 "If this assertion is failing during a test, then it is likely that " 46 "If this assertion is failing during a test, then it is likely that "
47 "TestExtensionSystem is failing to provide an instance of " 47 "TestExtensionSystem is failing to provide an instance of "
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 if (!extensions::ExtensionsBrowserClient::Get()->IsValidContext(context)) 188 if (!extensions::ExtensionsBrowserClient::Get()->IsValidContext(context))
189 return; 189 return;
190 190
191 EventRouter* router = ExtensionSystem::Get(context)->event_router(); 191 EventRouter* router = ExtensionSystem::Get(context)->event_router();
192 if (router) 192 if (router)
193 router->DispatchEventToExtension(extension_id, event.Pass()); 193 router->DispatchEventToExtension(extension_id, event.Pass());
194 } 194 }
195 195
196 } // namespace api 196 } // namespace api
197 } // namespace extensions 197 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698