summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--content/browser/DEPS1
-rw-r--r--content/browser/android/content_view_core_impl.cc28
-rw-r--r--content/browser/renderer_host/render_process_host_impl.cc13
-rw-r--r--content/browser/renderer_host/render_process_host_impl.h7
-rw-r--r--content/browser/screen_orientation/screen_orientation_dispatcher_host.cc25
-rw-r--r--content/browser/screen_orientation/screen_orientation_dispatcher_host.h31
-rw-r--r--content/common/DEPS1
-rw-r--r--content/common/content_message_generator.h1
-rw-r--r--content/common/screen_orientation_messages.h21
-rw-r--r--content/content_browser.gypi2
-rw-r--r--content/content_common.gypi1
-rw-r--r--content/content_renderer.gypi2
-rw-r--r--content/content_tests.gypi1
-rw-r--r--content/public/test/mock_render_thread.h10
-rw-r--r--content/renderer/renderer_webkitplatformsupport_impl.cc13
-rw-r--r--content/renderer/renderer_webkitplatformsupport_impl.h6
-rw-r--r--content/renderer/screen_orientation/screen_orientation_dispatcher.cc45
-rw-r--r--content/renderer/screen_orientation/screen_orientation_dispatcher.h43
-rw-r--r--content/renderer/screen_orientation/screen_orientation_dispatcher_unittest.cc111
-rw-r--r--ipc/ipc_message_start.h1
20 files changed, 4 insertions, 359 deletions
diff --git a/content/browser/DEPS b/content/browser/DEPS
index 6f05527..376fc16 100644
--- a/content/browser/DEPS
+++ b/content/browser/DEPS
@@ -38,7 +38,6 @@ include_rules = [
"+third_party/WebKit/public/platform/WebIDBDatabaseException.h",
"+third_party/WebKit/public/platform/WebIDBTypes.h",
"+third_party/WebKit/public/platform/WebReferrerPolicy.h",
- "+third_party/WebKit/public/platform/WebScreenOrientation.h",
"+third_party/WebKit/public/platform/WebScreenInfo.h",
"+third_party/WebKit/public/platform/WebServiceWorkerError.h",
"+third_party/WebKit/public/platform/WebString.h",
diff --git a/content/browser/android/content_view_core_impl.cc b/content/browser/android/content_view_core_impl.cc
index eff3a93..4656584 100644
--- a/content/browser/android/content_view_core_impl.cc
+++ b/content/browser/android/content_view_core_impl.cc
@@ -30,7 +30,6 @@
#include "content/browser/renderer_host/render_view_host_impl.h"
#include "content/browser/renderer_host/render_widget_host_impl.h"
#include "content/browser/renderer_host/render_widget_host_view_android.h"
-#include "content/browser/screen_orientation/screen_orientation_dispatcher_host.h"
#include "content/browser/ssl/ssl_host_state.h"
#include "content/browser/web_contents/web_contents_view_android.h"
#include "content/common/input/web_input_event_traits.h"
@@ -1793,33 +1792,6 @@ void ContentViewCoreImpl::SendOrientationChangeEventInternal() {
RenderViewHostImpl* rvhi = static_cast<RenderViewHostImpl*>(
web_contents_->GetRenderViewHost());
rvhi->SendOrientationChangeEvent(device_orientation_);
-
- // TODO(mlamouri): temporary plumbing for Screen Orientation, this will change
- // in the future. It might leave ContentViewCoreImpl or simply replace the
- // SendOrientationChangeEvent call above.
- blink::WebScreenOrientation orientation =
- blink::WebScreenOrientationPortraitPrimary;
-
- switch (device_orientation_) {
- case 0:
- orientation = blink::WebScreenOrientationPortraitPrimary;
- break;
- case 90:
- orientation = blink::WebScreenOrientationLandscapePrimary;
- break;
- case -90:
- orientation = blink::WebScreenOrientationLandscapeSecondary;
- break;
- case 180:
- orientation = blink::WebScreenOrientationPortraitSecondary;
- break;
- default:
- NOTREACHED();
- }
-
- static_cast<RenderProcessHostImpl*>(web_contents_->GetRenderProcessHost())->
- screen_orientation_dispatcher_host()->
- OnOrientationChange(orientation);
}
void ContentViewCoreImpl::ExtractSmartClipData(JNIEnv* env,
diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc
index 14336b2..75e04bc 100644
--- a/content/browser/renderer_host/render_process_host_impl.cc
+++ b/content/browser/renderer_host/render_process_host_impl.cc
@@ -94,7 +94,6 @@
#include "content/browser/renderer_host/text_input_client_message_filter.h"
#include "content/browser/renderer_host/websocket_dispatcher_host.h"
#include "content/browser/resolve_proxy_msg_helper.h"
-#include "content/browser/screen_orientation/screen_orientation_dispatcher_host.h"
#include "content/browser/service_worker/service_worker_context_wrapper.h"
#include "content/browser/service_worker/service_worker_dispatcher_host.h"
#include "content/browser/speech/input_tag_speech_dispatcher_host.h"
@@ -397,8 +396,7 @@ RenderProcessHostImpl::RenderProcessHostImpl(
within_process_died_observer_(false),
power_monitor_broadcaster_(this),
geolocation_dispatcher_host_(NULL),
- weak_factory_(this),
- screen_orientation_dispatcher_host_(NULL) {
+ weak_factory_(this) {
widget_helper_ = new RenderWidgetHelper();
ChildProcessSecurityPolicyImpl::GetInstance()->Add(GetID());
@@ -789,8 +787,6 @@ void RenderProcessHostImpl::CreateMessageFilters() {
AddFilter(new MemoryBenchmarkMessageFilter());
#endif
AddFilter(new VibrationMessageFilter());
- screen_orientation_dispatcher_host_ = new ScreenOrientationDispatcherHost();
- AddFilter(screen_orientation_dispatcher_host_);
}
int RenderProcessHostImpl::GetNextRoutingID() {
@@ -1479,7 +1475,6 @@ void RenderProcessHostImpl::Cleanup() {
gpu_message_filter_ = NULL;
message_port_message_filter_ = NULL;
geolocation_dispatcher_host_ = NULL;
- screen_orientation_dispatcher_host_ = NULL;
// Remove ourself from the list of renderer processes so that we can't be
// reused in between now and when the Delete task runs.
@@ -1867,7 +1862,6 @@ void RenderProcessHostImpl::ProcessDied(bool already_dead) {
gpu_message_filter_ = NULL;
message_port_message_filter_ = NULL;
geolocation_dispatcher_host_ = NULL;
- screen_orientation_dispatcher_host_ = NULL;
IDMap<IPC::Listener>::iterator iter(&listeners_);
while (!iter.IsAtEnd()) {
@@ -1931,11 +1925,6 @@ void RenderProcessHostImpl::WebRtcLogMessage(const std::string& message) {
}
#endif
-scoped_refptr<ScreenOrientationDispatcherHost>
-RenderProcessHostImpl::screen_orientation_dispatcher_host() const {
- return make_scoped_refptr(screen_orientation_dispatcher_host_);
-}
-
void RenderProcessHostImpl::OnShutdownRequest() {
// Don't shut down if there are active RenderViews, or if there are pending
// RenderViews being swapped back in.
diff --git a/content/browser/renderer_host/render_process_host_impl.h b/content/browser/renderer_host/render_process_host_impl.h
index b2e5db6..943fd5f 100644
--- a/content/browser/renderer_host/render_process_host_impl.h
+++ b/content/browser/renderer_host/render_process_host_impl.h
@@ -47,7 +47,6 @@ class RenderWidgetHelper;
class RenderWidgetHost;
class RenderWidgetHostImpl;
class RenderWidgetHostViewFrameSubscriber;
-class ScreenOrientationDispatcherHost;
class StoragePartition;
class StoragePartitionImpl;
@@ -173,9 +172,6 @@ class CONTENT_EXPORT RenderProcessHostImpl
void WebRtcLogMessage(const std::string& message);
#endif
- scoped_refptr<ScreenOrientationDispatcherHost>
- screen_orientation_dispatcher_host() const;
-
// Register/unregister the host identified by the host id in the global host
// list.
static void RegisterHost(int host_id, RenderProcessHost* host);
@@ -415,9 +411,6 @@ class CONTENT_EXPORT RenderProcessHostImpl
// Lives on the browser's ChildThread.
base::WeakPtrFactory<RenderProcessHostImpl> weak_factory_;
- // Message filter and dispatcher for screen orientation.
- ScreenOrientationDispatcherHost* screen_orientation_dispatcher_host_;
-
DISALLOW_COPY_AND_ASSIGN(RenderProcessHostImpl);
};
diff --git a/content/browser/screen_orientation/screen_orientation_dispatcher_host.cc b/content/browser/screen_orientation/screen_orientation_dispatcher_host.cc
deleted file mode 100644
index c868beb..0000000
--- a/content/browser/screen_orientation/screen_orientation_dispatcher_host.cc
+++ /dev/null
@@ -1,25 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "content/browser/screen_orientation/screen_orientation_dispatcher_host.h"
-
-#include "content/common/screen_orientation_messages.h"
-
-namespace content {
-
-ScreenOrientationDispatcherHost::ScreenOrientationDispatcherHost() {
-}
-
-bool ScreenOrientationDispatcherHost::OnMessageReceived(
- const IPC::Message& message, bool* message_was_ok) {
- // TODO(mlamouri): we will handle lock and unlock requests here.
- return false;
-}
-
-void ScreenOrientationDispatcherHost::OnOrientationChange(
- blink::WebScreenOrientation orientation) {
- Send(new ScreenOrientationMsg_OrientationChange(orientation));
-}
-
-} // namespace content
diff --git a/content/browser/screen_orientation/screen_orientation_dispatcher_host.h b/content/browser/screen_orientation/screen_orientation_dispatcher_host.h
deleted file mode 100644
index 75620d9..0000000
--- a/content/browser/screen_orientation/screen_orientation_dispatcher_host.h
+++ /dev/null
@@ -1,31 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CONTENT_BROWSER_SCREEN_ORIENTATION_DISPATCHER_HOST_H_
-#define CONTENT_BROWSER_SCREEN_ORIENTATION_DISPATCHER_HOST_H_
-
-#include "content/public/browser/browser_message_filter.h"
-#include "third_party/WebKit/public/platform/WebScreenOrientation.h"
-
-namespace content {
-
-// ScreenOrientationDispatcherHost
-class ScreenOrientationDispatcherHost : public BrowserMessageFilter {
- public:
- ScreenOrientationDispatcherHost();
-
- // BrowserMessageFilter
- virtual bool OnMessageReceived(const IPC::Message&, bool*) OVERRIDE;
-
- void OnOrientationChange(blink::WebScreenOrientation orientation);
-
-private:
- virtual ~ScreenOrientationDispatcherHost() {}
-
- DISALLOW_COPY_AND_ASSIGN(ScreenOrientationDispatcherHost);
-};
-
-} // namespace content
-
-#endif // CONTENT_BROWSER_SCREEN_ORIENTATION_DISPATCHER_HOST_H_
diff --git a/content/common/DEPS b/content/common/DEPS
index b26b7a4..2245cf5 100644
--- a/content/common/DEPS
+++ b/content/common/DEPS
@@ -23,7 +23,6 @@ include_rules = [
"+third_party/WebKit/public/platform/WebIDBDatabase.h",
"+third_party/WebKit/public/platform/WebIDBTypes.h",
"+third_party/WebKit/public/platform/WebReferrerPolicy.h",
- "+third_party/WebKit/public/platform/WebScreenOrientation.h",
"+third_party/WebKit/public/platform/WebScreenInfo.h",
"+third_party/WebKit/public/platform/WebServiceWorkerError.h",
"+third_party/WebKit/public/platform/WebStorageArea.h",
diff --git a/content/common/content_message_generator.h b/content/common/content_message_generator.h
index b2d8690..c7223af 100644
--- a/content/common/content_message_generator.h
+++ b/content/common/content_message_generator.h
@@ -48,7 +48,6 @@
#include "content/common/power_monitor_messages.h"
#include "content/common/quota_messages.h"
#include "content/common/resource_messages.h"
-#include "content/common/screen_orientation_messages.h"
#include "content/common/service_worker/embedded_worker_messages.h"
#include "content/common/service_worker/service_worker_messages.h"
#include "content/common/socket_stream_messages.h"
diff --git a/content/common/screen_orientation_messages.h b/content/common/screen_orientation_messages.h
deleted file mode 100644
index cd8a4b7..0000000
--- a/content/common/screen_orientation_messages.h
+++ /dev/null
@@ -1,21 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// IPC messages for screen orientation.
-// Multiply-included message file, hence no include guard.
-
-#include "ipc/ipc_message_macros.h"
-#include "third_party/WebKit/public/platform/WebScreenOrientation.h"
-
-#undef IPC_MESSAGE_EXPORT
-#define IPC_MESSAGE_EXPORT CONTENT_EXPORT
-
-#define IPC_MESSAGE_START ScreenOrientationMsgStart
-
-IPC_ENUM_TRAITS(blink::WebScreenOrientation)
-
-// The browser process informs the renderer process that the screen orientation
-// has changed. |orientation| contains the new screen orientation in degrees.
-IPC_MESSAGE_CONTROL1(ScreenOrientationMsg_OrientationChange,
- blink::WebScreenOrientation /* orientation */ )
diff --git a/content/content_browser.gypi b/content/content_browser.gypi
index d6023ea..f058fc5 100644
--- a/content/content_browser.gypi
+++ b/content/content_browser.gypi
@@ -1108,8 +1108,6 @@
'browser/resource_context_impl.h',
'browser/safe_util_win.cc',
'browser/safe_util_win.h',
- 'browser/screen_orientation/screen_orientation_dispatcher_host.cc',
- 'browser/screen_orientation/screen_orientation_dispatcher_host.h',
'browser/service_worker/embedded_worker_instance.cc',
'browser/service_worker/embedded_worker_instance.h',
'browser/service_worker/embedded_worker_registry.cc',
diff --git a/content/content_common.gypi b/content/content_common.gypi
index 1c2ae4a..566c245 100644
--- a/content/content_common.gypi
+++ b/content/content_common.gypi
@@ -364,7 +364,6 @@
'common/sandbox_win.h',
'common/savable_url_schemes.cc',
'common/savable_url_schemes.h',
- 'common/screen_orientation_messages.h',
'common/service_worker/embedded_worker_messages.h',
'common/service_worker/service_worker_messages.h',
'common/service_worker/service_worker_status_code.cc',
diff --git a/content/content_renderer.gypi b/content/content_renderer.gypi
index 64cf704..3ba5f96 100644
--- a/content/content_renderer.gypi
+++ b/content/content_renderer.gypi
@@ -480,8 +480,6 @@
'renderer/sad_plugin.h',
'renderer/savable_resources.cc',
'renderer/savable_resources.h',
- 'renderer/screen_orientation/screen_orientation_dispatcher.cc',
- 'renderer/screen_orientation/screen_orientation_dispatcher.h',
'renderer/scoped_clipboard_writer_glue.cc',
'renderer/scoped_clipboard_writer_glue.h',
'renderer/service_worker/embedded_worker_context_client.cc',
diff --git a/content/content_tests.gypi b/content/content_tests.gypi
index 171583e..73db517 100644
--- a/content/content_tests.gypi
+++ b/content/content_tests.gypi
@@ -571,7 +571,6 @@
'renderer/render_frame_impl_unittest.cc',
'renderer/render_thread_impl_unittest.cc',
'renderer/render_widget_unittest.cc',
- 'renderer/screen_orientation/screen_orientation_dispatcher_unittest.cc',
'renderer/skia_benchmarking_extension_unittest.cc',
'renderer/v8_value_converter_impl_unittest.cc',
'renderer/webcrypto/shared_crypto_unittest.cc',
diff --git a/content/public/test/mock_render_thread.h b/content/public/test/mock_render_thread.h
index 05c1f54..d763b26 100644
--- a/content/public/test/mock_render_thread.h
+++ b/content/public/test/mock_render_thread.h
@@ -102,18 +102,14 @@ class MockRenderThread : public RenderThread {
// state.
void SendCloseMessage();
- // Dispatches control messages to observers.
- bool OnControlMessageReceived(const IPC::Message& msg);
-
- ObserverList<RenderProcessObserver>& observers() {
- return observers_;
- }
-
protected:
// This function operates as a regular IPC listener. Subclasses
// overriding this should first delegate to this implementation.
virtual bool OnMessageReceived(const IPC::Message& msg);
+ // Dispatches control messages to observers.
+ bool OnControlMessageReceived(const IPC::Message& msg);
+
// The Widget expects to be returned valid route_id.
void OnCreateWidget(int opener_id,
blink::WebPopupType popup_type,
diff --git a/content/renderer/renderer_webkitplatformsupport_impl.cc b/content/renderer/renderer_webkitplatformsupport_impl.cc
index 5b44e7e..601fd5c 100644
--- a/content/renderer/renderer_webkitplatformsupport_impl.cc
+++ b/content/renderer/renderer_webkitplatformsupport_impl.cc
@@ -49,7 +49,6 @@
#include "content/renderer/media/webcontentdecryptionmodule_impl.h"
#include "content/renderer/render_thread_impl.h"
#include "content/renderer/renderer_clipboard_client.h"
-#include "content/renderer/screen_orientation/screen_orientation_dispatcher.h"
#include "content/renderer/webclipboard_impl.h"
#include "content/renderer/webcrypto/webcrypto_impl.h"
#include "content/renderer/webgraphicscontext3d_provider_impl.h"
@@ -1071,18 +1070,6 @@ void RendererWebKitPlatformSupportImpl::cancelVibration() {
//------------------------------------------------------------------------------
-void RendererWebKitPlatformSupportImpl::setScreenOrientationListener(
- blink::WebScreenOrientationListener* listener) {
- if (!screen_orientation_dispatcher_) {
- screen_orientation_dispatcher_.reset(
- new ScreenOrientationDispatcher(RenderThread::Get()));
- }
-
- screen_orientation_dispatcher_->setListener(listener);
-}
-
-//------------------------------------------------------------------------------
-
void RendererWebKitPlatformSupportImpl::queryStorageUsageAndQuota(
const blink::WebURL& storage_partition,
blink::WebStorageQuotaType type,
diff --git a/content/renderer/renderer_webkitplatformsupport_impl.h b/content/renderer/renderer_webkitplatformsupport_impl.h
index 91ee312..45f2924 100644
--- a/content/renderer/renderer_webkitplatformsupport_impl.h
+++ b/content/renderer/renderer_webkitplatformsupport_impl.h
@@ -31,7 +31,6 @@ namespace blink {
class WebDeviceMotionData;
class WebDeviceOrientationData;
class WebGraphicsContext3DProvider;
-class WebScreenOrientationListener;
}
namespace content {
@@ -39,7 +38,6 @@ class DeviceMotionEventPump;
class DeviceOrientationEventPump;
class QuotaMessageFilter;
class RendererClipboardClient;
-class ScreenOrientationDispatcher;
class ThreadSafeSender;
class WebClipboardImpl;
class WebCryptoImpl;
@@ -152,8 +150,6 @@ class CONTENT_EXPORT RendererWebKitPlatformSupportImpl
blink::WebStorageQuotaCallbacks) OVERRIDE;
virtual void vibrate(unsigned int milliseconds);
virtual void cancelVibration();
- virtual void setScreenOrientationListener(
- blink::WebScreenOrientationListener*) OVERRIDE;
// Disables the WebSandboxSupport implementation for testing.
// Tests that do not set up a full sandbox environment should call
@@ -222,8 +218,6 @@ class CONTENT_EXPORT RendererWebKitPlatformSupportImpl
scoped_ptr<WebCryptoImpl> web_crypto_;
- scoped_ptr<ScreenOrientationDispatcher> screen_orientation_dispatcher_;
-
DISALLOW_COPY_AND_ASSIGN(RendererWebKitPlatformSupportImpl);
};
diff --git a/content/renderer/screen_orientation/screen_orientation_dispatcher.cc b/content/renderer/screen_orientation/screen_orientation_dispatcher.cc
deleted file mode 100644
index 46e8d07..0000000
--- a/content/renderer/screen_orientation/screen_orientation_dispatcher.cc
+++ /dev/null
@@ -1,45 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "content/renderer/screen_orientation/screen_orientation_dispatcher.h"
-
-#include "content/common/screen_orientation_messages.h"
-#include "content/public/renderer/render_thread.h"
-#include "third_party/WebKit/public/platform/WebScreenOrientationListener.h"
-
-namespace content {
-
-ScreenOrientationDispatcher::ScreenOrientationDispatcher(
- RenderThread* thread)
- : listener_(NULL) {
- thread->AddObserver(this);
-}
-
-bool ScreenOrientationDispatcher::OnControlMessageReceived(
- const IPC::Message& message) {
- bool handled = true;
-
- IPC_BEGIN_MESSAGE_MAP(ScreenOrientationDispatcher, message)
- IPC_MESSAGE_HANDLER(ScreenOrientationMsg_OrientationChange,
- OnOrientationChange)
- IPC_MESSAGE_UNHANDLED(handled = false)
- IPC_END_MESSAGE_MAP()
-
- return handled;
-}
-
-void ScreenOrientationDispatcher::OnOrientationChange(
- blink::WebScreenOrientation orientation) {
- if (!listener_)
- return;
-
- listener_->didChangeScreenOrientation(orientation);
-}
-
-void ScreenOrientationDispatcher::setListener(
- blink::WebScreenOrientationListener* listener) {
- listener_ = listener;
-}
-
-} // namespace content
diff --git a/content/renderer/screen_orientation/screen_orientation_dispatcher.h b/content/renderer/screen_orientation/screen_orientation_dispatcher.h
deleted file mode 100644
index d672def..0000000
--- a/content/renderer/screen_orientation/screen_orientation_dispatcher.h
+++ /dev/null
@@ -1,43 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CONTENT_RENDERER_SCREEN_ORIENTATION_DISPATCHER_H_
-#define CONTENT_RENDERER_SCREEN_ORIENTATION_DISPATCHER_H_
-
-#include "base/macros.h"
-#include "content/public/renderer/render_process_observer.h"
-#include "third_party/WebKit/public/platform/WebScreenOrientation.h"
-
-namespace blink {
-class WebScreenOrientationListener;
-}
-
-namespace content {
-
-class RenderThread;
-
-// ScreenOrientationDispatcher listens to message from the browser process and
-// dispatch the orientation change ones to the WebScreenOrientationListener.
-class CONTENT_EXPORT ScreenOrientationDispatcher
- : public RenderProcessObserver {
- public:
- explicit ScreenOrientationDispatcher(RenderThread*);
- virtual ~ScreenOrientationDispatcher() {}
-
- // RenderProcessObserver
- virtual bool OnControlMessageReceived(const IPC::Message& message) OVERRIDE;
-
- void setListener(blink::WebScreenOrientationListener* listener);
-
- private:
- void OnOrientationChange(blink::WebScreenOrientation orientation);
-
- blink::WebScreenOrientationListener* listener_;
-
- DISALLOW_COPY_AND_ASSIGN(ScreenOrientationDispatcher);
-};
-
-} // namespace content
-
-#endif // CONTENT_RENDERER_SCREEN_ORIENTATION_DISPATCHER_H_
diff --git a/content/renderer/screen_orientation/screen_orientation_dispatcher_unittest.cc b/content/renderer/screen_orientation/screen_orientation_dispatcher_unittest.cc
deleted file mode 100644
index 966c042..0000000
--- a/content/renderer/screen_orientation/screen_orientation_dispatcher_unittest.cc
+++ /dev/null
@@ -1,111 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "screen_orientation_dispatcher.h"
-
-#include "base/logging.h"
-#include "base/memory/scoped_ptr.h"
-#include "content/common/screen_orientation_messages.h"
-#include "content/public/test/mock_render_thread.h"
-#include "content/public/test/test_utils.h"
-#include "testing/gtest/include/gtest/gtest.h"
-#include "third_party/WebKit/public/platform/WebScreenOrientationListener.h"
-
-namespace content {
-
-class MockScreenOrientationListener :
- public blink::WebScreenOrientationListener {
- public:
- MockScreenOrientationListener();
- virtual ~MockScreenOrientationListener() {}
-
- virtual void didChangeScreenOrientation(blink::WebScreenOrientation) OVERRIDE;
-
- bool did_change_screen_orientation() const {
- return did_change_screen_orientation_;
- }
-
- blink::WebScreenOrientation screen_orientation() const {
- return screen_orientation_;
- }
-
- private:
- bool did_change_screen_orientation_;
- blink::WebScreenOrientation screen_orientation_;
-
- DISALLOW_COPY_AND_ASSIGN(MockScreenOrientationListener);
-};
-
-MockScreenOrientationListener::MockScreenOrientationListener()
- : did_change_screen_orientation_(false),
- screen_orientation_(blink::WebScreenOrientationPortraitPrimary) {
-}
-
-void MockScreenOrientationListener::didChangeScreenOrientation(
- blink::WebScreenOrientation orientation) {
- did_change_screen_orientation_ = true;
- screen_orientation_ = orientation;
-}
-
-class ScreenOrientationDispatcherTest : public testing::Test {
- protected:
- virtual void SetUp() OVERRIDE {
- render_thread_.reset(new MockRenderThread);
- listener_.reset(new MockScreenOrientationListener);
- dispatcher_.reset(new ScreenOrientationDispatcher(render_thread_.get()));
- dispatcher_->setListener(listener_.get());
- }
-
- scoped_ptr<MockRenderThread> render_thread_;
- scoped_ptr<MockScreenOrientationListener> listener_;
- scoped_ptr<ScreenOrientationDispatcher> dispatcher_;
-};
-
-TEST_F(ScreenOrientationDispatcherTest, ListensToMessages) {
- EXPECT_TRUE(render_thread_->observers().HasObserver(dispatcher_.get()));
-
- render_thread_->OnControlMessageReceived(
- ScreenOrientationMsg_OrientationChange(
- blink::WebScreenOrientationPortraitPrimary));
-
- EXPECT_TRUE(listener_->did_change_screen_orientation());
-}
-
-TEST_F(ScreenOrientationDispatcherTest, NullListener) {
- dispatcher_->setListener(NULL);
-
- render_thread_->OnControlMessageReceived(
- ScreenOrientationMsg_OrientationChange(
- blink::WebScreenOrientationPortraitPrimary));
-
- EXPECT_FALSE(listener_->did_change_screen_orientation());
-}
-
-TEST_F(ScreenOrientationDispatcherTest, ValidValues) {
- render_thread_->OnControlMessageReceived(
- ScreenOrientationMsg_OrientationChange(
- blink::WebScreenOrientationPortraitPrimary));
- EXPECT_EQ(blink::WebScreenOrientationPortraitPrimary,
- listener_->screen_orientation());
-
- render_thread_->OnControlMessageReceived(
- ScreenOrientationMsg_OrientationChange(
- blink::WebScreenOrientationLandscapePrimary));
- EXPECT_EQ(blink::WebScreenOrientationLandscapePrimary,
- listener_->screen_orientation());
-
- render_thread_->OnControlMessageReceived(
- ScreenOrientationMsg_OrientationChange(
- blink::WebScreenOrientationPortraitSecondary));
- EXPECT_EQ(blink::WebScreenOrientationPortraitSecondary,
- listener_->screen_orientation());
-
- render_thread_->OnControlMessageReceived(
- ScreenOrientationMsg_OrientationChange(
- blink::WebScreenOrientationLandscapeSecondary));
- EXPECT_EQ(blink::WebScreenOrientationLandscapeSecondary,
- listener_->screen_orientation());
-}
-
-} // namespace content
diff --git a/ipc/ipc_message_start.h b/ipc/ipc_message_start.h
index 6923e44..5b9c9d7 100644
--- a/ipc/ipc_message_start.h
+++ b/ipc/ipc_message_start.h
@@ -95,7 +95,6 @@ enum IPCMessageStart {
EmbeddedWorkerMsgStart,
EmbeddedWorkerContextMsgStart,
CastMsgStart,
- ScreenOrientationMsgStart,
LastIPCMsgStart // Must come last.
};