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

Unified Diff: ui/aura/window.cc

Issue 8273040: Minimum size for aura window (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: " Created 9 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: ui/aura/window.cc
diff --git a/ui/aura/window.cc b/ui/aura/window.cc
index d2735184b9c53690a14f18cb429355d01a4e27ab..e20038697043ebe802b06aa969fc9be212bccd32 100644
--- a/ui/aura/window.cc
+++ b/ui/aura/window.cc
@@ -96,18 +96,18 @@ bool Window::IsVisible() const {
void Window::Maximize() {
if (UpdateShowStateAndRestoreBounds(ui::SHOW_STATE_MAXIMIZED))
- SetBounds(gfx::Screen::GetMonitorWorkAreaNearestWindow(this));
+ SetBoundsInternal(gfx::Screen::GetMonitorWorkAreaNearestWindow(this));
}
void Window::Fullscreen() {
if (UpdateShowStateAndRestoreBounds(ui::SHOW_STATE_FULLSCREEN))
- SetBounds(gfx::Screen::GetMonitorAreaNearestWindow(this));
+ SetBoundsInternal(gfx::Screen::GetMonitorAreaNearestWindow(this));
}
void Window::Restore() {
if (show_state_ != ui::SHOW_STATE_NORMAL) {
show_state_ = ui::SHOW_STATE_NORMAL;
- SetBounds(restore_bounds_);
+ SetBoundsInternal(restore_bounds_);
restore_bounds_.SetRect(0, 0, 0, 0);
}
}
@@ -138,21 +138,16 @@ void Window::SetLayoutManager(LayoutManager* layout_manager) {
}
void Window::SetBounds(const gfx::Rect& new_bounds) {
- // TODO: funnel this through the Desktop.
- gfx::Rect old_bounds = bounds();
- bool was_move = old_bounds.size() == new_bounds.size();
- layer_->SetBounds(new_bounds);
-
- if (layout_manager_.get())
- layout_manager_->OnWindowResized();
- if (delegate_)
- delegate_->OnBoundsChanged(old_bounds, new_bounds);
- if (IsVisible()) {
- if (was_move)
- layer()->ScheduleDraw();
- else
- layer()->SchedulePaint(gfx::Rect());
+ if (show_state_ == ui::SHOW_STATE_MAXIMIZED ||
+ show_state_ == ui::SHOW_STATE_FULLSCREEN) {
+ restore_bounds_ = new_bounds;
+ return;
}
+ SetBoundsInternal(new_bounds);
+}
+
+void Window::SetMinimumSize(const gfx::Size& minimum_size) {
+ minimum_size_ = minimum_size;
}
const gfx::Rect& Window::bounds() const {
@@ -376,6 +371,24 @@ internal::RootWindow* Window::GetRoot() {
return parent_ ? parent_->GetRoot() : NULL;
}
+void Window::SetBoundsInternal(const gfx::Rect& new_bounds) {
+ // TODO: funnel this through the Desktop.
Ben Goodger (Google) 2011/10/14 15:40:05 You can remove this comment now.
oshima 2011/10/15 02:10:50 Done.
+ const gfx::Rect old_bounds = bounds();
+ bool was_move = old_bounds.size() == new_bounds.size();
+ layer_->SetBounds(new_bounds);
+
+ if (layout_manager_.get())
+ layout_manager_->OnWindowResized();
+ if (delegate_)
+ delegate_->OnBoundsChanged(old_bounds, new_bounds);
+ if (IsVisible()) {
+ if (was_move)
+ layer()->ScheduleDraw();
+ else
+ layer()->SchedulePaint(gfx::Rect());
+ }
+}
+
void Window::SetVisible(bool visible) {
bool was_visible = IsVisible();
layer_->SetVisible(visible);

Powered by Google App Engine
This is Rietveld 408576698