summaryrefslogtreecommitdiffstats
path: root/content/browser/screen_orientation
diff options
context:
space:
mode:
authormlamouri@chromium.org <mlamouri@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-16 07:23:19 +0000
committermlamouri@chromium.org <mlamouri@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-16 07:23:19 +0000
commitac3f3fa3247c790a8547d05aa04b83cd4a5690a6 (patch)
tree744287185ee969fa91f1925f8033c215a20ca1be /content/browser/screen_orientation
parent3ced8331ccc9da460ea602d3594798753ade1a28 (diff)
downloadchromium_src-ac3f3fa3247c790a8547d05aa04b83cd4a5690a6.zip
chromium_src-ac3f3fa3247c790a8547d05aa04b83cd4a5690a6.tar.gz
chromium_src-ac3f3fa3247c790a8547d05aa04b83cd4a5690a6.tar.bz2
Update Chrome code to use new WebScreenOrientation types.
BUG=162827 Review URL: https://codereview.chromium.org/235893009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@264148 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/screen_orientation')
-rw-r--r--content/browser/screen_orientation/screen_orientation_dispatcher_host.cc6
-rw-r--r--content/browser/screen_orientation/screen_orientation_dispatcher_host.h7
-rw-r--r--content/browser/screen_orientation/screen_orientation_dispatcher_host_unittest.cc53
-rw-r--r--content/browser/screen_orientation/screen_orientation_provider.h5
-rw-r--r--content/browser/screen_orientation/screen_orientation_provider_android.cc4
-rw-r--r--content/browser/screen_orientation/screen_orientation_provider_android.h2
6 files changed, 35 insertions, 42 deletions
diff --git a/content/browser/screen_orientation/screen_orientation_dispatcher_host.cc b/content/browser/screen_orientation/screen_orientation_dispatcher_host.cc
index 5127c78..fc443ec 100644
--- a/content/browser/screen_orientation/screen_orientation_dispatcher_host.cc
+++ b/content/browser/screen_orientation/screen_orientation_dispatcher_host.cc
@@ -34,7 +34,7 @@ bool ScreenOrientationDispatcherHost::OnMessageReceived(
}
void ScreenOrientationDispatcherHost::OnOrientationChange(
- blink::WebScreenOrientation orientation) {
+ blink::WebScreenOrientationType orientation) {
Send(new ScreenOrientationMsg_OrientationChange(orientation));
}
@@ -44,11 +44,11 @@ void ScreenOrientationDispatcherHost::SetProviderForTests(
}
void ScreenOrientationDispatcherHost::OnLockRequest(
- blink::WebScreenOrientations orientations) {
+ blink::WebScreenOrientationLockType orientation) {
if (!provider_.get())
return;
- provider_->LockOrientation(orientations);
+ provider_->LockOrientation(orientation);
}
void ScreenOrientationDispatcherHost::OnUnlockRequest() {
diff --git a/content/browser/screen_orientation/screen_orientation_dispatcher_host.h b/content/browser/screen_orientation/screen_orientation_dispatcher_host.h
index 2047e4e..28cd75d 100644
--- a/content/browser/screen_orientation/screen_orientation_dispatcher_host.h
+++ b/content/browser/screen_orientation/screen_orientation_dispatcher_host.h
@@ -6,7 +6,8 @@
#define CONTENT_BROWSER_SCREEN_ORIENTATION_SCREEN_ORIENTATION_DISPATCHER_HOST_H_
#include "content/public/browser/browser_message_filter.h"
-#include "third_party/WebKit/public/platform/WebScreenOrientation.h"
+#include "third_party/WebKit/public/platform/WebScreenOrientationLockType.h"
+#include "third_party/WebKit/public/platform/WebScreenOrientationType.h"
namespace content {
@@ -23,14 +24,14 @@ class CONTENT_EXPORT ScreenOrientationDispatcherHost
// BrowserMessageFilter
virtual bool OnMessageReceived(const IPC::Message&, bool*) OVERRIDE;
- void OnOrientationChange(blink::WebScreenOrientation orientation);
+ void OnOrientationChange(blink::WebScreenOrientationType orientation);
void SetProviderForTests(ScreenOrientationProvider* provider);
private:
virtual ~ScreenOrientationDispatcherHost();
- void OnLockRequest(blink::WebScreenOrientations orientations);
+ void OnLockRequest(blink::WebScreenOrientationLockType orientations);
void OnUnlockRequest();
static ScreenOrientationProvider* CreateProvider();
diff --git a/content/browser/screen_orientation/screen_orientation_dispatcher_host_unittest.cc b/content/browser/screen_orientation/screen_orientation_dispatcher_host_unittest.cc
index af1f595..3c50ca8 100644
--- a/content/browser/screen_orientation/screen_orientation_dispatcher_host_unittest.cc
+++ b/content/browser/screen_orientation/screen_orientation_dispatcher_host_unittest.cc
@@ -14,11 +14,13 @@ namespace content {
class MockScreenOrientationProvider : public ScreenOrientationProvider {
public:
- MockScreenOrientationProvider() : orientations_(0), unlock_called_(false) {}
+ MockScreenOrientationProvider()
+ : orientation_(blink::WebScreenOrientationLockPortraitPrimary),
+ unlock_called_(false) {}
- virtual void LockOrientation(blink::WebScreenOrientations orientations)
+ virtual void LockOrientation(blink::WebScreenOrientationLockType orientation)
OVERRIDE {
- orientations_ = orientations;
+ orientation_ = orientation;
}
@@ -26,8 +28,8 @@ class MockScreenOrientationProvider : public ScreenOrientationProvider {
unlock_called_ = true;
}
- blink::WebScreenOrientations orientations() const {
- return orientations_;
+ blink::WebScreenOrientationLockType orientation() const {
+ return orientation_;
}
bool unlock_called() const {
@@ -37,7 +39,7 @@ class MockScreenOrientationProvider : public ScreenOrientationProvider {
virtual ~MockScreenOrientationProvider() {}
private:
- blink::WebScreenOrientations orientations_;
+ blink::WebScreenOrientationLockType orientation_;
bool unlock_called_;
DISALLOW_COPY_AND_ASSIGN(MockScreenOrientationProvider);
@@ -63,8 +65,8 @@ TEST_F(ScreenOrientationDispatcherHostTest, NullProvider) {
bool message_was_ok = false;
bool message_was_handled = dispatcher_->OnMessageReceived(
- ScreenOrientationHostMsg_Lock(blink::WebScreenOrientationPortraitPrimary),
- &message_was_ok);
+ ScreenOrientationHostMsg_Lock(
+ blink::WebScreenOrientationLockPortraitPrimary), &message_was_ok);
EXPECT_TRUE(message_was_ok);
EXPECT_TRUE(message_was_handled);
@@ -74,43 +76,32 @@ TEST_F(ScreenOrientationDispatcherHostTest, NullProvider) {
// ScreenOrientationProvider.
TEST_F(ScreenOrientationDispatcherHostTest, ProviderLock) {
// If we change this array, update |orientationsToTestCount| below.
- blink::WebScreenOrientations orientationsToTest[] = {
- // The basic types.
- blink::WebScreenOrientationPortraitPrimary,
- blink::WebScreenOrientationPortraitSecondary,
- blink::WebScreenOrientationLandscapePrimary,
- blink::WebScreenOrientationLandscapeSecondary,
- // Some unions.
- blink::WebScreenOrientationLandscapePrimary |
- blink::WebScreenOrientationPortraitPrimary,
- blink::WebScreenOrientationLandscapePrimary |
- blink::WebScreenOrientationPortraitSecondary,
- blink::WebScreenOrientationPortraitPrimary |
- blink::WebScreenOrientationPortraitSecondary |
- blink::WebScreenOrientationLandscapePrimary |
- blink::WebScreenOrientationLandscapeSecondary,
- // Garbage values.
- 0,
- 100,
- 42
+ blink::WebScreenOrientationLockType orientationsToTest[] = {
+ blink::WebScreenOrientationLockPortraitPrimary,
+ blink::WebScreenOrientationLockPortraitSecondary,
+ blink::WebScreenOrientationLockLandscapePrimary,
+ blink::WebScreenOrientationLockLandscapeSecondary,
+ blink::WebScreenOrientationLockPortrait,
+ blink::WebScreenOrientationLockLandscapePrimary,
+ blink::WebScreenOrientationLockAny
};
// Unfortunately, initializer list constructor for std::list is not yet
// something we can use.
// Keep this in sync with |orientationsToTest|.
- int orientationsToTestCount = 10;
+ int orientationsToTestCount = 7;
for (int i = 0; i < orientationsToTestCount; ++i) {
bool message_was_ok = false;
bool message_was_handled = false;
- blink::WebScreenOrientations orientations = orientationsToTest[i];
+ blink::WebScreenOrientationLockType orientation = orientationsToTest[i];
message_was_handled = dispatcher_->OnMessageReceived(
- ScreenOrientationHostMsg_Lock(orientations), &message_was_ok);
+ ScreenOrientationHostMsg_Lock(orientation), &message_was_ok);
EXPECT_TRUE(message_was_ok);
EXPECT_TRUE(message_was_handled);
- EXPECT_EQ(orientations, provider_->orientations());
+ EXPECT_EQ(orientation, provider_->orientation());
}
}
diff --git a/content/browser/screen_orientation/screen_orientation_provider.h b/content/browser/screen_orientation/screen_orientation_provider.h
index 74296c1..4ae8588 100644
--- a/content/browser/screen_orientation/screen_orientation_provider.h
+++ b/content/browser/screen_orientation/screen_orientation_provider.h
@@ -5,7 +5,7 @@
#ifndef CONTENT_BROWSER_SCREEN_ORIENTATION_SCREEN_ORIENTATION_PROVIDER_H_
#define CONTENT_BROWSER_SCREEN_ORIENTATION_SCREEN_ORIENTATION_PROVIDER_H_
-#include "third_party/WebKit/public/platform/WebScreenOrientation.h"
+#include "third_party/WebKit/public/platform/WebScreenOrientationLockType.h"
namespace content {
@@ -14,7 +14,8 @@ namespace content {
class ScreenOrientationProvider {
public:
// Lock the screen orientation to |orientations|.
- virtual void LockOrientation(blink::WebScreenOrientations orientations) = 0;
+ virtual void LockOrientation(
+ blink::WebScreenOrientationLockType orientations) = 0;
// Unlock the screen orientation.
virtual void UnlockOrientation() = 0;
diff --git a/content/browser/screen_orientation/screen_orientation_provider_android.cc b/content/browser/screen_orientation/screen_orientation_provider_android.cc
index a95d69a..e8961bc 100644
--- a/content/browser/screen_orientation/screen_orientation_provider_android.cc
+++ b/content/browser/screen_orientation/screen_orientation_provider_android.cc
@@ -21,7 +21,7 @@ bool ScreenOrientationProviderAndroid::Register(JNIEnv* env) {
}
void ScreenOrientationProviderAndroid::LockOrientation(
- blink::WebScreenOrientations orientations) {
+ blink::WebScreenOrientationLockType orientation) {
if (j_screen_orientation_provider_.is_null()) {
j_screen_orientation_provider_.Reset(Java_ScreenOrientationProvider_create(
base::android::AttachCurrentThread()));
@@ -29,7 +29,7 @@ void ScreenOrientationProviderAndroid::LockOrientation(
Java_ScreenOrientationProvider_lockOrientation(
base::android::AttachCurrentThread(),
- j_screen_orientation_provider_.obj(), orientations);
+ j_screen_orientation_provider_.obj(), orientation);
}
void ScreenOrientationProviderAndroid::UnlockOrientation() {
diff --git a/content/browser/screen_orientation/screen_orientation_provider_android.h b/content/browser/screen_orientation/screen_orientation_provider_android.h
index 69bfba3..a526e24 100644
--- a/content/browser/screen_orientation/screen_orientation_provider_android.h
+++ b/content/browser/screen_orientation/screen_orientation_provider_android.h
@@ -18,7 +18,7 @@ class ScreenOrientationProviderAndroid : public ScreenOrientationProvider {
static bool Register(JNIEnv* env);
// ScreenOrientationProvider
- virtual void LockOrientation(blink::WebScreenOrientations) OVERRIDE;
+ virtual void LockOrientation(blink::WebScreenOrientationLockType) OVERRIDE;
virtual void UnlockOrientation() OVERRIDE;
private: