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

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

Issue 2688383002: [ScreenOrientation] Merge mojo interface ScreenOrientationListener into ScreenOrientation
Patch Set: Address comments from mlamouri@ Created 3 years, 10 months 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_dispatcher.cc
diff --git a/content/renderer/screen_orientation/screen_orientation_dispatcher.cc b/content/renderer/screen_orientation/screen_orientation_dispatcher.cc
index 748aca844c624f4abbeebcb3805bf87d3a162b1c..8591fa363555844074010fc1d76bf40e3520ebd5 100644
--- a/content/renderer/screen_orientation/screen_orientation_dispatcher.cc
+++ b/content/renderer/screen_orientation/screen_orientation_dispatcher.cc
@@ -69,8 +69,7 @@ void ScreenOrientationDispatcher::lockOrientation(
CancelPendingLocks();
int request_id = pending_callbacks_.Add(std::move(callback));
- EnsureScreenOrientationService();
- screen_orientation_->LockOrientation(
+ GetRemoteScreenOrientation()->LockOrientation(
orientation,
base::Bind(&ScreenOrientationDispatcher::OnLockOrientationResult,
base::Unretained(this), request_id));
@@ -78,15 +77,25 @@ void ScreenOrientationDispatcher::lockOrientation(
void ScreenOrientationDispatcher::unlockOrientation() {
CancelPendingLocks();
- EnsureScreenOrientationService();
- screen_orientation_->UnlockOrientation();
+ GetRemoteScreenOrientation()->UnlockOrientation();
}
-void ScreenOrientationDispatcher::EnsureScreenOrientationService() {
+void ScreenOrientationDispatcher::startAccurateListen() {
+ GetRemoteScreenOrientation()->StartAccurateListen();
+}
+
+void ScreenOrientationDispatcher::stopAccurateListen() {
+ GetRemoteScreenOrientation()->StopAccurateListen();
+}
+
+device::mojom::ScreenOrientation*
+ScreenOrientationDispatcher::GetRemoteScreenOrientation() {
if (!screen_orientation_) {
render_frame()->GetRemoteAssociatedInterfaces()->GetInterface(
&screen_orientation_);
}
+
+ return screen_orientation_.get();
}
int ScreenOrientationDispatcher::GetRequestIdForTests() {

Powered by Google App Engine
This is Rietveld 408576698