1 // Copyright (c) 2012 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 #ifndef CONTENT_COMMON_VIEW_MESSAGES_H_
6 #define CONTENT_COMMON_VIEW_MESSAGES_H_
7 
8 // IPC messages for page rendering.
9 
10 #include <stddef.h>
11 #include <stdint.h>
12 
13 #include <set>
14 #include <string>
15 #include <vector>
16 
17 #include "base/optional.h"
18 #include "base/process/process.h"
19 #include "base/strings/string16.h"
20 #include "build/build_config.h"
21 #include "cc/input/touch_action.h"
22 #include "components/viz/common/frame_sinks/begin_frame_args.h"
23 #include "components/viz/common/quads/compositor_frame.h"
24 #include "components/viz/common/resources/shared_bitmap.h"
25 #include "content/common/common_param_traits_macros.h"
26 #include "content/common/content_export.h"
27 #include "content/common/content_param_traits.h"
28 #include "content/common/frame_replication_state.h"
29 #include "content/common/navigation_gesture.h"
30 #include "content/public/common/common_param_traits.h"
31 #include "content/public/common/menu_item.h"
32 #include "content/public/common/page_state.h"
33 #include "content/public/common/page_zoom.h"
34 #include "content/public/common/referrer.h"
35 #include "content/public/common/three_d_api_types.h"
36 #include "ipc/ipc_channel_handle.h"
37 #include "ipc/ipc_message_macros.h"
38 #include "media/base/audio_parameters.h"
39 #include "media/base/channel_layout.h"
40 #include "media/base/ipc/media_param_traits.h"
41 #include "net/base/network_change_notifier.h"
42 #include "ppapi/buildflags/buildflags.h"
43 #include "third_party/blink/public/mojom/manifest/display_mode.mojom.h"
44 #include "third_party/blink/public/mojom/renderer_preferences.mojom.h"
45 #include "third_party/blink/public/platform/web_text_autosizer_page_info.h"
46 #include "ui/base/ime/text_input_type.h"
47 #include "ui/gfx/color_space.h"
48 #include "ui/gfx/geometry/point.h"
49 #include "ui/gfx/geometry/rect.h"
50 #include "ui/gfx/geometry/rect_f.h"
51 #include "ui/gfx/geometry/vector2d.h"
52 #include "ui/gfx/geometry/vector2d_f.h"
53 #include "ui/gfx/ipc/color/gfx_param_traits.h"
54 #include "ui/gfx/ipc/gfx_param_traits.h"
55 #include "ui/gfx/ipc/skia/gfx_skia_param_traits.h"
56 #include "ui/native_theme/native_theme.h"
57 
58 #if defined(OS_MACOSX)
59 #include "third_party/blink/public/platform/mac/web_scrollbar_theme.h"
60 #endif
61 
62 #undef IPC_MESSAGE_EXPORT
63 #define IPC_MESSAGE_EXPORT CONTENT_EXPORT
64 
65 #define IPC_MESSAGE_START ViewMsgStart
66 
67 IPC_ENUM_TRAITS_MAX_VALUE(content::MenuItem::Type, content::MenuItem::TYPE_LAST)
68 IPC_ENUM_TRAITS_MAX_VALUE(content::NavigationGesture,
69                           content::NavigationGestureLast)
70 IPC_ENUM_TRAITS_MIN_MAX_VALUE(content::PageZoom,
71                               content::PageZoom::PAGE_ZOOM_OUT,
72                               content::PageZoom::PAGE_ZOOM_IN)
73 IPC_ENUM_TRAITS_MAX_VALUE(content::ThreeDAPIType,
74                           content::THREE_D_API_TYPE_LAST)
75 IPC_ENUM_TRAITS_MAX_VALUE(ui::TextInputType, ui::TEXT_INPUT_TYPE_MAX)
76 
77 #if defined(OS_MACOSX)
78 IPC_ENUM_TRAITS_MAX_VALUE(blink::ScrollerStyle, blink::kScrollerStyleOverlay)
79 #endif
80 
81 IPC_ENUM_TRAITS_MAX_VALUE(ui::NativeTheme::SystemThemeColor,
82                           ui::NativeTheme::SystemThemeColor::kMaxValue)
83 
84 IPC_STRUCT_TRAITS_BEGIN(content::MenuItem)
85   IPC_STRUCT_TRAITS_MEMBER(label)
86   IPC_STRUCT_TRAITS_MEMBER(tool_tip)
87   IPC_STRUCT_TRAITS_MEMBER(type)
88   IPC_STRUCT_TRAITS_MEMBER(action)
89   IPC_STRUCT_TRAITS_MEMBER(rtl)
90   IPC_STRUCT_TRAITS_MEMBER(has_directional_override)
91   IPC_STRUCT_TRAITS_MEMBER(enabled)
92   IPC_STRUCT_TRAITS_MEMBER(checked)
93   IPC_STRUCT_TRAITS_MEMBER(submenu)
94 IPC_STRUCT_TRAITS_END()
95 
96 // Messages sent from the browser to the renderer.
97 
98 // This passes a set of webkit preferences down to the renderer.
99 IPC_MESSAGE_ROUTED1(ViewMsg_UpdateWebPreferences,
100                     content::WebPreferences)
101 
102 // Used to notify the render-view that we have received a target URL. Used
103 // to prevent target URLs spamming the browser.
104 IPC_MESSAGE_ROUTED0(ViewMsg_UpdateTargetURL_ACK)
105 
106 // Notification that a move or resize renderer's containing window has
107 // started.
108 IPC_MESSAGE_ROUTED0(ViewMsg_MoveOrResizeStarted)
109 
110 #if BUILDFLAG(ENABLE_PLUGINS)
111 // Reply to ViewHostMsg_OpenChannelToPpapiBroker
112 // Tells the renderer that the channel to the broker has been created.
113 IPC_MESSAGE_ROUTED2(ViewMsg_PpapiBrokerChannelCreated,
114                     base::ProcessId /* broker_pid */,
115                     IPC::ChannelHandle /* handle */)
116 
117 // Reply to ViewHostMsg_RequestPpapiBrokerPermission.
118 // Tells the renderer whether permission to access to PPAPI broker was granted
119 // or not.
120 IPC_MESSAGE_ROUTED1(ViewMsg_PpapiBrokerPermissionResult,
121                     bool /* result */)
122 #endif
123 
124 // -----------------------------------------------------------------------------
125 // Messages sent from the renderer to the browser.
126 
127 // These two messages are sent to the parent RenderViewHost to display a widget
128 // that was created by CreateWidget/CreateFullscreenWidget. |route_id| refers
129 // to the id that was returned from the corresponding Create message above.
130 // |initial_rect| is in screen coordinates.
131 IPC_MESSAGE_ROUTED2(ViewHostMsg_ShowWidget,
132                     int /* route_id */,
133                     gfx::Rect /* initial_rect */)
134 
135 // Message to show a full screen widget.
136 IPC_MESSAGE_ROUTED1(ViewHostMsg_ShowFullscreenWidget,
137                     int /* route_id */)
138 
139 // Sent from an inactive renderer for the browser to route to the active
140 // renderer, instructing it to close.
141 IPC_MESSAGE_ROUTED0(ViewHostMsg_RouteCloseEvent)
142 
143 // Notifies the browser that we want to show a destination url for a potential
144 // action (e.g. when the user is hovering over a link).
145 IPC_MESSAGE_ROUTED1(ViewHostMsg_UpdateTargetURL,
146                     GURL)
147 
148 IPC_MESSAGE_ROUTED0(ViewHostMsg_Focus)
149 
150 // Get the list of proxies to use for |url|, as a semicolon delimited list
151 // of "<TYPE> <HOST>:<PORT>" | "DIRECT".
152 IPC_SYNC_MESSAGE_CONTROL1_2(ViewHostMsg_ResolveProxy,
153                             GURL /* url */,
154                             bool /* result */,
155                             std::string /* proxy list */)
156 
157 #if BUILDFLAG(ENABLE_PLUGINS)
158 // A renderer sends this to the browser process when it wants to access a PPAPI
159 // broker. In contrast to FrameHostMsg_OpenChannelToPpapiBroker, this is called
160 // for every connection.
161 // The browser will respond with ViewMsg_PpapiBrokerPermissionResult.
162 IPC_MESSAGE_ROUTED3(ViewHostMsg_RequestPpapiBrokerPermission,
163                     int /* routing_id */,
164                     GURL /* document_url */,
165                     base::FilePath /* plugin_path */)
166 #endif  // BUILDFLAG(ENABLE_PLUGINS)
167 
168 // When the renderer needs the browser to transfer focus cross-process on its
169 // behalf in the focus hierarchy. This may focus an element in the browser ui or
170 // a cross-process frame, as appropriate.
171 IPC_MESSAGE_ROUTED1(ViewHostMsg_TakeFocus,
172                     bool /* reverse */)
173 
174 IPC_MESSAGE_ROUTED1(
175     ViewHostMsg_NotifyTextAutosizerPageInfoChangedInLocalMainFrame,
176     blink::WebTextAutosizerPageInfo /* page_info */)
177 
178 // Adding a new message? Stick to the sort order above: first platform
179 // independent ViewMsg, then ifdefs for platform specific ViewMsg, then platform
180 // independent ViewHostMsg, then ifdefs for platform specific ViewHostMsg.
181 
182 #endif  // CONTENT_COMMON_VIEW_MESSAGES_H_
183