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

Side by Side Diff: chrome/browser/extensions/api/media_galleries_private/media_galleries_private_api.cc

Issue 178193030: Rename ProfileKeyedAPI to BrowserContextKeyedAPI and GetProfile to Get. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 (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/api/media_galleries_private/media_galleries_ private_api.h" 5 #include "chrome/browser/extensions/api/media_galleries_private/media_galleries_ private_api.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 } 98 }
99 99
100 void MediaGalleriesPrivateAPI::Shutdown() { 100 void MediaGalleriesPrivateAPI::Shutdown() {
101 ExtensionSystem::Get(profile_)->event_router()->UnregisterObserver(this); 101 ExtensionSystem::Get(profile_)->event_router()->UnregisterObserver(this);
102 weak_ptr_factory_.InvalidateWeakPtrs(); 102 weak_ptr_factory_.InvalidateWeakPtrs();
103 content::BrowserThread::PostTask( 103 content::BrowserThread::PostTask(
104 content::BrowserThread::FILE, FROM_HERE, 104 content::BrowserThread::FILE, FROM_HERE,
105 base::Bind(&HandleProfileShutdownOnFileThread, profile_)); 105 base::Bind(&HandleProfileShutdownOnFileThread, profile_));
106 } 106 }
107 107
108 static base::LazyInstance<ProfileKeyedAPIFactory<MediaGalleriesPrivateAPI> > 108 static base::LazyInstance<
109 g_factory = LAZY_INSTANCE_INITIALIZER; 109 BrowserContextKeyedAPIFactory<MediaGalleriesPrivateAPI> > g_factory =
110 LAZY_INSTANCE_INITIALIZER;
110 111
111 // static 112 // static
112 ProfileKeyedAPIFactory<MediaGalleriesPrivateAPI>* 113 BrowserContextKeyedAPIFactory<MediaGalleriesPrivateAPI>*
113 MediaGalleriesPrivateAPI::GetFactoryInstance() { 114 MediaGalleriesPrivateAPI::GetFactoryInstance() {
114 return g_factory.Pointer(); 115 return g_factory.Pointer();
115 } 116 }
116 117
117 // static 118 // static
118 MediaGalleriesPrivateAPI* MediaGalleriesPrivateAPI::Get( 119 MediaGalleriesPrivateAPI* MediaGalleriesPrivateAPI::Get(
119 content::BrowserContext* context) { 120 content::BrowserContext* context) {
120 return ProfileKeyedAPIFactory<MediaGalleriesPrivateAPI>::GetForProfile( 121 return BrowserContextKeyedAPIFactory<MediaGalleriesPrivateAPI>::Get(context);
121 context);
122 } 122 }
123 123
124 void MediaGalleriesPrivateAPI::OnListenerAdded( 124 void MediaGalleriesPrivateAPI::OnListenerAdded(
125 const EventListenerInfo& details) { 125 const EventListenerInfo& details) {
126 // Make sure MediaGalleriesPreferences is initialized. After that, 126 // Make sure MediaGalleriesPreferences is initialized. After that,
127 // try to initialize the event router for the listener. 127 // try to initialize the event router for the listener.
128 // This method is called synchronously with the message handler for the 128 // This method is called synchronously with the message handler for the
129 // JS invocation. 129 // JS invocation.
130 130
131 MediaGalleriesPreferences* preferences = 131 MediaGalleriesPreferences* preferences =
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 } 418 }
419 } 419 }
420 420
421 SetResult(result_list); 421 SetResult(result_list);
422 SendResponse(true); 422 SendResponse(true);
423 423
424 return true; 424 return true;
425 } 425 }
426 426
427 } // namespace extensions 427 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698