Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3004)

Unified Diff: content/renderer/screen_orientation/screen_orientation_observer.cc

Issue 2578503002: [DeviceService] Mojofy left screen orientation IPC messages. (Closed)
Patch Set: Address nits from blundell@ Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/renderer/screen_orientation/screen_orientation_observer.cc
diff --git a/content/renderer/screen_orientation/screen_orientation_observer.cc b/content/renderer/screen_orientation/screen_orientation_observer.cc
index 8cb05fe386946bf7b154cd951bc6bd7a35d12d6c..4549d98acaff77358350b66d4890f68cdbd4f548 100644
--- a/content/renderer/screen_orientation/screen_orientation_observer.cc
+++ b/content/renderer/screen_orientation/screen_orientation_observer.cc
@@ -4,7 +4,7 @@
#include "content/renderer/screen_orientation/screen_orientation_observer.h"
-#include "content/common/screen_orientation_messages.h"
+#include "content/renderer/render_thread_impl.h"
namespace content {
@@ -23,11 +23,20 @@ void ScreenOrientationObserver::Start(
}
void ScreenOrientationObserver::SendStartMessage() {
- RenderThread::Get()->Send(new ScreenOrientationHostMsg_StartListening());
+ GetScreenOrientationListener()->Start();
}
void ScreenOrientationObserver::SendStopMessage() {
- RenderThread::Get()->Send(new ScreenOrientationHostMsg_StopListening());
+ GetScreenOrientationListener()->Stop();
+}
+
+device::mojom::ScreenOrientationListener*
+ScreenOrientationObserver::GetScreenOrientationListener() {
+ if (!listener_) {
+ RenderThreadImpl::current()->GetChannel()->GetRemoteAssociatedInterface(
+ &listener_);
+ }
+ return listener_.get();
}
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698