diff options
author | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-27 19:51:12 +0000 |
---|---|---|
committer | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-27 19:51:12 +0000 |
commit | ac1f2faf8571fbeb2cf0e2cc52de5ccdd858cb01 (patch) | |
tree | e6f97dcde442f34858e6b4283fa2f3d457404ce0 /views/window | |
parent | fca58f01b8ca6d8795ee617f211465e924ff33c7 (diff) | |
download | chromium_src-ac1f2faf8571fbeb2cf0e2cc52de5ccdd858cb01.zip chromium_src-ac1f2faf8571fbeb2cf0e2cc52de5ccdd858cb01.tar.gz chromium_src-ac1f2faf8571fbeb2cf0e2cc52de5ccdd858cb01.tar.bz2 |
Move SetWindowBounds onto Widget.
BUG=72040
TEST=none
Review URL: http://codereview.chromium.org/6976047
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@87073 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/window')
-rw-r--r-- | views/window/native_window.h | 2 | ||||
-rw-r--r-- | views/window/native_window_gtk.cc | 8 | ||||
-rw-r--r-- | views/window/native_window_gtk.h | 2 | ||||
-rw-r--r-- | views/window/native_window_views.cc | 7 | ||||
-rw-r--r-- | views/window/native_window_views.h | 2 | ||||
-rw-r--r-- | views/window/native_window_win.cc | 60 | ||||
-rw-r--r-- | views/window/native_window_win.h | 2 | ||||
-rw-r--r-- | views/window/window.cc | 7 | ||||
-rw-r--r-- | views/window/window.h | 6 |
9 files changed, 2 insertions, 94 deletions
diff --git a/views/window/native_window.h b/views/window/native_window.h index 0ede59b..e029718 100644 --- a/views/window/native_window.h +++ b/views/window/native_window.h @@ -89,8 +89,6 @@ class NativeWindow { // Window pass-thrus --------------------------------------------------------- // See documentation in window.h - virtual void SetWindowBounds(const gfx::Rect& bounds, - gfx::NativeWindow other_window) = 0; virtual void SetFullscreen(bool fullscreen) = 0; virtual bool IsFullscreen() const = 0; virtual void SetUseDragFrame(bool use_drag_frame) = 0; diff --git a/views/window/native_window_gtk.cc b/views/window/native_window_gtk.cc index d65d9c0..a2bf870 100644 --- a/views/window/native_window_gtk.cc +++ b/views/window/native_window_gtk.cc @@ -247,7 +247,7 @@ void NativeWindowGtk::CenterWindow(const gfx::Size& size) { gfx::Rect bounds(center_rect.x() + (center_rect.width() - size.width()) / 2, center_rect.y() + (center_rect.height() - size.height()) / 2, size.width(), size.height()); - SetWindowBounds(bounds, NULL); + SetBoundsConstrained(bounds, NULL); } void NativeWindowGtk::GetWindowBoundsAndMaximizedState(gfx::Rect* bounds, @@ -285,12 +285,6 @@ const Window* NativeWindowGtk::GetWindow() const { return delegate_->AsWindow(); } -void NativeWindowGtk::SetWindowBounds(const gfx::Rect& bounds, - gfx::NativeWindow other_window) { - // TODO: need to deal with other_window. - NativeWidgetGtk::SetBounds(bounds); -} - void NativeWindowGtk::SetFullscreen(bool fullscreen) { if (fullscreen) gtk_window_fullscreen(GetNativeWindow()); diff --git a/views/window/native_window_gtk.h b/views/window/native_window_gtk.h index 56e46da..1d7a773 100644 --- a/views/window/native_window_gtk.h +++ b/views/window/native_window_gtk.h @@ -61,8 +61,6 @@ class NativeWindowGtk : public NativeWidgetGtk, public NativeWindow { 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 void SetWindowBounds(const gfx::Rect& bounds, - gfx::NativeWindow other_window) OVERRIDE; virtual void SetFullscreen(bool fullscreen) OVERRIDE; virtual bool IsFullscreen() const OVERRIDE; virtual void SetUseDragFrame(bool use_drag_frame) OVERRIDE; diff --git a/views/window/native_window_views.cc b/views/window/native_window_views.cc index de2e2ed..21addf3 100644 --- a/views/window/native_window_views.cc +++ b/views/window/native_window_views.cc @@ -85,13 +85,6 @@ void NativeWindowViews::SetAccessibleState( ui::AccessibilityTypes::State state) { } -void NativeWindowViews::SetWindowBounds(const gfx::Rect& bounds, - gfx::NativeWindow other_window) { - if (other_window) - NOTIMPLEMENTED(); - GetView()->SetBoundsRect(bounds); -} - void NativeWindowViews::SetFullscreen(bool fullscreen) { } diff --git a/views/window/native_window_views.h b/views/window/native_window_views.h index 83339be..1d1ac2d 100644 --- a/views/window/native_window_views.h +++ b/views/window/native_window_views.h @@ -42,8 +42,6 @@ class NativeWindowViews : public NativeWidgetViews, 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 void SetWindowBounds(const gfx::Rect& bounds, - gfx::NativeWindow other_window) OVERRIDE; virtual void SetFullscreen(bool fullscreen) OVERRIDE; virtual bool IsFullscreen() const OVERRIDE; virtual void SetUseDragFrame(bool use_drag_frame) OVERRIDE; diff --git a/views/window/native_window_win.cc b/views/window/native_window_win.cc index c72822a..0b3e0d1d 100644 --- a/views/window/native_window_win.cc +++ b/views/window/native_window_win.cc @@ -53,55 +53,6 @@ bool GetMonitorAndRects(const RECT& rect, return true; } -// Ensures that the child window stays within the boundaries of the parent -// before setting its bounds. If |parent_window| is NULL, the bounds of the -// parent are assumed to be the bounds of the monitor that |child_window| is -// nearest to. If |child_window| isn't visible yet and |insert_after_window| -// is non-NULL and visible, the monitor |insert_after_window| is on is used -// as the parent bounds instead. -void SetChildBounds(HWND child_window, HWND parent_window, - HWND insert_after_window, const gfx::Rect& bounds, - int padding, unsigned long flags) { - DCHECK(IsWindow(child_window)); - - // First figure out the bounds of the parent. - RECT parent_rect = {0}; - if (parent_window) { - GetClientRect(parent_window, &parent_rect); - } else { - // If there is no parent, we consider the bounds of the monitor the window - // is on to be the parent bounds. - - // If the child_window isn't visible yet and we've been given a valid, - // visible insert after window, use that window to locate the correct - // monitor instead. - HWND window = child_window; - if (!IsWindowVisible(window) && IsWindow(insert_after_window) && - IsWindowVisible(insert_after_window)) - window = insert_after_window; - - POINT window_point = { bounds.x(), bounds.y() }; - HMONITOR monitor = MonitorFromPoint(window_point, - MONITOR_DEFAULTTONEAREST); - if (monitor) { - MONITORINFO mi = {0}; - mi.cbSize = sizeof(mi); - GetMonitorInfo(monitor, &mi); - parent_rect = mi.rcWork; - } else { - NOTREACHED() << "Unable to get default monitor"; - } - } - - gfx::Rect actual_bounds = bounds; - internal::EnsureRectIsVisibleInRect(gfx::Rect(parent_rect), &actual_bounds, - padding); - - SetWindowPos(child_window, insert_after_window, actual_bounds.x(), - actual_bounds.y(), actual_bounds.width(), - actual_bounds.height(), flags); -} - // Returns true if edge |edge| (one of ABE_LEFT, TOP, RIGHT, or BOTTOM) of // monitor |monitor| has an auto-hiding taskbar that's always-on-top. bool EdgeHasTopmostAutoHideTaskbar(UINT edge, HMONITOR monitor) { @@ -140,11 +91,6 @@ void EnableMenuItem(HMENU menu, UINT command, bool enabled) { EnableMenuItem(menu, command, flags); } -// 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. -const int kMonitorEdgePadding = 10; - } // namespace namespace internal { @@ -1169,12 +1115,6 @@ void NativeWindowWin::SetAccessibleState(ui::AccessibilityTypes::State state) { } } -void NativeWindowWin::SetWindowBounds(const gfx::Rect& bounds, - gfx::NativeWindow other_window) { - SetChildBounds(GetNativeView(), GetParent(), other_window, bounds, - kMonitorEdgePadding, 0); -} - void NativeWindowWin::SetFullscreen(bool fullscreen) { if (fullscreen_ == fullscreen) return; // Nothing to do. diff --git a/views/window/native_window_win.h b/views/window/native_window_win.h index 71eac11..a79025b 100644 --- a/views/window/native_window_win.h +++ b/views/window/native_window_win.h @@ -149,8 +149,6 @@ class NativeWindowWin : public NativeWidgetWin, 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 void SetWindowBounds(const gfx::Rect& bounds, - gfx::NativeWindow other_window) OVERRIDE; virtual void SetFullscreen(bool fullscreen) OVERRIDE; virtual bool IsFullscreen() const OVERRIDE; virtual void SetUseDragFrame(bool use_drag_frame) OVERRIDE; diff --git a/views/window/window.cc b/views/window/window.cc index 1886aa5..ca9519f 100644 --- a/views/window/window.cc +++ b/views/window/window.cc @@ -107,11 +107,6 @@ gfx::Rect Window::GetNormalBounds() const { return native_window_->GetRestoredBounds(); } -void Window::SetWindowBounds(const gfx::Rect& bounds, - gfx::NativeWindow other_window) { - native_window_->SetWindowBounds(bounds, other_window); -} - void Window::ShowInactive() { native_window_->ShowNativeWindow(NativeWindow::SHOW_INACTIVE); } @@ -352,7 +347,7 @@ void Window::SetInitialBounds(const gfx::Rect& bounds) { native_window_->CenterWindow(non_client_view_->GetPreferredSize()); } else { // Use the supplied initial bounds. - SetWindowBounds(bounds, NULL); + SetBoundsConstrained(bounds, NULL); } } } diff --git a/views/window/window.h b/views/window/window.h index 669b23d..ddd8789 100644 --- a/views/window/window.h +++ b/views/window/window.h @@ -79,12 +79,6 @@ class Window : public Widget, // Retrieves the restored bounds for the window. gfx::Rect GetNormalBounds() const; - // Sets the Window's bounds. The window is inserted after |other_window| in - // the window Z-order. If this window is not yet visible, other_window's - // monitor is used as the constraining rectangle, rather than this window's - // monitor. - void SetWindowBounds(const gfx::Rect& bounds, gfx::NativeWindow other_window); - // Like Show(), but does not activate the window. void ShowInactive(); |