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

Unified Diff: views/widget/native_widget_aura.cc

Issue 8400063: Move maximize/fullscreen/restore to shell (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: addressed comments, property_util 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: views/widget/native_widget_aura.cc
diff --git a/views/widget/native_widget_aura.cc b/views/widget/native_widget_aura.cc
index 7d014ad301599cb2db0d1634a5f855c040c5b6f9..aec95342e2b6fa1471b35de817e641c41a03977b 100644
--- a/views/widget/native_widget_aura.cc
+++ b/views/widget/native_widget_aura.cc
@@ -5,6 +5,7 @@
#include "views/widget/native_widget_aura.h"
#include "base/bind.h"
+#include "ui/aura/aura_constants.h"
#include "ui/aura/desktop.h"
#include "ui/aura/event.h"
#include "ui/aura/window.h"
@@ -95,6 +96,7 @@ void NativeWidgetAura::InitNativeWidget(const Widget::InitParams& params) {
Widget::InitParams::Type window_type =
params.child ? Widget::InitParams::TYPE_CONTROL : params.type;
window_->SetType(GetAuraWindowTypeForWidgetType(window_type));
+ window_->SetIntProperty(aura::kShowStateKey, ui::SHOW_STATE_NORMAL);
window_->Init(params.create_texture_for_layer ?
ui::Layer::LAYER_HAS_TEXTURE :
ui::Layer::LAYER_HAS_NO_TEXTURE);
@@ -249,7 +251,8 @@ void NativeWidgetAura::CenterWindow(const gfx::Size& size) {
void NativeWidgetAura::GetWindowPlacement(
gfx::Rect* bounds,
ui::WindowShowState* maximized) const {
- *maximized = window_->show_state();
+ *maximized = static_cast<ui::WindowShowState>(
+ window_->GetIntProperty(aura::kShowStateKey));
}
void NativeWidgetAura::SetWindowTitle(const string16& title) {
@@ -345,20 +348,14 @@ void NativeWidgetAura::Hide() {
void NativeWidgetAura::ShowMaximizedWithBounds(
const gfx::Rect& restored_bounds) {
window_->SetBounds(restored_bounds);
- window_->Maximize();
+ window_->SetIntProperty(aura::kShowStateKey, ui::SHOW_STATE_MAXIMIZED);
window_->Show();
}
void NativeWidgetAura::ShowWithWindowState(ui::WindowShowState state) {
- switch(state) {
- case ui::SHOW_STATE_MAXIMIZED:
- window_->Maximize();
- break;
- case ui::SHOW_STATE_FULLSCREEN:
- window_->Fullscreen();
- break;
- default:
- break;
+ if (state == ui::SHOW_STATE_MAXIMIZED ||
+ state == ui::SHOW_STATE_FULLSCREEN) {
+ window_->SetIntProperty(aura::kShowStateKey, state);
}
window_->Show();
}
@@ -384,7 +381,7 @@ void NativeWidgetAura::SetAlwaysOnTop(bool on_top) {
}
void NativeWidgetAura::Maximize() {
- window_->Maximize();
+ window_->SetIntProperty(aura::kShowStateKey, ui::SHOW_STATE_MAXIMIZED);
}
void NativeWidgetAura::Minimize() {
@@ -392,23 +389,28 @@ void NativeWidgetAura::Minimize() {
}
bool NativeWidgetAura::IsMaximized() const {
- return window_->show_state() == ui::SHOW_STATE_MAXIMIZED;
+ return window_->GetIntProperty(aura::kShowStateKey) ==
+ ui::SHOW_STATE_MAXIMIZED;
}
bool NativeWidgetAura::IsMinimized() const {
- return window_->show_state() == ui::SHOW_STATE_MINIMIZED;
+ return window_->GetIntProperty(aura::kShowStateKey) ==
+ ui::SHOW_STATE_MINIMIZED;
}
void NativeWidgetAura::Restore() {
- window_->Restore();
+ window_->SetIntProperty(aura::kShowStateKey, ui::SHOW_STATE_NORMAL);
}
void NativeWidgetAura::SetFullscreen(bool fullscreen) {
- fullscreen ? window_->Fullscreen() : window_->Restore();
+ window_->SetIntProperty(
+ aura::kShowStateKey,
+ fullscreen ? ui::SHOW_STATE_FULLSCREEN : ui::SHOW_STATE_NORMAL);
}
bool NativeWidgetAura::IsFullscreen() const {
- return window_->show_state() == ui::SHOW_STATE_FULLSCREEN;
+ return window_->GetIntProperty(aura::kShowStateKey) ==
+ ui::SHOW_STATE_FULLSCREEN;
}
void NativeWidgetAura::SetOpacity(unsigned char opacity) {
@@ -576,6 +578,7 @@ void NativeWidgetAura::OnWindowDestroying() {
void NativeWidgetAura::OnWindowDestroyed() {
window_ = NULL;
+ tooltip_manager_.reset();
delegate_->OnNativeWidgetDestroyed();
if (ownership_ == Widget::InitParams::NATIVE_WIDGET_OWNS_WIDGET)
delete this;
« ui/aura_shell/property_util.h ('K') | « ui/aura_shell/workspace/workspace_manager_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698