| Index: ui/aura/window.cc
|
| diff --git a/ui/aura/window.cc b/ui/aura/window.cc
|
| index ec76fc73e7dec3d2de51b43dc87869fb3d06367c..2698c769ede30794bf8fac12889285722b0d68e9 100644
|
| --- a/ui/aura/window.cc
|
| +++ b/ui/aura/window.cc
|
| @@ -27,7 +27,6 @@ namespace aura {
|
| Window::Window(WindowDelegate* delegate)
|
| : type_(WINDOW_TYPE_UNKNOWN),
|
| delegate_(delegate),
|
| - show_state_(ui::SHOW_STATE_NORMAL),
|
| parent_(NULL),
|
| transient_parent_(NULL),
|
| id_(-1),
|
| @@ -103,32 +102,6 @@ bool Window::IsVisible() const {
|
| return layer_->IsDrawn();
|
| }
|
|
|
| -void Window::Maximize() {
|
| - // The desktop size may have changed, so make sure the window is maximized to
|
| - // the correct size even if it's already maximized.
|
| - gfx::Rect rect = gfx::Screen::GetMonitorWorkAreaNearestWindow(this);
|
| - if (UpdateShowStateAndRestoreBounds(ui::SHOW_STATE_MAXIMIZED) ||
|
| - rect != bounds())
|
| - SetBoundsInternal(rect);
|
| -}
|
| -
|
| -void Window::Fullscreen() {
|
| - // The desktop size may have changed, so make sure the window is fullscreen to
|
| - // the correct size even if it's already fullscreen.
|
| - gfx::Rect rect = gfx::Screen::GetMonitorAreaNearestWindow(this);
|
| - if (UpdateShowStateAndRestoreBounds(ui::SHOW_STATE_FULLSCREEN) ||
|
| - rect != bounds())
|
| - SetBoundsInternal(rect);
|
| -}
|
| -
|
| -void Window::Restore() {
|
| - if (show_state_ != ui::SHOW_STATE_NORMAL) {
|
| - show_state_ = ui::SHOW_STATE_NORMAL;
|
| - SetBoundsInternal(restore_bounds_);
|
| - restore_bounds_.SetRect(0, 0, 0, 0);
|
| - }
|
| -}
|
| -
|
| gfx::Rect Window::GetScreenBounds() const {
|
| const gfx::Rect local_bounds = bounds();
|
| gfx::Point origin = local_bounds.origin();
|
| @@ -168,16 +141,10 @@ void Window::SetLayoutManager(LayoutManager* layout_manager) {
|
| }
|
|
|
| void Window::SetBounds(const gfx::Rect& new_bounds) {
|
| - gfx::Rect adjusted_bounds = new_bounds;
|
| if (parent_ && parent_->layout_manager())
|
| - parent_->layout_manager()->CalculateBoundsForChild(this, &adjusted_bounds);
|
| -
|
| - if (show_state_ == ui::SHOW_STATE_MAXIMIZED ||
|
| - show_state_ == ui::SHOW_STATE_FULLSCREEN) {
|
| - restore_bounds_ = adjusted_bounds;
|
| - return;
|
| - }
|
| - SetBoundsInternal(adjusted_bounds);
|
| + parent_->layout_manager()->SetChildBounds(this, new_bounds);
|
| + else
|
| + SetBoundsInternal(new_bounds);
|
| }
|
|
|
| gfx::Rect Window::GetTargetBounds() const {
|
| @@ -409,31 +376,31 @@ Window* Window::GetToplevelWindow() {
|
| return window && window->parent() ? window : NULL;
|
| }
|
|
|
| -bool Window::IsOrContainsFullscreenWindow() const {
|
| - if (delegate_)
|
| - return IsVisible() && show_state_ == ui::SHOW_STATE_FULLSCREEN;
|
| -
|
| - for (Windows::const_iterator it = children_.begin();
|
| - it != children_.end(); ++it) {
|
| - if ((*it)->IsOrContainsFullscreenWindow())
|
| - return true;
|
| - }
|
| - return false;
|
| -}
|
| -
|
| void Window::SetProperty(const char* name, void* value) {
|
| + void* old = GetProperty(name);
|
| ui::ViewProp* prop = prop_map_[name];
|
| delete prop;
|
| if (value)
|
| prop_map_[name] = new ui::ViewProp(this, name, value);
|
| else
|
| prop_map_.erase(name);
|
| + FOR_EACH_OBSERVER(WindowObserver, observers_,
|
| + OnPropertyChanged(this, name, old));
|
| +}
|
| +
|
| +void Window::SetIntProperty(const char* name, int value) {
|
| + SetProperty(name, reinterpret_cast<void*>(value));
|
| }
|
|
|
| void* Window::GetProperty(const char* name) const {
|
| return ui::ViewProp::GetValue(const_cast<gfx::NativeView>(this), name);
|
| }
|
|
|
| +int Window::GetIntProperty(const char* name) const {
|
| + return static_cast<int>(reinterpret_cast<intptr_t>(
|
| + GetProperty(name)));
|
| +}
|
| +
|
| Desktop* Window::GetDesktop() {
|
| return parent_ ? parent_->GetDesktop() : NULL;
|
| }
|
| @@ -484,16 +451,6 @@ bool Window::StopsEventPropagation() const {
|
| return stops_event_propagation_ && !children_.empty();
|
| }
|
|
|
| -bool Window::UpdateShowStateAndRestoreBounds(
|
| - ui::WindowShowState new_show_state) {
|
| - if (show_state_ == new_show_state)
|
| - return false;
|
| - show_state_ = new_show_state;
|
| - if (restore_bounds_.IsEmpty())
|
| - restore_bounds_ = bounds();
|
| - return true;
|
| -}
|
| -
|
| Window* Window::GetWindowForPoint(const gfx::Point& local_point,
|
| bool return_tightest,
|
| bool for_event_handling) {
|
|
|