| 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 "modules/webusb/USBController.h" | |
| 6 | |
| 7 #include "platform/RuntimeEnabledFeatures.h" | |
| 8 #include "public/platform/modules/webusb/WebUSBClient.h" | |
| 9 | |
| 10 namespace blink { | |
| 11 | |
| 12 USBController::~USBController() | |
| 13 { | |
| 14 } | |
| 15 | |
| 16 void USBController::provideTo(LocalFrame& frame, WebUSBClient* client) | |
| 17 { | |
| 18 USBController* controller = new USBController(frame, client); | |
| 19 Supplement<LocalFrame>::provideTo(frame, supplementName(), controller); | |
| 20 } | |
| 21 | |
| 22 USBController& USBController::from(LocalFrame& frame) | |
| 23 { | |
| 24 USBController* controller = static_cast<USBController*>(Supplement<LocalFram
e>::from(frame, supplementName())); | |
| 25 ASSERT(controller); | |
| 26 return *controller; | |
| 27 } | |
| 28 | |
| 29 const char* USBController::supplementName() | |
| 30 { | |
| 31 return "USBController"; | |
| 32 } | |
| 33 | |
| 34 USBController::USBController(LocalFrame& frame, WebUSBClient* client) | |
| 35 : LocalFrameLifecycleObserver(&frame) | |
| 36 , m_client(client) | |
| 37 { | |
| 38 } | |
| 39 | |
| 40 void USBController::willDetachFrameHost() | |
| 41 { | |
| 42 m_client = nullptr; | |
| 43 } | |
| 44 | |
| 45 DEFINE_TRACE(USBController) | |
| 46 { | |
| 47 Supplement<LocalFrame>::trace(visitor); | |
| 48 LocalFrameLifecycleObserver::trace(visitor); | |
| 49 } | |
| 50 | |
| 51 } // namespace blink | |
| OLD | NEW |