1// Copyright 2014 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5// IPC messages for screen orientation.
6// Multiply-included message file, hence no include guard.
7
8#include "content/common/content_export.h"
9#include "ipc/ipc_message_macros.h"
10#include "third_party/WebKit/public/platform/WebLockOrientationError.h"
11#include "third_party/WebKit/public/platform/WebScreenOrientationLockType.h"
12#include "third_party/WebKit/public/platform/WebScreenOrientationType.h"
13
14#undef IPC_MESSAGE_EXPORT
15#define IPC_MESSAGE_EXPORT CONTENT_EXPORT
16
17#define IPC_MESSAGE_START ScreenOrientationMsgStart
18
19IPC_ENUM_TRAITS_MIN_MAX_VALUE(blink::WebScreenOrientationType,
20                              blink::WebScreenOrientationUndefined,
21                              blink::WebScreenOrientationLandscapeSecondary)
22IPC_ENUM_TRAITS_MIN_MAX_VALUE(blink::WebScreenOrientationLockType,
23                              blink::WebScreenOrientationLockDefault,
24                              blink::WebScreenOrientationLockNatural)
25IPC_ENUM_TRAITS_MIN_MAX_VALUE(
26      blink::WebLockOrientationError,
27      blink::WebLockOrientationErrorNotAvailable,
28      blink::WebLockOrientationErrorCanceled)
29
30// The browser process informs the renderer process that the screen orientation
31// has changed. |orientation| contains the new screen orientation in degrees.
32// TODO(mlamouri): we could probably get rid of it.
33IPC_MESSAGE_CONTROL1(ScreenOrientationMsg_OrientationChange,
34                     blink::WebScreenOrientationType /* orientation */ )
35
36// The browser process' response to a ScreenOrientationHostMsg_LockRequest when
37// the lock actually succeeded. The |request_id| passed when receiving the
38// request is passed back so the renderer process can associate the response to
39// the right request.
40IPC_MESSAGE_ROUTED1(ScreenOrientationMsg_LockSuccess,
41                    int /* request_id */)
42
43// The browser process' response to a ScreenOrientationHostMsg_LockRequest when
44// the lock actually failed. The message includes the |error| type. The
45// |request_id| passed when receiving the request is passed back so the renderer
46// process can associate the response to the right request.
47IPC_MESSAGE_ROUTED2(ScreenOrientationMsg_LockError,
48                    int, /* request_id */
49                    blink::WebLockOrientationError /* error */)
50
51// The renderer process requests the browser process to lock the screen
52// orientation to the specified |orientations|. The request contains a
53// |request_id| that will have to be passed back to the renderer process when
54// notifying about a success or error (see ScreenOrientationMsg_LockError and
55// ScreenOrientationMsg_LockSuccess).
56IPC_MESSAGE_ROUTED2(ScreenOrientationHostMsg_LockRequest,
57                    blink::WebScreenOrientationLockType, /* orientation */
58                    int /* request_id */)
59
60// The renderer process requests the browser process to unlock the screen
61// orientation.
62IPC_MESSAGE_ROUTED0(ScreenOrientationHostMsg_Unlock)
63
64// The renderer process is now using the Screen Orientation API and informs the
65// browser process that it should start accurately listening to the screen
66// orientation if it wasn't already.
67// This is only expected to be acted upon when the underlying platform requires
68// heavy work in order to accurately know the screen orientation.
69IPC_MESSAGE_CONTROL0(ScreenOrientationHostMsg_StartListening)
70
71// The renderer process is no longer using the Screen Orientation API and
72// informs the browser process that it can stop accurately listening to the
73// screen orientation if no other process cares about it.
74// This is only expected to be acted upon when the underlying platform requires
75// heavy work in order to accurately know the screen orientation.
76IPC_MESSAGE_CONTROL0(ScreenOrientationHostMsg_StopListening)
77