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

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

Issue 6975037: Revert 85666 - Consolidate ShouldUseNativeFrame/AlwaysUseNativeFrame/UseNativeFrame spaghetti. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 7 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 | « views/window/non_client_view.cc ('k') | views/window/window.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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 VIEWS_WINDOW_WINDOW_H_ 5 #ifndef VIEWS_WINDOW_WINDOW_H_
6 #define VIEWS_WINDOW_WINDOW_H_ 6 #define VIEWS_WINDOW_WINDOW_H_
7 #pragma once 7 #pragma once
8 8
9 #include "ui/gfx/native_widget_types.h" 9 #include "ui/gfx/native_widget_types.h"
10 #include "views/widget/widget.h" 10 #include "views/widget/widget.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 struct InitParams { 45 struct InitParams {
46 // |window_delegate| cannot be NULL. 46 // |window_delegate| cannot be NULL.
47 explicit InitParams(WindowDelegate* window_delegate); 47 explicit InitParams(WindowDelegate* window_delegate);
48 48
49 WindowDelegate* window_delegate; 49 WindowDelegate* window_delegate;
50 gfx::NativeWindow parent_window; 50 gfx::NativeWindow parent_window;
51 NativeWindow* native_window; 51 NativeWindow* native_window;
52 Widget::InitParams widget_init_params; 52 Widget::InitParams widget_init_params;
53 }; 53 };
54 54
55 enum FrameType {
56 FRAME_TYPE_DEFAULT, // Use whatever the default would be.
57 FRAME_TYPE_FORCE_CUSTOM, // Force the custom frame.
58 FRAME_TYPE_FORCE_NATIVE // Force the native frame.
59 };
60
61 Window(); 55 Window();
62 virtual ~Window(); 56 virtual ~Window();
63 57
64 // Creates an instance of an object implementing this interface. 58 // Creates an instance of an object implementing this interface.
65 // TODO(beng): create a version of this function that takes a NativeView, for 59 // TODO(beng): create a version of this function that takes a NativeView, for
66 // constrained windows. 60 // constrained windows.
67 static Window* CreateChromeWindow(gfx::NativeWindow parent, 61 static Window* CreateChromeWindow(gfx::NativeWindow parent,
68 const gfx::Rect& bounds, 62 const gfx::Rect& bounds,
69 WindowDelegate* window_delegate); 63 WindowDelegate* window_delegate);
70 64
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 155
162 // Creates an appropriate NonClientFrameView for this window. 156 // Creates an appropriate NonClientFrameView for this window.
163 virtual NonClientFrameView* CreateFrameViewForWindow(); 157 virtual NonClientFrameView* CreateFrameViewForWindow();
164 158
165 // Updates the frame after an event caused it to be changed. 159 // Updates the frame after an event caused it to be changed.
166 virtual void UpdateFrameAfterFrameChange(); 160 virtual void UpdateFrameAfterFrameChange();
167 161
168 // Retrieves the Window's native window handle. 162 // Retrieves the Window's native window handle.
169 gfx::NativeWindow GetNativeWindow() const; 163 gfx::NativeWindow GetNativeWindow() const;
170 164
171 void set_frame_type(FrameType frame_type) { frame_type_ = frame_type; }
172 FrameType frame_type() const { return frame_type_; }
173
174 // Whether we should be using a native frame. 165 // Whether we should be using a native frame.
175 bool ShouldUseNativeFrame() const; 166 bool ShouldUseNativeFrame() const;
176 167
177 // Forces the frame into the alternate frame type (custom or native) depending
178 // on its current state.
179 void DebugToggleFrameType();
180
181 // Tell the window that something caused the frame type to change. 168 // Tell the window that something caused the frame type to change.
182 void FrameTypeChanged(); 169 void FrameTypeChanged();
183 170
184 WindowDelegate* window_delegate() { 171 WindowDelegate* window_delegate() {
185 return const_cast<WindowDelegate*>( 172 return const_cast<WindowDelegate*>(
186 const_cast<const Window*>(this)->window_delegate()); 173 const_cast<const Window*>(this)->window_delegate());
187 } 174 }
188 const WindowDelegate* window_delegate() const { 175 const WindowDelegate* window_delegate() const {
189 return window_delegate_; 176 return window_delegate_;
190 } 177 }
(...skipping 16 matching lines...) Expand all
207 194
208 NativeWindow* native_window() { return native_window_; } 195 NativeWindow* native_window() { return native_window_; }
209 196
210 protected: 197 protected:
211 // Overridden from NativeWindowDelegate: 198 // Overridden from NativeWindowDelegate:
212 virtual bool CanActivate() const OVERRIDE; 199 virtual bool CanActivate() const OVERRIDE;
213 virtual bool IsInactiveRenderingDisabled() const OVERRIDE; 200 virtual bool IsInactiveRenderingDisabled() const OVERRIDE;
214 virtual void EnableInactiveRendering() OVERRIDE; 201 virtual void EnableInactiveRendering() OVERRIDE;
215 virtual bool IsModal() const OVERRIDE; 202 virtual bool IsModal() const OVERRIDE;
216 virtual bool IsDialogBox() const OVERRIDE; 203 virtual bool IsDialogBox() const OVERRIDE;
204 virtual bool IsUsingNativeFrame() const OVERRIDE;
217 virtual gfx::Size GetMinimumSize() const OVERRIDE; 205 virtual gfx::Size GetMinimumSize() const OVERRIDE;
218 virtual int GetNonClientComponent(const gfx::Point& point) const OVERRIDE; 206 virtual int GetNonClientComponent(const gfx::Point& point) const OVERRIDE;
219 virtual bool ExecuteCommand(int command_id) OVERRIDE; 207 virtual bool ExecuteCommand(int command_id) OVERRIDE;
220 virtual void OnNativeWindowCreated(const gfx::Rect& bounds) OVERRIDE; 208 virtual void OnNativeWindowCreated(const gfx::Rect& bounds) OVERRIDE;
221 virtual void OnNativeWindowActivationChanged(bool active) OVERRIDE; 209 virtual void OnNativeWindowActivationChanged(bool active) OVERRIDE;
222 virtual void OnNativeWindowBeginUserBoundsChange() OVERRIDE; 210 virtual void OnNativeWindowBeginUserBoundsChange() OVERRIDE;
223 virtual void OnNativeWindowEndUserBoundsChange() OVERRIDE; 211 virtual void OnNativeWindowEndUserBoundsChange() OVERRIDE;
224 virtual void OnNativeWindowDestroying() OVERRIDE; 212 virtual void OnNativeWindowDestroying() OVERRIDE;
225 virtual void OnNativeWindowDestroyed() OVERRIDE; 213 virtual void OnNativeWindowDestroyed() OVERRIDE;
226 virtual void OnNativeWindowBoundsChanged() OVERRIDE; 214 virtual void OnNativeWindowBoundsChanged() OVERRIDE;
(...skipping 26 matching lines...) Expand all
253 // The smallest size the window can be. 241 // The smallest size the window can be.
254 gfx::Size minimum_size_; 242 gfx::Size minimum_size_;
255 243
256 // True when the window should be rendered as active, regardless of whether 244 // True when the window should be rendered as active, regardless of whether
257 // or not it actually is. 245 // or not it actually is.
258 bool disable_inactive_rendering_; 246 bool disable_inactive_rendering_;
259 247
260 // Set to true if the window is in the process of closing . 248 // Set to true if the window is in the process of closing .
261 bool window_closed_; 249 bool window_closed_;
262 250
263 // The current frame type in use by this window. Defaults to
264 // FRAME_TYPE_DEFAULT.
265 FrameType frame_type_;
266
267 DISALLOW_COPY_AND_ASSIGN(Window); 251 DISALLOW_COPY_AND_ASSIGN(Window);
268 }; 252 };
269 253
270 } // namespace views 254 } // namespace views
271 255
272 #endif // #ifndef VIEWS_WINDOW_WINDOW_H_ 256 #endif // #ifndef VIEWS_WINDOW_WINDOW_H_
OLDNEW
« no previous file with comments | « views/window/non_client_view.cc ('k') | views/window/window.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698