diff options
author | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-17 20:20:00 +0000 |
---|---|---|
committer | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-17 20:20:00 +0000 |
commit | e941a283e5b107f0c0a3595d0b6e11d7259d833f (patch) | |
tree | 27f886fcad4f9ef980e3638dfbc00ccf5f96a868 /views/window/window.h | |
parent | c4bdfe6586f6dd43c69102e4306872da504a1942 (diff) | |
download | chromium_src-e941a283e5b107f0c0a3595d0b6e11d7259d833f.zip chromium_src-e941a283e5b107f0c0a3595d0b6e11d7259d833f.tar.gz chromium_src-e941a283e5b107f0c0a3595d0b6e11d7259d833f.tar.bz2 |
Consolidate ShouldUseNativeFrame/AlwaysUseNativeFrame/UseNativeFrame spaghetti.
Now there is:
... window::ShouldUseNativeFrame()
Which is basically just a pass-thru to
WindowWin::ShouldUseNativeFrame()
... which can be overridden by subclasses. Native-Frame is a windows-only concept but keeping the API on Window means I don't have to update a lot of call sites.
Window also gains a FrameType state member that toggles three states - default, force-native and force-custom.
This supercedes the "AlwaysUseNativeFrame/AlwaysUseCustomFrame" methods on NonClientView.
I have also hooked up a context menu item behind a command line flag --debug-enable-frame-toggle that allows the frame type for an individual window to be toggled, useful for debugging.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/7036014
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@85666 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/window/window.h')
-rw-r--r-- | views/window/window.h | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/views/window/window.h b/views/window/window.h index 191aba4..eb8490a 100644 --- a/views/window/window.h +++ b/views/window/window.h @@ -52,6 +52,12 @@ class Window : public Widget, Widget::InitParams widget_init_params; }; + enum FrameType { + FRAME_TYPE_DEFAULT, // Use whatever the default would be. + FRAME_TYPE_FORCE_CUSTOM, // Force the custom frame. + FRAME_TYPE_FORCE_NATIVE // Force the native frame. + }; + Window(); virtual ~Window(); @@ -162,9 +168,16 @@ class Window : public Widget, // Retrieves the Window's native window handle. gfx::NativeWindow GetNativeWindow() const; + void set_frame_type(FrameType frame_type) { frame_type_ = frame_type; } + FrameType frame_type() const { return frame_type_; } + // Whether we should be using a native frame. bool ShouldUseNativeFrame() const; + // Forces the frame into the alternate frame type (custom or native) depending + // on its current state. + void DebugToggleFrameType(); + // Tell the window that something caused the frame type to change. void FrameTypeChanged(); @@ -201,7 +214,6 @@ class Window : public Widget, virtual void EnableInactiveRendering() OVERRIDE; virtual bool IsModal() const OVERRIDE; virtual bool IsDialogBox() const OVERRIDE; - virtual bool IsUsingNativeFrame() const OVERRIDE; virtual gfx::Size GetMinimumSize() const OVERRIDE; virtual int GetNonClientComponent(const gfx::Point& point) const OVERRIDE; virtual bool ExecuteCommand(int command_id) OVERRIDE; @@ -248,6 +260,10 @@ class Window : public Widget, // Set to true if the window is in the process of closing . bool window_closed_; + // The current frame type in use by this window. Defaults to + // FRAME_TYPE_DEFAULT. + FrameType frame_type_; + DISALLOW_COPY_AND_ASSIGN(Window); }; |