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

Side by Side Diff: Source/modules/webusb/USBDevice.h

Issue 1288793003: WebUSB: Create a requestDevice method separate from getDevice. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Update stale reference in modules.gypi. Created 5 years, 4 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
« no previous file with comments | « Source/modules/webusb/USB.idl ('k') | Source/modules/webusb/USBDeviceEnumerationOptions.idl » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #ifndef USBDevice_h 5 #ifndef USBDevice_h
6 #define USBDevice_h 6 #define USBDevice_h
7 7
8 #include "bindings/core/v8/ScriptWrappable.h" 8 #include "bindings/core/v8/ScriptWrappable.h"
9 #include "platform/heap/Handle.h" 9 #include "platform/heap/Handle.h"
10 #include "public/platform/modules/webusb/WebUSBDevice.h" 10 #include "public/platform/modules/webusb/WebUSBDevice.h"
11 #include "public/platform/modules/webusb/WebUSBDeviceInfo.h" 11 #include "public/platform/modules/webusb/WebUSBDeviceInfo.h"
12 12
13 namespace blink { 13 namespace blink {
14 14
15 class ScriptPromiseResolver;
15 class USBConfiguration; 16 class USBConfiguration;
16 17
17 class USBDevice 18 class USBDevice
18 : public GarbageCollectedFinalized<USBDevice> 19 : public GarbageCollectedFinalized<USBDevice>
19 , public ScriptWrappable { 20 , public ScriptWrappable {
20 DEFINE_WRAPPERTYPEINFO(); 21 DEFINE_WRAPPERTYPEINFO();
21 public: 22 public:
22 using WebType = WebUSBDeviceInfo; 23 using WebType = OwnPtr<WebUSBDevice>;
23 24
24 static USBDevice* create(PassOwnPtr<WebUSBDevice> device) 25 static USBDevice* create(PassOwnPtr<WebUSBDevice> device)
25 { 26 {
26 return new USBDevice(device); 27 return new USBDevice(device);
27 } 28 }
28 29
30 static USBDevice* take(ScriptPromiseResolver*, PassOwnPtr<WebUSBDevice> devi ce)
31 {
32 return create(device);
33 }
34
29 explicit USBDevice(PassOwnPtr<WebUSBDevice> device) 35 explicit USBDevice(PassOwnPtr<WebUSBDevice> device)
30 : m_device(device) 36 : m_device(device)
31 { 37 {
32 } 38 }
33 39
34 virtual ~USBDevice() { } 40 virtual ~USBDevice() { }
35 41
36 const WebUSBDeviceInfo& info() const { return m_device->info(); } 42 const WebUSBDeviceInfo& info() const { return m_device->info(); }
37 43
38 String guid() const { return info().guid; } 44 String guid() const { return info().guid; }
(...skipping 15 matching lines...) Expand all
54 60
55 DEFINE_INLINE_TRACE() { } 61 DEFINE_INLINE_TRACE() { }
56 62
57 private: 63 private:
58 OwnPtr<WebUSBDevice> m_device; 64 OwnPtr<WebUSBDevice> m_device;
59 }; 65 };
60 66
61 } // namespace blink 67 } // namespace blink
62 68
63 #endif // USBDevice_h 69 #endif // USBDevice_h
OLDNEW
« no previous file with comments | « Source/modules/webusb/USB.idl ('k') | Source/modules/webusb/USBDeviceEnumerationOptions.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698