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

Side by Side Diff: chrome/views/window/window_win.h

Issue 78002: Reorganize fullscreen mode handling. Now nearly everything is in WindowWin. ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 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/views/window/window.h ('k') | chrome/views/window/window_win.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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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_VIEWS_WINDOW_WINDOW_WIN_H__ 5 #ifndef CHROME_VIEWS_WINDOW_WINDOW_WIN_H__
6 #define CHROME_VIEWS_WINDOW_WINDOW_WIN_H__ 6 #define CHROME_VIEWS_WINDOW_WINDOW_WIN_H__
7 7
8 #include "chrome/common/notification_registrar.h" 8 #include "chrome/common/notification_registrar.h"
9 #include "chrome/views/widget/widget_win.h" 9 #include "chrome/views/widget/widget_win.h"
10 #include "chrome/views/window/client_view.h" 10 #include "chrome/views/window/client_view.h"
(...skipping 30 matching lines...) Expand all
41 // Retrieve the show state of the window. This is one of the SW_SHOW* flags 41 // Retrieve the show state of the window. This is one of the SW_SHOW* flags
42 // passed into Windows' ShowWindow method. For normal windows this defaults 42 // passed into Windows' ShowWindow method. For normal windows this defaults
43 // to SW_SHOWNORMAL, however windows (e.g. the main window) can override this 43 // to SW_SHOWNORMAL, however windows (e.g. the main window) can override this
44 // method to provide different values (e.g. retrieve the user's specified 44 // method to provide different values (e.g. retrieve the user's specified
45 // show state from the shortcut starutp info). 45 // show state from the shortcut starutp info).
46 virtual int GetShowState() const; 46 virtual int GetShowState() const;
47 47
48 // Executes the specified SC_command. 48 // Executes the specified SC_command.
49 void ExecuteSystemMenuCommand(int command); 49 void ExecuteSystemMenuCommand(int command);
50 50
51 // Hides the window if it hasn't already been force-hidden, then increments
52 // |force_hidden_count_| to prevent it from being shown again until
53 // PopForceHidden()) is called.
54 void PushForceHidden();
55
56 // Decrements |force_hidden_count_| and, if it is now zero, shows the window.
57 void PopForceHidden();
58
51 // Accessors and setters for various properties. 59 // Accessors and setters for various properties.
52 HWND owning_window() const { return owning_hwnd_; } 60 HWND owning_window() const { return owning_hwnd_; }
53 void set_focus_on_creation(bool focus_on_creation) { 61 void set_focus_on_creation(bool focus_on_creation) {
54 focus_on_creation_ = focus_on_creation; 62 focus_on_creation_ = focus_on_creation;
55 } 63 }
56 void set_force_hidden(bool force_hidden) { force_hidden_ = force_hidden; }
57 64
58 // Window overrides: 65 // Window overrides:
59 virtual gfx::Rect GetBounds() const; 66 virtual gfx::Rect GetBounds() const;
67 virtual gfx::Rect GetNormalBounds() const;
60 virtual void SetBounds(const gfx::Rect& bounds); 68 virtual void SetBounds(const gfx::Rect& bounds);
61 virtual void SetBounds(const gfx::Rect& bounds, 69 virtual void SetBounds(const gfx::Rect& bounds,
62 gfx::NativeWindow other_window); 70 gfx::NativeWindow other_window);
63 virtual void Show(); 71 virtual void Show();
64 virtual void Activate(); 72 virtual void Activate();
65 virtual void Close(); 73 virtual void Close();
66 virtual void Maximize(); 74 virtual void Maximize();
67 virtual void Minimize(); 75 virtual void Minimize();
68 virtual void Restore(); 76 virtual void Restore();
69 virtual bool IsActive() const; 77 virtual bool IsActive() const;
70 virtual bool IsVisible() const; 78 virtual bool IsVisible() const;
71 virtual bool IsMaximized() const; 79 virtual bool IsMaximized() const;
72 virtual bool IsMinimized() const; 80 virtual bool IsMinimized() const;
81 virtual void SetFullscreen(bool fullscreen);
82 virtual bool IsFullscreen() const;
73 virtual void EnableClose(bool enable); 83 virtual void EnableClose(bool enable);
74 virtual void DisableInactiveRendering(); 84 virtual void DisableInactiveRendering();
75 virtual void UpdateWindowTitle(); 85 virtual void UpdateWindowTitle();
76 virtual void UpdateWindowIcon(); 86 virtual void UpdateWindowIcon();
77 virtual NonClientFrameView* CreateFrameViewForWindow(); 87 virtual NonClientFrameView* CreateFrameViewForWindow();
78 virtual void UpdateFrameAfterFrameChange(); 88 virtual void UpdateFrameAfterFrameChange();
79 virtual WindowDelegate* GetDelegate() const; 89 virtual WindowDelegate* GetDelegate() const;
80 virtual NonClientView* GetNonClientView() const; 90 virtual NonClientView* GetNonClientView() const;
81 virtual ClientView* GetClientView() const; 91 virtual ClientView* GetClientView() const;
82 virtual gfx::NativeWindow GetNativeWindow() const; 92 virtual gfx::NativeWindow GetNativeWindow() const;
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 virtual LRESULT OnNCCalcSize(BOOL mode, LPARAM l_param); 135 virtual LRESULT OnNCCalcSize(BOOL mode, LPARAM l_param);
126 virtual LRESULT OnNCHitTest(const CPoint& point); 136 virtual LRESULT OnNCHitTest(const CPoint& point);
127 virtual void OnNCPaint(HRGN rgn); 137 virtual void OnNCPaint(HRGN rgn);
128 virtual void OnNCLButtonDown(UINT ht_component, const CPoint& point); 138 virtual void OnNCLButtonDown(UINT ht_component, const CPoint& point);
129 virtual void OnNCRButtonDown(UINT ht_component, const CPoint& point); 139 virtual void OnNCRButtonDown(UINT ht_component, const CPoint& point);
130 virtual LRESULT OnNCUAHDrawCaption(UINT msg, WPARAM w_param, LPARAM l_param); 140 virtual LRESULT OnNCUAHDrawCaption(UINT msg, WPARAM w_param, LPARAM l_param);
131 virtual LRESULT OnNCUAHDrawFrame(UINT msg, WPARAM w_param, LPARAM l_param); 141 virtual LRESULT OnNCUAHDrawFrame(UINT msg, WPARAM w_param, LPARAM l_param);
132 virtual LRESULT OnSetCursor(HWND window, UINT hittest_code, UINT message); 142 virtual LRESULT OnSetCursor(HWND window, UINT hittest_code, UINT message);
133 virtual LRESULT OnSetIcon(UINT size_type, HICON new_icon); 143 virtual LRESULT OnSetIcon(UINT size_type, HICON new_icon);
134 virtual LRESULT OnSetText(const wchar_t* text); 144 virtual LRESULT OnSetText(const wchar_t* text);
145 virtual void OnSettingChange(UINT flags, const wchar_t* section);
135 virtual void OnSize(UINT size_param, const CSize& new_size); 146 virtual void OnSize(UINT size_param, const CSize& new_size);
136 virtual void OnSysCommand(UINT notification_code, CPoint click); 147 virtual void OnSysCommand(UINT notification_code, CPoint click);
137 virtual void OnWindowPosChanging(WINDOWPOS* window_pos); 148 virtual void OnWindowPosChanging(WINDOWPOS* window_pos);
138 virtual Window* AsWindow() { return this; } 149 virtual Window* AsWindow() { return this; }
139 virtual const Window* AsWindow() const { return this; } 150 virtual const Window* AsWindow() const { return this; }
140 151
141 // Accessor for disable_inactive_rendering_. 152 // Accessor for disable_inactive_rendering_.
142 bool disable_inactive_rendering() const { 153 bool disable_inactive_rendering() const {
143 return disable_inactive_rendering_; 154 return disable_inactive_rendering_;
144 } 155 }
145 156
146 private: 157 private:
158 // Information saved before going into fullscreen mode, used to restore the
159 // window afterwards.
160 struct SavedWindowInfo {
161 bool maximized;
162 LONG style;
163 LONG ex_style;
164 RECT window_rect;
165 };
166
147 // Set the window as modal (by disabling all the other windows). 167 // Set the window as modal (by disabling all the other windows).
148 void BecomeModal(); 168 void BecomeModal();
149 169
150 // Sets-up the focus manager with the view that should have focus when the 170 // Sets-up the focus manager with the view that should have focus when the
151 // window is shown the first time. If NULL is returned, the focus goes to the 171 // window is shown the first time. If NULL is returned, the focus goes to the
152 // button if there is one, otherwise the to the Cancel button. 172 // button if there is one, otherwise the to the Cancel button.
153 void SetInitialFocus(); 173 void SetInitialFocus();
154 174
155 // Place and size the window when it is created. |create_bounds| are the 175 // Place and size the window when it is created. |create_bounds| are the
156 // bounds used when the window was created. 176 // bounds used when the window was created.
(...skipping 18 matching lines...) Expand all
175 195
176 // Asks the delegate if any to save the window's location and size. 196 // Asks the delegate if any to save the window's location and size.
177 void SaveWindowPosition(); 197 void SaveWindowPosition();
178 198
179 // Lock or unlock the window from being able to redraw itself in response to 199 // Lock or unlock the window from being able to redraw itself in response to
180 // updates to its invalid region. 200 // updates to its invalid region.
181 class ScopedRedrawLock; 201 class ScopedRedrawLock;
182 void LockUpdates(); 202 void LockUpdates();
183 void UnlockUpdates(); 203 void UnlockUpdates();
184 204
205 // Stops ignoring SetWindowPos() requests (see below).
206 void StopIgnoringPosChanges() { ignore_window_pos_changes_ = false; }
207
185 // Resets the window region for the current window bounds if necessary. 208 // Resets the window region for the current window bounds if necessary.
186 // If |force| is true, the window region is reset to NULL even for native 209 // If |force| is true, the window region is reset to NULL even for native
187 // frame windows. 210 // frame windows.
188 void ResetWindowRegion(bool force); 211 void ResetWindowRegion(bool force);
189 212
190 // Converts a non-client mouse down message to a regular ChromeViews event 213 // Converts a non-client mouse down message to a regular ChromeViews event
191 // and handle it. |point| is the mouse position of the message in screen 214 // and handle it. |point| is the mouse position of the message in screen
192 // coords. |flags| are flags that would be passed with a WM_L/M/RBUTTON* 215 // coords. |flags| are flags that would be passed with a WM_L/M/RBUTTON*
193 // message and relate to things like which button was pressed. These are 216 // message and relate to things like which button was pressed. These are
194 // combined with flags relating to the current key state. 217 // combined with flags relating to the current key state.
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 // Whether all ancestors have been enabled. This is only used if is_modal_ is 257 // Whether all ancestors have been enabled. This is only used if is_modal_ is
235 // true. 258 // true.
236 bool restored_enabled_; 259 bool restored_enabled_;
237 260
238 // Whether the window is currently always on top. 261 // Whether the window is currently always on top.
239 bool is_always_on_top_; 262 bool is_always_on_top_;
240 263
241 // We need to own the text of the menu, the Windows API does not copy it. 264 // We need to own the text of the menu, the Windows API does not copy it.
242 std::wstring always_on_top_menu_text_; 265 std::wstring always_on_top_menu_text_;
243 266
267 // True if we're in fullscreen mode.
268 bool fullscreen_;
269
270 // Saved window information from before entering fullscreen mode.
271 SavedWindowInfo saved_window_info_;
272
244 // Set to true if the window is in the process of closing . 273 // Set to true if the window is in the process of closing .
245 bool window_closed_; 274 bool window_closed_;
246 275
247 // True when the window should be rendered as active, regardless of whether 276 // True when the window should be rendered as active, regardless of whether
248 // or not it actually is. 277 // or not it actually is.
249 bool disable_inactive_rendering_; 278 bool disable_inactive_rendering_;
250 279
251 // True if this window is the active top level window. 280 // True if this window is the active top level window.
252 bool is_active_; 281 bool is_active_;
253 282
254 // True if updates to this window are currently locked. 283 // True if updates to this window are currently locked.
255 bool lock_updates_; 284 bool lock_updates_;
256 285
257 // The window styles of the window before updates were locked. 286 // The window styles of the window before updates were locked.
258 DWORD saved_window_style_; 287 DWORD saved_window_style_;
259 288
260 // The saved maximized state for this window. See note in SetInitialBounds 289 // The saved maximized state for this window. See note in SetInitialBounds
261 // that explains why we save this. 290 // that explains why we save this.
262 bool saved_maximized_state_; 291 bool saved_maximized_state_;
263 292
264 // True if we should prevent attempts to make the window visible when we 293 // When true, this flag makes us discard incoming SetWindowPos() requests that
265 // handle WM_WINDOWPOSCHANGING. Some calls like ShowWindow(SW_RESTORE) make 294 // only change our position/size. (We still allow changes to Z-order,
266 // the window visible in addition to restoring it, when all we want to do is 295 // activation, etc.)
267 // restore it. 296 bool ignore_window_pos_changes_;
268 bool force_hidden_; 297
298 // The following factory is used to ignore SetWindowPos() calls for short time
299 // periods.
300 ScopedRunnableMethodFactory<WindowWin> ignore_pos_changes_factory_;
301
302 // If this is greater than zero, we should prevent attempts to make the window
303 // visible when we handle WM_WINDOWPOSCHANGING. Some calls like
304 // ShowWindow(SW_RESTORE) make the window visible in addition to restoring it,
305 // when all we want to do is restore it.
306 int force_hidden_count_;
307
308 // The last-seen monitor containing us, and its rect and work area. These are
309 // used to catch updates to the rect and work area and react accordingly.
310 HMONITOR last_monitor_;
311 gfx::Rect last_monitor_rect_, last_work_area_;
269 312
270 // Hold onto notifications. 313 // Hold onto notifications.
271 NotificationRegistrar notification_registrar_; 314 NotificationRegistrar notification_registrar_;
272 315
273 DISALLOW_COPY_AND_ASSIGN(WindowWin); 316 DISALLOW_COPY_AND_ASSIGN(WindowWin);
274 }; 317 };
275 318
276 } // namespace views 319 } // namespace views
277 320
278 #endif // CHROME_VIEWS_WINDOW_WINDOW_WIN_H__ 321 #endif // CHROME_VIEWS_WINDOW_WINDOW_WIN_H__
OLDNEW
« no previous file with comments | « chrome/views/window/window.h ('k') | chrome/views/window/window_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698