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

Side by Side Diff: chrome/browser/extensions/api/usb/usb_device_resource.cc

Issue 16316004: Separate usb device handle from usb device. (deprecate) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix Windows compile and a bug. Created 7 years, 6 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.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 16
17 namespace extensions { 17 namespace extensions {
18 18
19 namespace {
20
21 void EmptyCallback() { }
22
23 } // namepsace
24
19 UsbDeviceResource::UsbDeviceResource(const std::string& owner_extension_id, 25 UsbDeviceResource::UsbDeviceResource(const std::string& owner_extension_id,
20 scoped_refptr<UsbDevice> device) 26 scoped_refptr<UsbDeviceHandle> device)
21 : ApiResource(owner_extension_id), device_(device) {} 27 : ApiResource(owner_extension_id), device_(device) {}
22 28
23 UsbDeviceResource::~UsbDeviceResource() {} 29 UsbDeviceResource::~UsbDeviceResource() {
30 device_->Close(base::Bind(&EmptyCallback));
31 }
24 32
25 } // namespace extensions 33 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698