OLD | NEW |
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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 | 77 |
78 | 78 |
79 /////////////////////////////////////////////////////////////////////////////// | 79 /////////////////////////////////////////////////////////////////////////////// |
80 // MediaGalleriesPrivateAPI // | 80 // MediaGalleriesPrivateAPI // |
81 /////////////////////////////////////////////////////////////////////////////// | 81 /////////////////////////////////////////////////////////////////////////////// |
82 | 82 |
83 MediaGalleriesPrivateAPI::MediaGalleriesPrivateAPI( | 83 MediaGalleriesPrivateAPI::MediaGalleriesPrivateAPI( |
84 content::BrowserContext* context) | 84 content::BrowserContext* context) |
85 : profile_(Profile::FromBrowserContext(context)), weak_ptr_factory_(this) { | 85 : profile_(Profile::FromBrowserContext(context)), weak_ptr_factory_(this) { |
86 DCHECK(profile_); | 86 DCHECK(profile_); |
87 EventRouter* event_router = ExtensionSystem::Get(profile_)->event_router(); | 87 EventRouter* event_router = EventRouter::Get(profile_); |
88 event_router->RegisterObserver( | 88 event_router->RegisterObserver( |
89 this, media_galleries_private::OnGalleryChanged::kEventName); | 89 this, media_galleries_private::OnGalleryChanged::kEventName); |
90 } | 90 } |
91 | 91 |
92 MediaGalleriesPrivateAPI::~MediaGalleriesPrivateAPI() { | 92 MediaGalleriesPrivateAPI::~MediaGalleriesPrivateAPI() { |
93 } | 93 } |
94 | 94 |
95 void MediaGalleriesPrivateAPI::Shutdown() { | 95 void MediaGalleriesPrivateAPI::Shutdown() { |
96 ExtensionSystem::Get(profile_)->event_router()->UnregisterObserver(this); | 96 EventRouter::Get(profile_)->UnregisterObserver(this); |
97 weak_ptr_factory_.InvalidateWeakPtrs(); | 97 weak_ptr_factory_.InvalidateWeakPtrs(); |
98 content::BrowserThread::PostTask( | 98 content::BrowserThread::PostTask( |
99 content::BrowserThread::FILE, FROM_HERE, | 99 content::BrowserThread::FILE, FROM_HERE, |
100 base::Bind(&HandleProfileShutdownOnFileThread, profile_)); | 100 base::Bind(&HandleProfileShutdownOnFileThread, profile_)); |
101 } | 101 } |
102 | 102 |
103 static base::LazyInstance< | 103 static base::LazyInstance< |
104 BrowserContextKeyedAPIFactory<MediaGalleriesPrivateAPI> > g_factory = | 104 BrowserContextKeyedAPIFactory<MediaGalleriesPrivateAPI> > g_factory = |
105 LAZY_INSTANCE_INITIALIZER; | 105 LAZY_INSTANCE_INITIALIZER; |
106 | 106 |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 } | 413 } |
414 } | 414 } |
415 | 415 |
416 SetResult(result_list); | 416 SetResult(result_list); |
417 SendResponse(true); | 417 SendResponse(true); |
418 | 418 |
419 return true; | 419 return true; |
420 } | 420 } |
421 | 421 |
422 } // namespace extensions | 422 } // namespace extensions |
OLD | NEW |