| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/vr/VRDisplayEvent.h" | 5 #include "modules/vr/VRDisplayEvent.h" |
| 6 | 6 |
| 7 namespace blink { | 7 namespace blink { |
| 8 | 8 |
| 9 namespace { |
| 10 |
| 11 String VRDisplayEventReasonToString( |
| 12 device::mojom::blink::VRDisplayEventReason reason) { |
| 13 switch (reason) { |
| 14 case device::mojom::blink::VRDisplayEventReason::NONE: |
| 15 return ""; |
| 16 case device::mojom::blink::VRDisplayEventReason::NAVIGATION: |
| 17 return "navigation"; |
| 18 case device::mojom::blink::VRDisplayEventReason::MOUNTED: |
| 19 return "mounted"; |
| 20 case device::mojom::blink::VRDisplayEventReason::UNMOUNTED: |
| 21 return "unmounted"; |
| 22 } |
| 23 |
| 24 NOTREACHED(); |
| 25 return ""; |
| 26 } |
| 27 |
| 28 } // namespace |
| 29 |
| 30 VRDisplayEvent* VRDisplayEvent::create( |
| 31 const AtomicString& type, |
| 32 bool canBubble, |
| 33 bool cancelable, |
| 34 VRDisplay* display, |
| 35 device::mojom::blink::VRDisplayEventReason reason) { |
| 36 return new VRDisplayEvent(type, canBubble, cancelable, display, |
| 37 VRDisplayEventReasonToString(reason)); |
| 38 } |
| 39 |
| 9 VRDisplayEvent::VRDisplayEvent() {} | 40 VRDisplayEvent::VRDisplayEvent() {} |
| 10 | 41 |
| 11 VRDisplayEvent::VRDisplayEvent(const AtomicString& type, | 42 VRDisplayEvent::VRDisplayEvent(const AtomicString& type, |
| 12 bool canBubble, | 43 bool canBubble, |
| 13 bool cancelable, | 44 bool cancelable, |
| 14 VRDisplay* display, | 45 VRDisplay* display, |
| 15 String reason) | 46 String reason) |
| 16 : Event(type, canBubble, cancelable), | 47 : Event(type, canBubble, cancelable), |
| 17 m_display(display), | 48 m_display(display), |
| 18 m_reason(reason) {} | 49 m_reason(reason) {} |
| (...skipping 13 matching lines...) Expand all Loading... |
| 32 const AtomicString& VRDisplayEvent::interfaceName() const { | 63 const AtomicString& VRDisplayEvent::interfaceName() const { |
| 33 return EventNames::VRDisplayEvent; | 64 return EventNames::VRDisplayEvent; |
| 34 } | 65 } |
| 35 | 66 |
| 36 DEFINE_TRACE(VRDisplayEvent) { | 67 DEFINE_TRACE(VRDisplayEvent) { |
| 37 visitor->trace(m_display); | 68 visitor->trace(m_display); |
| 38 Event::trace(visitor); | 69 Event::trace(visitor); |
| 39 } | 70 } |
| 40 | 71 |
| 41 } // namespace blink | 72 } // namespace blink |
| OLD | NEW |