OLD | NEW |
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/USBController.h" | 5 #include "modules/webusb/USBController.h" |
6 | 6 |
7 #include "platform/RuntimeEnabledFeatures.h" | 7 #include "platform/RuntimeEnabledFeatures.h" |
8 #include "public/platform/modules/webusb/WebUSBClient.h" | 8 #include "public/platform/modules/webusb/WebUSBClient.h" |
9 | 9 |
10 namespace blink { | 10 namespace blink { |
11 | 11 |
12 USBController::~USBController() | 12 USBController::~USBController() |
13 { | 13 { |
14 } | 14 } |
15 | 15 |
16 void USBController::provideTo(LocalFrame& frame, WebUSBClient* client) | 16 void USBController::provideTo(LocalFrame& frame, WebUSBClient* client) |
17 { | 17 { |
18 ASSERT(RuntimeEnabledFeatures::webUSBEnabled()); | |
19 USBController* controller = new USBController(frame, client); | 18 USBController* controller = new USBController(frame, client); |
20 Supplement<LocalFrame>::provideTo(frame, supplementName(), controller); | 19 Supplement<LocalFrame>::provideTo(frame, supplementName(), controller); |
21 } | 20 } |
22 | 21 |
23 USBController& USBController::from(LocalFrame& frame) | 22 USBController& USBController::from(LocalFrame& frame) |
24 { | 23 { |
25 USBController* controller = static_cast<USBController*>(Supplement<LocalFram
e>::from(frame, supplementName())); | 24 USBController* controller = static_cast<USBController*>(Supplement<LocalFram
e>::from(frame, supplementName())); |
26 ASSERT(controller); | 25 ASSERT(controller); |
27 return *controller; | 26 return *controller; |
28 } | 27 } |
(...skipping 14 matching lines...) Expand all Loading... |
43 m_client = nullptr; | 42 m_client = nullptr; |
44 } | 43 } |
45 | 44 |
46 DEFINE_TRACE(USBController) | 45 DEFINE_TRACE(USBController) |
47 { | 46 { |
48 Supplement<LocalFrame>::trace(visitor); | 47 Supplement<LocalFrame>::trace(visitor); |
49 LocalFrameLifecycleObserver::trace(visitor); | 48 LocalFrameLifecycleObserver::trace(visitor); |
50 } | 49 } |
51 | 50 |
52 } // namespace blink | 51 } // namespace blink |
OLD | NEW |