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

Unified Diff: content/browser/screen_orientation/screen_orientation_provider_android.h

Issue 549603003: Create Mojo service for locking/unlocking screen orientation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nits Created 6 years, 3 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/browser/screen_orientation/screen_orientation_provider_android.h
diff --git a/content/browser/screen_orientation/screen_orientation_provider_android.h b/content/browser/screen_orientation/screen_orientation_provider_android.h
index c1a94f84f80cc138536094c45a6e5c1bb3f84f50..0cfa7660274563c12531e4fb277e5f6a6b5799de 100644
--- a/content/browser/screen_orientation/screen_orientation_provider_android.h
+++ b/content/browser/screen_orientation/screen_orientation_provider_android.h
@@ -10,24 +10,24 @@
#include "base/compiler_specific.h"
#include "content/public/browser/screen_orientation_provider.h"
#include "content/public/browser/web_contents_observer.h"
+#include "third_party/WebKit/public/platform/WebScreenOrientationLockType.h"
namespace content {
-class ScreenOrientationDispatcherHost;
class WebContentsImpl;
class ScreenOrientationProviderAndroid : public ScreenOrientationProvider,
public WebContentsObserver {
public:
explicit ScreenOrientationProviderAndroid(
- ScreenOrientationDispatcherHost* dispatcher,
WebContents* web_contents);
static bool Register(JNIEnv* env);
// ScreenOrientationProvider
- virtual void LockOrientation(int request_id,
- blink::WebScreenOrientationLockType) OVERRIDE;
+ virtual void LockOrientation(
+ ScreenOrientationLockType lock_type,
+ const ScreenOrientationLockCallback& callback) OVERRIDE;
virtual void UnlockOrientation() OVERRIDE;
virtual void OnOrientationChange() OVERRIDE;
@@ -47,6 +47,11 @@ class ScreenOrientationProviderAndroid : public ScreenOrientationProvider,
private:
WebContentsImpl* web_contents_impl();
+ // Calls |on_result_callback_| with |result|, followed by resetting
+ // |on_result_callback_| and |pending_lock_orientation_|. Does nothing if
+ // |on_result_callback_| is null.
+ void NotifyLockResult(ScreenOrientationLockResult result);
+
// Whether the passed |lock| matches the current orientation. In other words,
// whether the orientation will need to change to match the |lock|.
bool LockMatchesCurrentOrientation(blink::WebScreenOrientationLockType lock);
@@ -58,19 +63,17 @@ class ScreenOrientationProviderAndroid : public ScreenOrientationProvider,
virtual ~ScreenOrientationProviderAndroid();
- // ScreenOrientationDispatcherHost owns ScreenOrientationProvider so
- // dispatcher_ should not point to an invalid memory.
- ScreenOrientationDispatcherHost* dispatcher_;
+ // The callback that should be invoked when the current lock request
+ // receives a result.
+ ScreenOrientationLockCallback on_result_callback_;
// Whether the ScreenOrientationProvider currently has a lock applied.
bool lock_applied_;
- struct LockInformation {
- LockInformation(int request_id, blink::WebScreenOrientationLockType lock);
- int request_id;
- blink::WebScreenOrientationLockType lock;
- };
- LockInformation* pending_lock_;
+ // The requested orientation of the pending lock request, or
+ // blink::WebScreenOrientationLockDefault if there is no pending lock
+ // request.
+ blink::WebScreenOrientationLockType pending_lock_orientation_;
DISALLOW_COPY_AND_ASSIGN(ScreenOrientationProviderAndroid);
};

Powered by Google App Engine
This is Rietveld 408576698