summaryrefslogtreecommitdiffstats
path: root/views
diff options
context:
space:
mode:
authoroshima@google.com <oshima@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-01 23:19:12 +0000
committeroshima@google.com <oshima@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-01 23:19:12 +0000
commit37974ad4ffcf30f18c25c28e9dccd098ab5e71d8 (patch)
tree808da500f37170706e695c9a029a1b649a1a87bc /views
parente8ba615ab61359130553c7dd6419c331be5c49ad (diff)
downloadchromium_src-37974ad4ffcf30f18c25c28e9dccd098ab5e71d8.zip
chromium_src-37974ad4ffcf30f18c25c28e9dccd098ab5e71d8.tar.gz
chromium_src-37974ad4ffcf30f18c25c28e9dccd098ab5e71d8.tar.bz2
Move maximize/fullscreen/restore to shell
With this CL, window is now correctly maximized/fullscreen'ed on aura desktop. * Added OnPropertyChanged to WindowObserver * Added Get/Set IntProperty to simplify handling int value properties. * Remove IsOrContainsFullscreen. Added Workspace::ContainsFullscreen instead. We need this to autohide launcher. BUG=97257,97259 TEST=new test for property change notification. existing tests are updated, except maximized/fullscreen drag test. I'll add it to new set of tests that verifies window dragging within workspace. Review URL: http://codereview.chromium.org/8400063 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@108192 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views')
-rw-r--r--views/widget/native_widget_aura.cc34
1 files changed, 18 insertions, 16 deletions
diff --git a/views/widget/native_widget_aura.cc b/views/widget/native_widget_aura.cc
index 230235a..9a96bef 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/desktop_observer.h"
#include "ui/aura/event.h"
@@ -123,6 +124,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);
@@ -277,7 +279,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) {
@@ -377,15 +380,9 @@ void NativeWidgetAura::ShowMaximizedWithBounds(
}
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();
if (can_activate_ && (state != ui::SHOW_STATE_INACTIVE ||
@@ -415,7 +412,7 @@ void NativeWidgetAura::SetAlwaysOnTop(bool on_top) {
}
void NativeWidgetAura::Maximize() {
- window_->Maximize();
+ window_->SetIntProperty(aura::kShowStateKey, ui::SHOW_STATE_MAXIMIZED);
}
void NativeWidgetAura::Minimize() {
@@ -423,23 +420,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) {