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

Side by Side Diff: third_party/WebKit/Source/modules/webusb/USB.h

Issue 1963183003: WebUSB: Remove guid property from USBDevice. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update webexposed. Created 4 years, 7 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
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 USB_h 5 #ifndef USB_h
6 #define USB_h 6 #define USB_h
7 7
8 #include "bindings/core/v8/ScriptPromise.h" 8 #include "bindings/core/v8/ScriptPromise.h"
9 #include "bindings/core/v8/ScriptWrappable.h" 9 #include "bindings/core/v8/ScriptWrappable.h"
10 #include "core/dom/ContextLifecycleObserver.h" 10 #include "core/dom/ContextLifecycleObserver.h"
11 #include "core/events/EventTarget.h" 11 #include "core/events/EventTarget.h"
12 #include "device/usb/public/interfaces/chooser_service.mojom-blink.h" 12 #include "device/usb/public/interfaces/chooser_service.mojom-blink.h"
13 #include "device/usb/public/interfaces/device_manager.mojom-blink.h" 13 #include "device/usb/public/interfaces/device_manager.mojom-blink.h"
14 #include "mojo/public/cpp/bindings/binding.h" 14 #include "mojo/public/cpp/bindings/binding.h"
15 #include "platform/heap/Handle.h" 15 #include "platform/heap/Handle.h"
16 16
17 namespace blink { 17 namespace blink {
18 18
19 class LocalFrame; 19 class LocalFrame;
20 class ScopedScriptPromiseResolver; 20 class ScopedScriptPromiseResolver;
21 class ScriptState; 21 class ScriptState;
22 class USBDevice;
22 class USBDeviceRequestOptions; 23 class USBDeviceRequestOptions;
23 24
24 class USB final 25 class USB final
25 : public EventTargetWithInlineData 26 : public EventTargetWithInlineData
26 , public ContextLifecycleObserver 27 , public ContextLifecycleObserver
27 , public device::usb::blink::DeviceManagerClient { 28 , public device::usb::blink::DeviceManagerClient {
28 DEFINE_WRAPPERTYPEINFO(); 29 DEFINE_WRAPPERTYPEINFO();
29 USING_GARBAGE_COLLECTED_MIXIN(USB); 30 USING_GARBAGE_COLLECTED_MIXIN(USB);
30 USING_PRE_FINALIZER(USB, dispose); 31 USING_PRE_FINALIZER(USB, dispose);
31 public: 32 public:
(...skipping 12 matching lines...) Expand all
44 DEFINE_ATTRIBUTE_EVENT_LISTENER(connect); 45 DEFINE_ATTRIBUTE_EVENT_LISTENER(connect);
45 DEFINE_ATTRIBUTE_EVENT_LISTENER(disconnect); 46 DEFINE_ATTRIBUTE_EVENT_LISTENER(disconnect);
46 47
47 // EventTarget overrides. 48 // EventTarget overrides.
48 ExecutionContext* getExecutionContext() const override; 49 ExecutionContext* getExecutionContext() const override;
49 const AtomicString& interfaceName() const override; 50 const AtomicString& interfaceName() const override;
50 51
51 // ContextLifecycleObserver overrides. 52 // ContextLifecycleObserver overrides.
52 void contextDestroyed() override; 53 void contextDestroyed() override;
53 54
54 // DeviceManagerClient implementation. 55 USBDevice* getOrCreateDevice(device::usb::blink::DeviceInfoPtr);
55 void OnDeviceAdded(device::usb::blink::DeviceInfoPtr);
56 void OnDeviceRemoved(device::usb::blink::DeviceInfoPtr);
57 56
58 device::usb::blink::DeviceManager* deviceManager() const { return m_deviceMa nager.get(); } 57 device::usb::blink::DeviceManager* deviceManager() const { return m_deviceMa nager.get(); }
59 58
60 void onGetDevices(ScriptPromiseResolver*, mojo::WTFArray<device::usb::blink: :DeviceInfoPtr>); 59 void onGetDevices(ScriptPromiseResolver*, mojo::WTFArray<device::usb::blink: :DeviceInfoPtr>);
61 void onGetPermission(ScriptPromiseResolver*, device::usb::blink::DeviceInfoP tr); 60 void onGetPermission(ScriptPromiseResolver*, device::usb::blink::DeviceInfoP tr);
62 61
62 // DeviceManagerClient implementation.
63 void OnDeviceAdded(device::usb::blink::DeviceInfoPtr);
64 void OnDeviceRemoved(device::usb::blink::DeviceInfoPtr);
65
63 void onDeviceManagerConnectionError(); 66 void onDeviceManagerConnectionError();
64 void onChooserServiceConnectionError(); 67 void onChooserServiceConnectionError();
65 68
66 DECLARE_VIRTUAL_TRACE(); 69 DECLARE_VIRTUAL_TRACE();
67 70
68 private: 71 private:
69 explicit USB(LocalFrame& frame); 72 explicit USB(LocalFrame& frame);
70 73
71 device::usb::blink::DeviceManagerPtr m_deviceManager; 74 device::usb::blink::DeviceManagerPtr m_deviceManager;
72 HeapHashSet<Member<ScriptPromiseResolver>> m_deviceManagerRequests; 75 HeapHashSet<Member<ScriptPromiseResolver>> m_deviceManagerRequests;
73 device::usb::blink::ChooserServicePtr m_chooserService; 76 device::usb::blink::ChooserServicePtr m_chooserService;
74 HeapHashSet<Member<ScriptPromiseResolver>> m_chooserServiceRequests; 77 HeapHashSet<Member<ScriptPromiseResolver>> m_chooserServiceRequests;
75 mojo::Binding<device::usb::blink::DeviceManagerClient> m_clientBinding; 78 mojo::Binding<device::usb::blink::DeviceManagerClient> m_clientBinding;
79 HeapHashMap<String, WeakMember<USBDevice>> m_deviceCache;
76 }; 80 };
77 81
78 } // namespace blink 82 } // namespace blink
79 83
80 #endif // USB_h 84 #endif // USB_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698