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

Unified Diff: views/widget/native_widget_views.cc

Issue 7925006: NativeWidgetViews: Implement Maximize. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 9 years, 3 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
« no previous file with comments | « views/widget/native_widget_views.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: views/widget/native_widget_views.cc
diff --git a/views/widget/native_widget_views.cc b/views/widget/native_widget_views.cc
index bd0e56ff65036df5e86c853bb5959f810157c44b..5725d8c2582fa96482ca028252d5f0b74f9591f3 100644
--- a/views/widget/native_widget_views.cc
+++ b/views/widget/native_widget_views.cc
@@ -5,7 +5,6 @@
#include "views/widget/native_widget_views.h"
#include "ui/gfx/compositor/compositor.h"
-#include "views/desktop/desktop_window_view.h"
#include "views/view.h"
#include "views/views_delegate.h"
#include "views/widget/native_widget_view.h"
@@ -31,7 +30,7 @@ NativeWidgetViews::NativeWidgetViews(internal::NativeWidgetDelegate* delegate)
: delegate_(delegate),
view_(NULL),
active_(false),
- minimized_(false),
+ window_state_(ui::SHOW_STATE_DEFAULT),
always_on_top_(false),
ALLOW_THIS_IN_INITIALIZER_LIST(close_widget_factory_(this)),
ownership_(Widget::InitParams::NATIVE_WIDGET_OWNS_WIDGET),
@@ -410,7 +409,16 @@ void NativeWidgetViews::SetAlwaysOnTop(bool on_top) {
}
void NativeWidgetViews::Maximize() {
- NOTIMPLEMENTED();
+ if (window_state_ == ui::SHOW_STATE_MAXIMIZED)
+ return;
+
+ // Remember bounds and transform to use when unmaximized.
+ restored_bounds_ = view_->bounds();
sky 2011/09/22 17:59:10 Should we only do this if we're not minimized?
sadrul 2011/09/22 18:24:45 Yep. Good catch. Made this change here and also in
+ restored_transform_ = view_->GetTransform();
+
+ window_state_ = ui::SHOW_STATE_MAXIMIZED;
+ gfx::Size size = GetParentNativeWidget()->GetWindowScreenBounds().size();
+ SetBounds(gfx::Rect(gfx::Point(), size));
}
void NativeWidgetViews::Minimize() {
@@ -441,20 +449,19 @@ void NativeWidgetViews::Minimize() {
(float)target_height / (float)view_bounds.height());
view_->SetTransform(transform);
- minimized_ = true;
+ window_state_ = ui::SHOW_STATE_MINIMIZED;
}
bool NativeWidgetViews::IsMaximized() const {
- // NOTIMPLEMENTED();
- return false;
+ return window_state_ == ui::SHOW_STATE_MAXIMIZED;
}
bool NativeWidgetViews::IsMinimized() const {
- return minimized_;
+ return window_state_ == ui::SHOW_STATE_MINIMIZED;
}
void NativeWidgetViews::Restore() {
- minimized_ = false;
+ window_state_ = ui::SHOW_STATE_NORMAL;
view_->SetBoundsRect(restored_bounds_);
view_->SetTransform(restored_transform_);
}
« no previous file with comments | « views/widget/native_widget_views.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698