summaryrefslogtreecommitdiffstats
path: root/views/window/window.h
diff options
context:
space:
mode:
authorben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-06-02 22:07:05 +0000
committerben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-06-02 22:07:05 +0000
commit14bcec307d7ec6b13e90fe5e5ac8ca5aaa397b4b (patch)
tree7c88cf92588f0d99a38757f52cc92b47f7e053ef /views/window/window.h
parent6b8b0f08cfebb37c13f6c835c37d9ed9e982fc37 (diff)
downloadchromium_src-14bcec307d7ec6b13e90fe5e5ac8ca5aaa397b4b.zip
chromium_src-14bcec307d7ec6b13e90fe5e5ac8ca5aaa397b4b.tar.gz
chromium_src-14bcec307d7ec6b13e90fe5e5ac8ca5aaa397b4b.tar.bz2
Move NonClientView and FrameType logic from Window to Widget.
Also fixes leak of default WidgetDelegate by replacing it with a DefaultWidgetDelegate subclass that overrides DeleteDelegate and deletes itself. This required moving the destruction logic from Window down onto Widget. BUG=72040 TEST=none Review URL: http://codereview.chromium.org/7033049 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@87702 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/window/window.h')
-rw-r--r--views/window/window.h64
1 files changed, 3 insertions, 61 deletions
diff --git a/views/window/window.h b/views/window/window.h
index 98fc322..d659686 100644
--- a/views/window/window.h
+++ b/views/window/window.h
@@ -8,9 +8,7 @@
#include "ui/gfx/native_widget_types.h"
#include "views/widget/widget.h"
-#include "views/window/client_view.h"
#include "views/window/native_window_delegate.h"
-#include "views/window/non_client_view.h"
namespace gfx {
class Font;
@@ -21,7 +19,6 @@ class Size;
namespace views {
class NativeWindow;
-class NonClientFrameView;
class Widget;
class WindowDelegate;
@@ -43,12 +40,6 @@ 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();
@@ -98,25 +89,6 @@ class Window : public Widget,
// Tell the window to update its icon from the delegate.
void UpdateWindowIcon();
- // Creates an appropriate NonClientFrameView for this window.
- virtual NonClientFrameView* CreateFrameViewForWindow();
-
- // Updates the frame after an event caused it to be changed.
- virtual void UpdateFrameAfterFrameChange();
-
- 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();
-
// Overridden from Widget:
virtual void Show() OVERRIDE;
virtual void Close() OVERRIDE;
@@ -126,23 +98,7 @@ class Window : public Widget,
const_cast<const Window*>(this)->window_delegate());
}
const WindowDelegate* window_delegate() const {
- return window_delegate_;
- }
-
- NonClientView* non_client_view() {
- return const_cast<NonClientView*>(
- const_cast<const Window*>(this)->non_client_view());
- }
- const NonClientView* non_client_view() const {
- return non_client_view_;
- }
-
- ClientView* client_view() {
- return const_cast<ClientView*>(
- const_cast<const Window*>(this)->client_view());
- }
- const ClientView* client_view() const {
- return non_client_view()->client_view();
+ return reinterpret_cast<WindowDelegate*>(widget_delegate());
}
NativeWindow* native_window() { return native_window_; }
@@ -154,15 +110,14 @@ class Window : public Widget,
virtual void EnableInactiveRendering() OVERRIDE;
virtual bool IsModal() const OVERRIDE;
virtual bool IsDialogBox() const OVERRIDE;
- virtual gfx::Size GetMinimumSize() const OVERRIDE;
- virtual int GetNonClientComponent(const gfx::Point& point) const OVERRIDE;
+ virtual gfx::Size GetMinimumSize() OVERRIDE;
+ virtual int GetNonClientComponent(const gfx::Point& point) OVERRIDE;
virtual bool ExecuteCommand(int command_id) OVERRIDE;
virtual void OnNativeWindowCreated(const gfx::Rect& bounds) OVERRIDE;
virtual void OnNativeWindowActivationChanged(bool active) OVERRIDE;
virtual void OnNativeWindowBeginUserBoundsChange() OVERRIDE;
virtual void OnNativeWindowEndUserBoundsChange() OVERRIDE;
virtual void OnNativeWindowDestroying() OVERRIDE;
- virtual void OnNativeWindowDestroyed() OVERRIDE;
virtual void OnNativeWindowBoundsChanged() OVERRIDE;
virtual Window* AsWindow() OVERRIDE;
virtual internal::NativeWidgetDelegate* AsNativeWidgetDelegate() OVERRIDE;
@@ -177,15 +132,6 @@ class Window : public Widget,
NativeWindow* native_window_;
- // Our window delegate (see InitWindow() method for documentation).
- WindowDelegate* window_delegate_;
-
- // The View that provides the non-client area of the window (title bar,
- // window controls, sizing borders etc). To use an implementation other than
- // the default, this class must be sub-classed and this value set to the
- // desired implementation before calling |InitWindow()|.
- NonClientView* non_client_view_;
-
// The saved maximized state for this window. See note in SetInitialBounds
// that explains why we save this.
bool saved_maximized_state_;
@@ -200,10 +146,6 @@ 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);
};