OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "config.h" | |
6 #include "modules/webusb/NavigatorUSB.h" | |
7 | |
8 #include "core/frame/Navigator.h" | |
9 #include "modules/webusb/USB.h" | |
10 | |
11 namespace blink { | |
12 | |
13 NavigatorUSB& NavigatorUSB::from(Navigator& navigator) | |
14 { | |
15 NavigatorUSB* supplement = static_cast<NavigatorUSB*>(HeapSupplement<Navigat or>::from(navigator, supplementName())); | |
16 if (!supplement) { | |
17 supplement = new NavigatorUSB(navigator); | |
18 provideTo(navigator, supplementName(), supplement); | |
19 } | |
20 return *supplement; | |
21 } | |
22 | |
23 USB* NavigatorUSB::usb(Navigator& navigator) | |
24 { | |
25 return NavigatorUSB::from(navigator).usb(); | |
26 } | |
27 | |
28 USB* NavigatorUSB::usb() | |
29 { | |
30 return m_usb; | |
31 } | |
32 | |
33 DEFINE_TRACE(NavigatorUSB) | |
34 { | |
35 visitor->trace(m_usb); | |
36 HeapSupplement<Navigator>::trace(visitor); | |
37 } | |
38 | |
39 NavigatorUSB::NavigatorUSB(Navigator& navigator) | |
40 { | |
41 if (navigator.frame()) | |
haraken
2015/07/30 20:17:59
Actually I'm not sure if we should expect that Nav
Ken Rockot(use gerrit already)
2015/07/30 21:10:34
OK thought maybe this was true. Done.
Ken Rockot(use gerrit already)
2015/07/30 23:23:05
So actually there are layout tests which seem to e
| |
42 m_usb = USB::create(*navigator.frame()); | |
43 } | |
44 | |
45 const char* NavigatorUSB::supplementName() | |
46 { | |
47 return "NavigatorUSB"; | |
48 } | |
49 | |
50 } // namespace blink | |
OLD | NEW |