summaryrefslogtreecommitdiffstats
path: root/views/window
diff options
context:
space:
mode:
authorben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-14 21:08:02 +0000
committerben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-14 21:08:02 +0000
commitb577bd5475b1f214d0d7a2a64fa787cffd480829 (patch)
tree6fb38e2ea05d7f7e282747fa8b91b3ce8a488642 /views/window
parent320ddbe75a02d9443c6b73073e9cf907668dccd2 (diff)
downloadchromium_src-b577bd5475b1f214d0d7a2a64fa787cffd480829.zip
chromium_src-b577bd5475b1f214d0d7a2a64fa787cffd480829.tar.gz
chromium_src-b577bd5475b1f214d0d7a2a64fa787cffd480829.tar.bz2
Revert 78062 - Migrate more of BrowserFrame's event handling down into WindowWin/WidgetWin and their delegate interfaces.
BUG=72040 TEST=none Review URL: http://codereview.chromium.org/6683007 TBR=ben@chromium.org Review URL: http://codereview.chromium.org/6686059 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@78093 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/window')
-rw-r--r--views/window/native_window.h6
-rw-r--r--views/window/native_window_delegate.h4
-rw-r--r--views/window/window.cc10
-rw-r--r--views/window/window.h2
-rw-r--r--views/window/window_delegate.h9
-rw-r--r--views/window/window_gtk.cc16
-rw-r--r--views/window/window_gtk.h4
-rw-r--r--views/window/window_win.cc45
-rw-r--r--views/window/window_win.h6
9 files changed, 27 insertions, 75 deletions
diff --git a/views/window/native_window.h b/views/window/native_window.h
index a2fb965..7e4bd6a 100644
--- a/views/window/native_window.h
+++ b/views/window/native_window.h
@@ -37,9 +37,6 @@ class NativeWindow {
virtual Window* GetWindow() = 0;
- virtual NativeWidget* AsNativeWidget() = 0;
- virtual const NativeWidget* AsNativeWidget() const = 0;
-
protected:
friend class Window;
@@ -78,6 +75,9 @@ class NativeWindow {
virtual void SetAccessibleRole(ui::AccessibilityTypes::Role role) = 0;
virtual void SetAccessibleState(ui::AccessibilityTypes::State state) = 0;
+ virtual NativeWidget* AsNativeWidget() = 0;
+ virtual const NativeWidget* AsNativeWidget() const = 0;
+
// Window pass-thrus ---------------------------------------------------------
// See documentation in window.h
diff --git a/views/window/native_window_delegate.h b/views/window/native_window_delegate.h
index 23705a5..3807cfa 100644
--- a/views/window/native_window_delegate.h
+++ b/views/window/native_window_delegate.h
@@ -51,10 +51,6 @@ class NativeWindowDelegate {
// Called when the activation state of a window has changed.
virtual void OnNativeWindowActivationChanged(bool active) = 0;
- // Called when the user begins/ends to change the bounds of the window.
- virtual void OnNativeWindowBeginUserBoundsChange() = 0;
- virtual void OnNativeWindowEndUserBoundsChange() = 0;
-
// Called just before the native window is destroyed. This is the delegate's
// last chance to do anything with the native window handle.
virtual void OnNativeWindowDestroying() = 0;
diff --git a/views/window/window.cc b/views/window/window.cc
index ba7d055..71f8cd8 100644
--- a/views/window/window.cc
+++ b/views/window/window.cc
@@ -298,15 +298,7 @@ void Window::OnNativeWindowCreated(const gfx::Rect& bounds) {
void Window::OnNativeWindowActivationChanged(bool active) {
if (!active)
SaveWindowPosition();
- window_delegate_->OnWindowActivationChanged(active);
-}
-
-void Window::OnNativeWindowBeginUserBoundsChange() {
- window_delegate_->OnWindowBeginUserBoundsChange();
-}
-
-void Window::OnNativeWindowEndUserBoundsChange() {
- window_delegate_->OnWindowEndUserBoundsChange();
+ window_delegate_->OnWindowActivate(active);
}
void Window::OnNativeWindowDestroying() {
diff --git a/views/window/window.h b/views/window/window.h
index f18f4bb..fc9f3a5 100644
--- a/views/window/window.h
+++ b/views/window/window.h
@@ -213,8 +213,6 @@ class Window : public internal::NativeWindowDelegate {
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;
diff --git a/views/window/window_delegate.h b/views/window/window_delegate.h
index d1a350a..379276c 100644
--- a/views/window/window_delegate.h
+++ b/views/window/window_delegate.h
@@ -10,7 +10,6 @@
#include "base/scoped_ptr.h"
#include "ui/base/accessibility/accessibility_types.h"
-#include "views/widget/widget_delegate.h"
class SkBitmap;
@@ -34,7 +33,7 @@ class Window;
// it should be displayed and notify the delegate object of certain events.
//
///////////////////////////////////////////////////////////////////////////////
-class WindowDelegate : public WidgetDelegate {
+class WindowDelegate {
public:
WindowDelegate();
virtual ~WindowDelegate();
@@ -118,11 +117,7 @@ class WindowDelegate : public WidgetDelegate {
virtual void DeleteDelegate() {}
// Called when the window's activation state changes.
- virtual void OnWindowActivationChanged(bool active) {}
-
- // Called when the user begins/ends to change the bounds of the window.
- virtual void OnWindowBeginUserBoundsChange() {}
- virtual void OnWindowEndUserBoundsChange() {}
+ virtual void OnWindowActivate(bool active) {}
// Returns the View that is contained within this Window.
virtual View* GetContentsView();
diff --git a/views/window/window_gtk.cc b/views/window/window_gtk.cc
index 46af221..28bbd6c 100644
--- a/views/window/window_gtk.cc
+++ b/views/window/window_gtk.cc
@@ -233,14 +233,6 @@ void WindowGtk::SetInitialFocus() {
////////////////////////////////////////////////////////////////////////////////
// WindowGtk, NativeWindow implementation:
-NativeWidget* WindowGtk::AsNativeWidget() {
- return this;
-}
-
-const NativeWidget* WindowGtk::AsNativeWidget() const {
- return this;
-}
-
gfx::Rect WindowGtk::GetRestoredBounds() const {
// We currently don't support tiling, so this doesn't matter.
return GetWindowScreenBounds();
@@ -305,6 +297,14 @@ void WindowGtk::SetAccessibleRole(ui::AccessibilityTypes::Role role) {
void WindowGtk::SetAccessibleState(ui::AccessibilityTypes::State state) {
}
+NativeWidget* WindowGtk::AsNativeWidget() {
+ return this;
+}
+
+const NativeWidget* WindowGtk::AsNativeWidget() const {
+ return this;
+}
+
Window* WindowGtk::GetWindow() {
return this;
}
diff --git a/views/window/window_gtk.h b/views/window/window_gtk.h
index a6f2c9f..23d0bce 100644
--- a/views/window/window_gtk.h
+++ b/views/window/window_gtk.h
@@ -46,8 +46,6 @@ class WindowGtk : public WidgetGtk, public NativeWindow, public Window {
protected:
// Overridden from NativeWindow:
- virtual NativeWidget* AsNativeWidget() OVERRIDE;
- virtual const NativeWidget* AsNativeWidget() const OVERRIDE;
virtual gfx::Rect GetRestoredBounds() const OVERRIDE;
virtual void ShowNativeWindow(ShowState state) OVERRIDE;
virtual void BecomeModal() OVERRIDE;
@@ -61,6 +59,8 @@ class WindowGtk : public WidgetGtk, public NativeWindow, public Window {
virtual void SetAccessibleName(const std::wstring& name) OVERRIDE;
virtual void SetAccessibleRole(ui::AccessibilityTypes::Role role) OVERRIDE;
virtual void SetAccessibleState(ui::AccessibilityTypes::State state) OVERRIDE;
+ virtual NativeWidget* AsNativeWidget() OVERRIDE;
+ virtual const NativeWidget* AsNativeWidget() const OVERRIDE;
virtual Window* GetWindow() OVERRIDE;
virtual void SetWindowBounds(const gfx::Rect& bounds,
gfx::NativeWindow other_window) OVERRIDE;
diff --git a/views/window/window_win.cc b/views/window/window_win.cc
index e984b59..32583e3 100644
--- a/views/window/window_win.cc
+++ b/views/window/window_win.cc
@@ -142,13 +142,6 @@ void EnableMenuItem(HMENU menu, UINT command, bool enabled) {
EnableMenuItem(menu, command, flags);
}
-bool IsDwmRenderingWindowControls(HWND window) {
- DWMNCRENDERINGPOLICY policy;
- DwmGetWindowAttribute(window, DWMWA_NCRENDERING_POLICY, &policy,
- sizeof(policy));
- return policy == DWMNCRP_ENABLED;
-}
-
// If the hung renderer warning doesn't fit on screen, the amount of padding to
// be left between the edge of the window and the edge of the nearest monitor,
// after the window is nudged back on screen. Pixels.
@@ -439,16 +432,6 @@ LRESULT WindowWin::OnDwmCompositionChanged(UINT msg, WPARAM w_param,
return 0;
}
-void WindowWin::OnEnterSizeMove() {
- WidgetWin::OnEnterSizeMove();
- delegate_->OnNativeWindowBeginUserBoundsChange();
-}
-
-void WindowWin::OnExitSizeMove() {
- WidgetWin::OnExitSizeMove();
- delegate_->OnNativeWindowEndUserBoundsChange();
-}
-
void WindowWin::OnFinalMessage(HWND window) {
delegate_->OnNativeWindowDestroyed();
WidgetWin::OnFinalMessage(window);
@@ -622,19 +605,9 @@ LRESULT WindowWin::OnNCCalcSize(BOOL mode, LPARAM l_param) {
}
LRESULT WindowWin::OnNCHitTest(const CPoint& point) {
- // If the DWM is rendering the window controls, we need to give the DWM's
- // default window procedure first chance to handle hit testing.
- if (IsDwmRenderingWindowControls(GetNativeView())) {
- LRESULT result;
- if (DwmDefWindowProc(GetNativeView(), WM_NCHITTEST, 0,
- MAKELPARAM(point.x, point.y), &result)) {
- return result;
- }
- }
-
// First, give the NonClientView a chance to test the point to see if it
// provides any of the non-client area.
- POINT temp = point;
+ CPoint temp = point;
MapWindowPoints(HWND_DESKTOP, GetNativeView(), &temp, 1);
int component = delegate_->GetNonClientComponent(gfx::Point(temp));
if (component != HTNOWHERE)
@@ -879,14 +852,6 @@ void WindowWin::OnWindowPosChanging(WINDOWPOS* window_pos) {
////////////////////////////////////////////////////////////////////////////////
// WindowWin, NativeWindow implementation:
-NativeWidget* WindowWin::AsNativeWidget() {
- return this;
-}
-
-const NativeWidget* WindowWin::AsNativeWidget() const {
- return this;
-}
-
gfx::Rect WindowWin::GetRestoredBounds() const {
// If we're in fullscreen mode, we've changed the normal bounds to the monitor
// rect, so return the saved bounds instead.
@@ -1019,6 +984,14 @@ void WindowWin::SetAccessibleState(ui::AccessibilityTypes::State state) {
}
}
+NativeWidget* WindowWin::AsNativeWidget() {
+ return this;
+}
+
+const NativeWidget* WindowWin::AsNativeWidget() const {
+ return this;
+}
+
void WindowWin::SetWindowBounds(const gfx::Rect& bounds,
gfx::NativeWindow other_window) {
SetChildBounds(GetNativeView(), GetParent(), other_window, bounds,
diff --git a/views/window/window_win.h b/views/window/window_win.h
index 114ea1e..222608a 100644
--- a/views/window/window_win.h
+++ b/views/window/window_win.h
@@ -104,8 +104,6 @@ class WindowWin : public WidgetWin,
virtual LRESULT OnDwmCompositionChanged(UINT msg,
WPARAM w_param,
LPARAM l_param) OVERRIDE;
- virtual void OnEnterSizeMove() OVERRIDE;
- virtual void OnExitSizeMove() OVERRIDE;
virtual void OnFinalMessage(HWND window) OVERRIDE;
virtual void OnGetMinMaxInfo(MINMAXINFO* minmax_info) OVERRIDE;
virtual void OnInitMenu(HMENU menu) OVERRIDE;
@@ -137,8 +135,6 @@ class WindowWin : public WidgetWin,
virtual const Window* GetWindow() const OVERRIDE { return this; }
// Overridden from NativeWindow:
- virtual NativeWidget* AsNativeWidget() OVERRIDE;
- virtual const NativeWidget* AsNativeWidget() const OVERRIDE;
virtual gfx::Rect GetRestoredBounds() const OVERRIDE;
virtual void ShowNativeWindow(ShowState state) OVERRIDE;
virtual void BecomeModal() OVERRIDE;
@@ -152,6 +148,8 @@ class WindowWin : public WidgetWin,
virtual void SetAccessibleName(const std::wstring& name) OVERRIDE;
virtual void SetAccessibleRole(ui::AccessibilityTypes::Role role) OVERRIDE;
virtual void SetAccessibleState(ui::AccessibilityTypes::State state) OVERRIDE;
+ virtual NativeWidget* AsNativeWidget() OVERRIDE;
+ virtual const NativeWidget* AsNativeWidget() const OVERRIDE;
virtual void SetWindowBounds(const gfx::Rect& bounds,
gfx::NativeWindow other_window) OVERRIDE;
virtual void HideWindow() OVERRIDE;