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

Side by Side Diff: chrome/browser/extensions/api/usb/usb_device_resource.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 (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/usb/usb_device_resource.h" 5 #include "chrome/browser/extensions/api/usb/usb_device_resource.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/bind_helpers.h" 11 #include "base/bind_helpers.h"
12 #include "base/synchronization/lock.h" 12 #include "base/synchronization/lock.h"
13 #include "chrome/browser/extensions/api/api_resource.h" 13 #include "chrome/browser/extensions/api/api_resource.h"
14 #include "chrome/browser/usb/usb_device_handle.h" 14 #include "chrome/browser/usb/usb_device_handle.h"
15 #include "chrome/common/extensions/api/usb.h" 15 #include "chrome/common/extensions/api/usb.h"
16 #include "content/public/browser/browser_thread.h" 16 #include "content/public/browser/browser_thread.h"
17 17
18 using content::BrowserThread; 18 using content::BrowserThread;
19 19
20 namespace extensions { 20 namespace extensions {
21 21
22 static base::LazyInstance<ProfileKeyedAPIFactory< 22 static base::LazyInstance<
23 ApiResourceManager<UsbDeviceResource> > > 23 BrowserContextKeyedAPIFactory<ApiResourceManager<UsbDeviceResource> > >
24 g_factory = LAZY_INSTANCE_INITIALIZER; 24 g_factory = LAZY_INSTANCE_INITIALIZER;
25 25
26 // static 26 // static
27 template <> 27 template <>
28 ProfileKeyedAPIFactory<ApiResourceManager<UsbDeviceResource> >* 28 BrowserContextKeyedAPIFactory<ApiResourceManager<UsbDeviceResource> >*
29 ApiResourceManager<UsbDeviceResource>::GetFactoryInstance() { 29 ApiResourceManager<UsbDeviceResource>::GetFactoryInstance() {
30 return g_factory.Pointer(); 30 return g_factory.Pointer();
31 } 31 }
32 32
33 UsbDeviceResource::UsbDeviceResource(const std::string& owner_extension_id, 33 UsbDeviceResource::UsbDeviceResource(const std::string& owner_extension_id,
34 scoped_refptr<UsbDeviceHandle> device) 34 scoped_refptr<UsbDeviceHandle> device)
35 : ApiResource(owner_extension_id), device_(device) {} 35 : ApiResource(owner_extension_id), device_(device) {}
36 36
37 UsbDeviceResource::~UsbDeviceResource() { 37 UsbDeviceResource::~UsbDeviceResource() {
38 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, 38 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE,
39 base::Bind(&UsbDeviceHandle::Close, device_)); 39 base::Bind(&UsbDeviceHandle::Close, device_));
40 } 40 }
41 41
42 } // namespace extensions 42 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698