1a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// Copyright 2014 The Chromium Authors. All rights reserved.
2a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
3a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// found in the LICENSE file.
4a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
5a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// IPC messages for screen orientation.
6a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// Multiply-included message file, hence no include guard.
7a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
8a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#include "content/common/content_export.h"
9a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#include "ipc/ipc_message_macros.h"
10116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch#include "third_party/WebKit/public/platform/WebLockOrientationError.h"
110529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch#include "third_party/WebKit/public/platform/WebScreenOrientationLockType.h"
120529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch#include "third_party/WebKit/public/platform/WebScreenOrientationType.h"
13a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
14a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#undef IPC_MESSAGE_EXPORT
15a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#define IPC_MESSAGE_EXPORT CONTENT_EXPORT
16a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
17a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#define IPC_MESSAGE_START ScreenOrientationMsgStart
18a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
190529e5d033099cbfc42635f6f6183833b09dff6eBen MurdochIPC_ENUM_TRAITS_MIN_MAX_VALUE(blink::WebScreenOrientationType,
205c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu                              blink::WebScreenOrientationUndefined,
210529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch                              blink::WebScreenOrientationLandscapeSecondary)
220529e5d033099cbfc42635f6f6183833b09dff6eBen MurdochIPC_ENUM_TRAITS_MIN_MAX_VALUE(blink::WebScreenOrientationLockType,
230529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch                              blink::WebScreenOrientationLockDefault,
24116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch                              blink::WebScreenOrientationLockNatural)
2546d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)IPC_ENUM_TRAITS_MIN_MAX_VALUE(
26116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch      blink::WebLockOrientationError,
27116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch      blink::WebLockOrientationErrorNotAvailable,
28116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch      blink::WebLockOrientationErrorCanceled)
29a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
30a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// The browser process informs the renderer process that the screen orientation
31a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// has changed. |orientation| contains the new screen orientation in degrees.
32f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)// TODO(mlamouri): we could probably get rid of it.
33a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)IPC_MESSAGE_CONTROL1(ScreenOrientationMsg_OrientationChange,
340529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch                     blink::WebScreenOrientationType /* orientation */ )
35a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
3646d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)// The browser process' response to a ScreenOrientationHostMsg_LockRequest when
375f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)// the lock actually succeeded. The |request_id| passed when receiving the
385f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)// request is passed back so the renderer process can associate the response to
395f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)// the right request.
405f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)IPC_MESSAGE_ROUTED1(ScreenOrientationMsg_LockSuccess,
415f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)                    int /* request_id */)
4246d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)
4346d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)// The browser process' response to a ScreenOrientationHostMsg_LockRequest when
4446d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)// the lock actually failed. The message includes the |error| type. The
4546d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)// |request_id| passed when receiving the request is passed back so the renderer
4646d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)// process can associate the response to the right request.
47f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)IPC_MESSAGE_ROUTED2(ScreenOrientationMsg_LockError,
48f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)                    int, /* request_id */
49116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch                    blink::WebLockOrientationError /* error */)
5046d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)
51a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// The renderer process requests the browser process to lock the screen
5246d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)// orientation to the specified |orientations|. The request contains a
5346d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)// |request_id| that will have to be passed back to the renderer process when
5446d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)// notifying about a success or error (see ScreenOrientationMsg_LockError and
5546d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)// ScreenOrientationMsg_LockSuccess).
56f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)IPC_MESSAGE_ROUTED2(ScreenOrientationHostMsg_LockRequest,
57f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)                    blink::WebScreenOrientationLockType, /* orientation */
58f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)                    int /* request_id */)
59a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
60a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// The renderer process requests the browser process to unlock the screen
61a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// orientation.
62f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)IPC_MESSAGE_ROUTED0(ScreenOrientationHostMsg_Unlock)
636e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)
646e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)// The renderer process is now using the Screen Orientation API and informs the
656e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)// browser process that it should start accurately listening to the screen
666e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)// orientation if it wasn't already.
676e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)// This is only expected to be acted upon when the underlying platform requires
686e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)// heavy work in order to accurately know the screen orientation.
696e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)IPC_MESSAGE_CONTROL0(ScreenOrientationHostMsg_StartListening)
706e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)
716e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)// The renderer process is no longer using the Screen Orientation API and
726e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)// informs the browser process that it can stop accurately listening to the
736e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)// screen orientation if no other process cares about it.
746e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)// This is only expected to be acted upon when the underlying platform requires
756e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)// heavy work in order to accurately know the screen orientation.
766e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)IPC_MESSAGE_CONTROL0(ScreenOrientationHostMsg_StopListening)
77