Chromium Code Reviews| 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/USBController.h" | |
| 7 | |
| 8 #include "platform/RuntimeEnabledFeatures.h" | |
| 9 #include "public/platform/modules/webusb/WebUSBClient.h" | |
| 10 | |
| 11 namespace blink { | |
| 12 | |
| 13 USBController::~USBController() | |
| 14 { | |
| 15 } | |
| 16 | |
| 17 void USBController::provideTo(LocalFrame& frame, WebUSBClient* client) | |
| 18 { | |
| 19 ASSERT(RuntimeEnabledFeatures::webUSBEnabled()); | |
| 20 USBController* controller = new USBController(frame, client); | |
| 21 WillBeHeapSupplement<LocalFrame>::provideTo(frame, supplementName(), adoptPt rWillBeNoop(controller)); | |
| 22 } | |
| 23 | |
| 24 USBController* USBController::from(LocalFrame& frame) | |
|
haraken
2015/07/30 11:26:52
Can we add an ASSERT to verify that the from doesn
Ken Rockot(use gerrit already)
2015/07/30 18:06:54
Done.
| |
| 25 { | |
| 26 return static_cast<USBController*>(WillBeHeapSupplement<LocalFrame>::from(fr ame, supplementName())); | |
| 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 WillBeHeapSupplement<LocalFrame>::trace(visitor); | |
| 48 LocalFrameLifecycleObserver::trace(visitor); | |
| 49 } | |
| 50 | |
| 51 } // namespace blink | |
| OLD | NEW |