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

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: ready for review 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 a9c88e7adb53c7a9ed4b46ac55e922f7adda0ab3..d67e0f4ae917f0400ef29761c5409315d1f94071 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"
@@ -73,7 +74,8 @@ void NativeWidgetAura::InitNativeWidget(const Widget::InitParams& params) {
window_->set_user_data(this);
Widget::InitParams::Type window_type =
params.child ? Widget::InitParams::TYPE_CONTROL : params.type;
- SetNativeWindowProperty(kWindowTypeKey, reinterpret_cast<void*>(window_type));
+ window_->SetIntProperty(kWindowTypeKey, window_type);
+ window_->SetIntProperty(aura::kShowStateKey, ui::SHOW_STATE_NORMAL);
window_->SetType(window_type == Widget::InitParams::TYPE_CONTROL ?
aura::kWindowType_Control : aura::kWindowType_None);
window_->Init(params.create_texture_for_layer ?
@@ -224,7 +226,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) {
@@ -320,20 +323,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();
}
@@ -359,7 +356,7 @@ void NativeWidgetAura::SetAlwaysOnTop(bool on_top) {
}
void NativeWidgetAura::Maximize() {
- window_->Maximize();
+ window_->SetIntProperty(aura::kShowStateKey, ui::SHOW_STATE_MAXIMIZED);
}
void NativeWidgetAura::Minimize() {
@@ -367,23 +364,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) {
@@ -551,6 +553,7 @@ void NativeWidgetAura::OnWindowDestroying() {
void NativeWidgetAura::OnWindowDestroyed() {
window_ = NULL;
+ tooltip_manager_.reset();
delegate_->OnNativeWidgetDestroyed();
if (ownership_ == Widget::InitParams::NATIVE_WIDGET_OWNS_WIDGET)
delete this;

Powered by Google App Engine
This is Rietveld 408576698