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

Side by Side Diff: third_party/WebKit/Source/modules/webusb/USBConnectionEvent.cpp

Issue 2348703003: Update USBConnectionEvent.idl to match the spec. (Closed)
Patch Set: Add tests. Created 4 years, 2 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 #include "modules/webusb/USBConnectionEvent.h" 5 #include "modules/webusb/USBConnectionEvent.h"
6 6
7 #include "modules/webusb/USBConnectionEventInit.h" 7 #include "modules/webusb/USBConnectionEventInit.h"
8 #include "modules/webusb/USBDevice.h" 8 #include "modules/webusb/USBDevice.h"
9 9
10 namespace blink { 10 namespace blink {
11 11
12 USBConnectionEvent* USBConnectionEvent::create(const AtomicString& type, const U SBConnectionEventInit& initializer) 12 USBConnectionEvent* USBConnectionEvent::create(const AtomicString& type, const U SBConnectionEventInit& initializer)
13 { 13 {
14 return new USBConnectionEvent(type, initializer); 14 return new USBConnectionEvent(type, initializer);
15 } 15 }
16 16
17 USBConnectionEvent* USBConnectionEvent::create(const AtomicString& type, USBDevi ce* device) 17 USBConnectionEvent* USBConnectionEvent::create(const AtomicString& type, USBDevi ce* device)
18 { 18 {
19 return new USBConnectionEvent(type, device); 19 return new USBConnectionEvent(type, device);
20 } 20 }
21 21
22 USBConnectionEvent::USBConnectionEvent(const AtomicString& type, const USBConnec tionEventInit& initializer) 22 USBConnectionEvent::USBConnectionEvent(const AtomicString& type, const USBConnec tionEventInit& initializer)
23 : Event(type, initializer) 23 : Event(type, initializer)
24 , m_device(nullptr) 24 , m_device(initializer.device())
25 { 25 {
26 if (initializer.hasDevice())
27 m_device = initializer.device();
28 } 26 }
29 27
30 USBConnectionEvent::USBConnectionEvent(const AtomicString& type, USBDevice* devi ce) 28 USBConnectionEvent::USBConnectionEvent(const AtomicString& type, USBDevice* devi ce)
31 : Event(type, false, false) 29 : Event(type, false, false)
32 , m_device(device) 30 , m_device(device)
33 { 31 {
34 } 32 }
35 33
36 DEFINE_TRACE(USBConnectionEvent) 34 DEFINE_TRACE(USBConnectionEvent)
37 { 35 {
38 visitor->trace(m_device); 36 visitor->trace(m_device);
39 Event::trace(visitor); 37 Event::trace(visitor);
40 } 38 }
41 39
42 } // namespace blink 40 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698