| OLD | NEW |
| (Empty) |
| 1 // Copyright 2014 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 "content/renderer/screen_orientation/screen_orientation_observer.h" | |
| 6 | |
| 7 #include "content/renderer/render_thread_impl.h" | |
| 8 | |
| 9 namespace content { | |
| 10 | |
| 11 ScreenOrientationObserver::ScreenOrientationObserver() { | |
| 12 } | |
| 13 | |
| 14 ScreenOrientationObserver::~ScreenOrientationObserver() { | |
| 15 StopIfObserving(); | |
| 16 } | |
| 17 | |
| 18 void ScreenOrientationObserver::Start( | |
| 19 blink::WebPlatformEventListener* listener) { | |
| 20 // This should never be called with a proper listener. | |
| 21 CHECK(listener == 0); | |
| 22 PlatformEventObserver<blink::WebPlatformEventListener>::Start(0); | |
| 23 } | |
| 24 | |
| 25 void ScreenOrientationObserver::SendStartMessage() { | |
| 26 GetScreenOrientationListener()->Start(); | |
| 27 } | |
| 28 | |
| 29 void ScreenOrientationObserver::SendStopMessage() { | |
| 30 GetScreenOrientationListener()->Stop(); | |
| 31 } | |
| 32 | |
| 33 device::mojom::ScreenOrientationListener* | |
| 34 ScreenOrientationObserver::GetScreenOrientationListener() { | |
| 35 if (!listener_) { | |
| 36 RenderThreadImpl::current()->GetChannel()->GetRemoteAssociatedInterface( | |
| 37 &listener_); | |
| 38 } | |
| 39 return listener_.get(); | |
| 40 } | |
| 41 | |
| 42 } // namespace content | |
| OLD | NEW |