Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(494)

Side by Side Diff: chrome/browser/chromeos/wm_ipc.h

Issue 661237: This adds in the ability for Chrome to generate windows with snapshots of all... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/chromeos/panels/panel_browsertest.cc ('k') | chrome/browser/chromeos/wm_ipc.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_CHROMEOS_WM_IPC_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_WM_IPC_H_
6 #define CHROME_BROWSER_CHROMEOS_WM_IPC_H_ 6 #define CHROME_BROWSER_CHROMEOS_WM_IPC_H_
7 7
8 #include <gtk/gtk.h> 8 #include <gtk/gtk.h>
9 #include <map> 9 #include <map>
10 #include <string> 10 #include <string>
(...skipping 23 matching lines...) Expand all
34 ATOM_WM_STATE, 34 ATOM_WM_STATE,
35 ATOM_WM_TRANSIENT_FOR, 35 ATOM_WM_TRANSIENT_FOR,
36 ATOM_WM_SYSTEM_METRICS, 36 ATOM_WM_SYSTEM_METRICS,
37 kNumAtoms, 37 kNumAtoms,
38 }; 38 };
39 39
40 enum WindowType { 40 enum WindowType {
41 WINDOW_TYPE_UNKNOWN = 0, 41 WINDOW_TYPE_UNKNOWN = 0,
42 42
43 // A top-level Chrome window. 43 // A top-level Chrome window.
44 // param[0]: The number of tabs currently in this Chrome window.
45 // param[1]: The index of the currently selected tab in this
46 // Chrome window.
44 WINDOW_TYPE_CHROME_TOPLEVEL, 47 WINDOW_TYPE_CHROME_TOPLEVEL,
45 48
46 // A window showing scaled-down views of all of the tabs within a 49 // Vestiges of the old windows-across-the-bottom overview mode.
47 // Chrome window. 50 DEPRECATED_WINDOW_TYPE_CHROME_TAB_SUMMARY,
48 WINDOW_TYPE_CHROME_TAB_SUMMARY, 51 DEPRECATED_WINDOW_TYPE_CHROME_FLOATING_TAB,
49
50 // A tab that's been detached from a Chrome window and is currently
51 // being dragged.
52 // param[0]: Cursor's initial X position at the start of the drag
53 // param[1]: Cursor's initial Y position
54 // param[2]: X component of cursor's offset from upper-left corner of
55 // tab at start of drag
56 // param[3]: Y component of cursor's offset
57 WINDOW_TYPE_CHROME_FLOATING_TAB,
58 52
59 // The contents of a popup window. 53 // The contents of a popup window.
60 // param[0]: X ID of associated titlebar, which must be mapped before 54 // param[0]: X ID of associated titlebar, which must be mapped before
61 // its content 55 // its content
62 // param[1]: Initial state for panel (0 is collapsed, 1 is expanded) 56 // param[1]: Initial state for panel (0 is collapsed, 1 is expanded)
63 WINDOW_TYPE_CHROME_PANEL_CONTENT, 57 WINDOW_TYPE_CHROME_PANEL_CONTENT,
64 58
65 // A small window representing a collapsed panel in the panel bar and 59 // A small window representing a collapsed panel in the panel bar and
66 // drawn above the panel when it's expanded. 60 // drawn above the panel when it's expanded.
67 WINDOW_TYPE_CHROME_PANEL_TITLEBAR, 61 WINDOW_TYPE_CHROME_PANEL_TITLEBAR,
68 62
69 // A small window that when clicked creates a new browser window. 63 // Vestiges of an earlier UI design.
70 WINDOW_TYPE_CREATE_BROWSER_WINDOW, 64 DEPRECATED_WINDOW_TYPE_CREATE_BROWSER_WINDOW,
71 65
72 // A Chrome info bubble (e.g. the bookmark bubble). These are 66 // A Chrome info bubble (e.g. the bookmark bubble). These are
73 // transient RGBA windows; we skip the usual transient behavior of 67 // transient RGBA windows; we skip the usual transient behavior of
74 // centering them over their owner and omit drawing a drop shadow. 68 // centering them over their owner and omit drawing a drop shadow.
75 WINDOW_TYPE_CHROME_INFO_BUBBLE, 69 WINDOW_TYPE_CHROME_INFO_BUBBLE,
76 70
77 // A window showing a view of a tab within a Chrome window. 71 // A window showing a view of a tab within a Chrome window.
78 // param[0]: X ID of toplevel window that owns it. 72 // param[0]: X ID of toplevel window that owns it.
79 // param[1]: index of this tab in the tab order (range is 0 to 73 // param[1]: index of this tab in the toplevel window that owns it.
80 // sum of all tabs in all browsers).
81 WINDOW_TYPE_CHROME_TAB_SNAPSHOT, 74 WINDOW_TYPE_CHROME_TAB_SNAPSHOT,
82 75
83 // The following types are used for the windows that represent a user that 76 // The following types are used for the windows that represent a user that
84 // has already logged into the system. 77 // has already logged into the system.
85 // 78 //
86 // Visually the BORDER contains the IMAGE and CONTROLS windows, the LABEL 79 // Visually the BORDER contains the IMAGE and CONTROLS windows, the LABEL
87 // and UNSELECTED_LABEL are placed beneath the BORDER. The LABEL window is 80 // and UNSELECTED_LABEL are placed beneath the BORDER. The LABEL window is
88 // onscreen when the user is selected, otherwise the UNSELECTED_LABEL is 81 // onscreen when the user is selected, otherwise the UNSELECTED_LABEL is
89 // on screen. The GUEST window is used when the user clicks on the entry 82 // on screen. The GUEST window is used when the user clicks on the entry
90 // that represents the 'guest' user. 83 // that represents the 'guest' user.
(...skipping 20 matching lines...) Expand all
111 kNumWindowTypes, 104 kNumWindowTypes,
112 }; 105 };
113 106
114 struct Message { 107 struct Message {
115 public: 108 public:
116 // NOTE: Don't remove values from this enum; it is shared between 109 // NOTE: Don't remove values from this enum; it is shared between
117 // Chrome and the window manager. 110 // Chrome and the window manager.
118 enum Type { 111 enum Type {
119 UNKNOWN = 0, 112 UNKNOWN = 0,
120 113
121 // Notify Chrome when a floating tab has entered or left a tab 114 // Vestiges of the old windows-across-the-bottom overview mode.
122 // summary window. Sent to the summary window. 115 DEPRECATED_CHROME_NOTIFY_FLOATING_TAB_OVER_TAB_SUMMARY,
123 // param[0]: X ID of the floating tab window 116 DEPRECATED_CHROME_NOTIFY_FLOATING_TAB_OVER_TOPLEVEL,
124 // param[1]: state (0 means left, 1 means entered or currently in) 117 DEPRECATED_CHROME_SET_TAB_SUMMARY_VISIBILITY,
125 // param[2]: X coordinate relative to summary window
126 // param[3]: Y coordinate
127 CHROME_NOTIFY_FLOATING_TAB_OVER_TAB_SUMMARY,
128
129 // Notify Chrome when a floating tab has entered or left a top-level
130 // window. Sent to the window being entered/left.
131 // param[0]: X ID of the floating tab window
132 // param[1]: state (0 means left, 1 means entered)
133 CHROME_NOTIFY_FLOATING_TAB_OVER_TOPLEVEL,
134
135 // Instruct a top-level Chrome window to change the visibility of its
136 // tab summary window.
137 // param[0]: desired visibility (0 means hide, 1 means show)
138 // param[1]: X position (relative to the left edge of the root
139 // window) of the center of the top-level window. Only
140 // relevant for "show" messages
141 CHROME_SET_TAB_SUMMARY_VISIBILITY,
142 118
143 // Tell the WM to collapse or expand a panel. 119 // Tell the WM to collapse or expand a panel.
144 // param[0]: X ID of the panel window 120 // param[0]: X ID of the panel window
145 // param[1]: desired state (0 means collapsed, 1 means expanded) 121 // param[1]: desired state (0 means collapsed, 1 means expanded)
146 WM_SET_PANEL_STATE, 122 WM_SET_PANEL_STATE,
147 123
148 // Notify Chrome that the panel state has changed. Sent to the panel 124 // Notify Chrome that the panel state has changed. Sent to the panel
149 // window. 125 // window.
150 // param[0]: new state (0 means collapsed, 1 means expanded) 126 // param[0]: new state (0 means collapsed, 1 means expanded)
127 // TODO: Deprecate this; Chrome can just watch for changes to the
128 // _CHROME_STATE property to get the same information.
151 CHROME_NOTIFY_PANEL_STATE, 129 CHROME_NOTIFY_PANEL_STATE,
152 130
153 // Instruct the WM to move a floating tab. The passed-in position is 131 // From the old windows-across-the-bottom overview mode.
154 // that of the cursor; the tab's composited window is displaced based 132 DEPRECATED_WM_MOVE_FLOATING_TAB,
155 // on the cursor's offset from the upper-left corner of the tab at
156 // the start of the drag.
157 // param[0]: X ID of the floating tab window
158 // param[1]: X coordinate to which the tab should be moved
159 // param[2]: Y coordinate
160 WM_MOVE_FLOATING_TAB,
161 133
162 // Notify the WM that a panel has been dragged. 134 // Notify the WM that a panel has been dragged.
163 // param[0]: X ID of the panel's content window 135 // param[0]: X ID of the panel's content window
164 // param[1]: X coordinate to which the upper-right corner of the 136 // param[1]: X coordinate to which the upper-right corner of the
165 // panel's titlebar window was dragged 137 // panel's titlebar window was dragged
166 // param[2]: Y coordinate to which the upper-right corner of the 138 // param[2]: Y coordinate to which the upper-right corner of the
167 // panel's titlebar window was dragged 139 // panel's titlebar window was dragged
168 // Note: The point given is actually that of one pixel to the right 140 // Note: The point given is actually that of one pixel to the right
169 // of the upper-right corner of the titlebar window. For example, a 141 // of the upper-right corner of the titlebar window. For example, a
170 // no-op move message for a 10-pixel wide titlebar whose upper-left 142 // no-op move message for a 10-pixel wide titlebar whose upper-left
171 // point is at (0, 0) would contain the X and Y paremeters (10, 0): 143 // point is at (0, 0) would contain the X and Y paremeters (10, 0):
172 // in other words, the position of the titlebar's upper-left point 144 // in other words, the position of the titlebar's upper-left point
173 // plus its width. This is intended to make both the Chrome and WM 145 // plus its width. This is intended to make both the Chrome and WM
174 // side of things simpler and to avoid some easy-to-make off-by-one 146 // side of things simpler and to avoid some easy-to-make off-by-one
175 // errors. 147 // errors.
176 WM_NOTIFY_PANEL_DRAGGED, 148 WM_NOTIFY_PANEL_DRAGGED,
177 149
178 // Notify the WM that the panel drag is complete (that is, the mouse 150 // Notify the WM that the panel drag is complete (that is, the mouse
179 // button has been released). 151 // button has been released).
180 // param[0]: X ID of the panel's content window 152 // param[0]: X ID of the panel's content window
181 WM_NOTIFY_PANEL_DRAG_COMPLETE, 153 WM_NOTIFY_PANEL_DRAG_COMPLETE,
182 154
183 // Deprecated. Send a _NET_ACTIVE_WINDOW client message to focus a window 155 // Deprecated. Send a _NET_ACTIVE_WINDOW client message to focus a
184 // instead (e.g. using gtk_window_present()). 156 // window instead (e.g. using gtk_window_present()).
185 DEPRECATED_WM_FOCUS_WINDOW, 157 DEPRECATED_WM_FOCUS_WINDOW,
186 158
187 // Notify Chrome that the layout mode (for example, overview or 159 // Notify Chrome that the layout mode (for example, overview or
188 // focused) has changed. 160 // active) has changed. Since overview mode can be "cancelled"
189 // param[0]: new mode (0 means focused, 1 means overview) 161 // (user hits escape to revert), we have an extra parameter to
162 // indicate this.
163 // param[0]: new mode (0 means active mode, 1 means overview mode)
164 // param[1]: was mode cancelled? (0 = no, 1 = yes)
190 CHROME_NOTIFY_LAYOUT_MODE, 165 CHROME_NOTIFY_LAYOUT_MODE,
191 166
192 // Instruct the WM to enter overview mode. 167 // Deprecated. Instruct the WM to enter overview mode.
193 // param[0]: X ID of the window to show the tab overview for. 168 // param[0]: X ID of the window to show the tab overview for.
194 WM_SWITCH_TO_OVERVIEW_MODE, 169 DEPRECATED_WM_SWITCH_TO_OVERVIEW_MODE,
195 170
196 // Let the WM know which version of this file Chrome is using. It's 171 // Let the WM know which version of this file Chrome is using. It's
197 // difficult to make changes synchronously to Chrome and the WM (our 172 // difficult to make changes synchronously to Chrome and the WM (our
198 // build scripts can use a locally-built Chromium, the latest one 173 // build scripts can use a locally-built Chromium, the latest one
199 // from the buildbot, or an older hardcoded version), so it's useful 174 // from the buildbot, or an older hardcoded version), so it's useful
200 // to be able to maintain compatibility in the WM with versions of 175 // to be able to maintain compatibility in the WM with versions of
201 // Chrome that exhibit older behavior. 176 // Chrome that exhibit older behavior.
202 // 177 //
203 // Chrome should send a message to the WM at startup containing the 178 // Chrome should send a message to the WM at startup containing the
204 // latest version from the list below. For backwards compatibility, 179 // latest version from the list below. For backwards compatibility,
205 // the WM assumes version 0 if it doesn't receive a message. Here 180 // the WM assumes version 0 if it doesn't receive a message. Here
206 // are the changes that have been made in successive versions of the 181 // are the changes that have been made in successive versions of the
207 // protocol: 182 // protocol:
208 // 183 //
209 // 1: WM_NOTIFY_PANEL_DRAGGED contains the position of the 184 // 1: WM_NOTIFY_PANEL_DRAGGED contains the position of the
210 // upper-right, rather than upper-left, corner of of the titlebar 185 // upper-right, rather than upper-left, corner of of the titlebar
211 // window 186 // window
212 // 187 //
213 // TODO: The latest version should be hardcoded in this file once the 188 // TODO: The latest version should be hardcoded in this file once the
214 // file is being shared between Chrome and the WM so Chrome can just 189 // file is being shared between Chrome and the WM so Chrome can just
215 // pull it from there. Better yet, the message could be sent 190 // pull it from there. Better yet, the message could be sent
216 // automatically in WmIpc's c'tor. 191 // automatically in WmIpc's c'tor.
217 // 192 //
218 // param[0]: version of this protocol currently supported 193 // param[0]: version of this protocol currently supported
219 WM_NOTIFY_IPC_VERSION, 194 WM_NOTIFY_IPC_VERSION,
220 195
221 // Notify Chrome when a tab snapshot has been 'magnified' in the 196 // Notify Chrome when a tab has been selected in the overview.
222 // overview. Sent to the top level window. 197 // Sent to the toplevel window associated with the magnified
223 // param[0]: X ID of the tab snapshot window 198 // tab.
224 // param[1]: state (0 means end magnify, 1 means begin magnify) 199 // param[0]: tab index of newly selected tab.
225 CHROME_NOTIFY_TAB_SNAPSHOT_MAGNIFY, 200 CHROME_NOTIFY_TAB_SELECT,
226 201
227 // Forces the window manager to hide the login windows. 202 // Forces the window manager to hide the login windows.
228 WM_HIDE_LOGIN, 203 WM_HIDE_LOGIN,
229 204
230 // Sets whether login is enabled. If true the user can click on any of the 205 // Sets whether login is enabled. If true the user can click on any of the
231 // login windows to select one, if false clicks on unselected windows are 206 // login windows to select one, if false clicks on unselected windows are
232 // ignored. This is used when the user attempts a login to make sure the 207 // ignored. This is used when the user attempts a login to make sure the
233 // user doesn't select another user. 208 // user doesn't select another user.
234 // 209 //
235 // param[0]: true to enable, false to disable. 210 // param[0]: true to enable, false to disable.
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 static WmIpc* instance(); 263 static WmIpc* instance();
289 264
290 // Get or set a property describing a window's type. Type-specific 265 // Get or set a property describing a window's type. Type-specific
291 // parameters may also be supplied. The caller is responsible for trapping 266 // parameters may also be supplied. The caller is responsible for trapping
292 // errors from the X server. 267 // errors from the X server.
293 // TODO: Trap these ourselves. 268 // TODO: Trap these ourselves.
294 bool SetWindowType(GtkWidget* widget, 269 bool SetWindowType(GtkWidget* widget,
295 WindowType type, 270 WindowType type,
296 const std::vector<int>* params); 271 const std::vector<int>* params);
297 272
298 // Gets the type of the window. The caller is responsible for trapping 273 // Gets the type of the window, and any associated parameters. The
299 // errors from the X server. 274 // caller is responsible for trapping errors from the X server. If
300 WmIpc::WindowType GetWindowType(GtkWidget* widget); 275 // the parameters are not interesting to the caller, NULL may be
276 // passed for |params|.
277 WmIpc::WindowType GetWindowType(GtkWidget* widget, std::vector<int>* params);
301 278
302 // Sends a message to the WM. 279 // Sends a message to the WM.
303 void SendMessage(const Message& msg); 280 void SendMessage(const Message& msg);
304 281
305 // If |event| is a valid Message it is decoded into |msg| and true is 282 // If |event| is a valid Message it is decoded into |msg| and true is
306 // returned. If false is returned, |event| is not a valid Message. 283 // returned. If false is returned, |event| is not a valid Message.
307 bool DecodeMessage(const GdkEventClient& event, Message* msg); 284 bool DecodeMessage(const GdkEventClient& event, Message* msg);
308 285
309 // If |event| is a valid StringMessage it is decoded into |msg| and true is 286 // If |event| is a valid StringMessage it is decoded into |msg| and true is
310 // returned. If false is returned, |event| is not a valid StringMessage. 287 // returned. If false is returned, |event| is not a valid StringMessage.
(...skipping 27 matching lines...) Expand all
338 315
339 // Handle to the wm. Used for sending messages. 316 // Handle to the wm. Used for sending messages.
340 XID wm_; 317 XID wm_;
341 318
342 DISALLOW_COPY_AND_ASSIGN(WmIpc); 319 DISALLOW_COPY_AND_ASSIGN(WmIpc);
343 }; 320 };
344 321
345 } // namespace chromeos 322 } // namespace chromeos
346 323
347 #endif // CHROME_BROWSER_CHROMEOS_WM_IPC_H_ 324 #endif // CHROME_BROWSER_CHROMEOS_WM_IPC_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/panels/panel_browsertest.cc ('k') | chrome/browser/chromeos/wm_ipc.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698