Index: ash/wm/caption_buttons/frame_maximize_button.cc |
diff --git a/ash/wm/caption_buttons/frame_maximize_button.cc b/ash/wm/caption_buttons/frame_maximize_button.cc |
index bc32f26319c627284e0c5a56f3cdf33c55f876f5..e75faff5547848672c3313679edfac245ca9bee4 100644 |
--- a/ash/wm/caption_buttons/frame_maximize_button.cc |
+++ b/ash/wm/caption_buttons/frame_maximize_button.cc |
@@ -11,9 +11,8 @@ |
#include "ash/shell_delegate.h" |
#include "ash/touch/touch_uma.h" |
#include "ash/wm/caption_buttons/maximize_bubble_controller.h" |
-#include "ash/wm/property_util.h" |
#include "ash/wm/window_animations.h" |
-#include "ash/wm/window_settings.h" |
+#include "ash/wm/window_state.h" |
#include "ash/wm/workspace/phantom_window_controller.h" |
#include "ash/wm/workspace/snap_sizer.h" |
#include "grit/ash_strings.h" |
@@ -94,7 +93,7 @@ FrameMaximizeButton::FrameMaximizeButton(views::ButtonListener* listener, |
// TODO(sky): nuke this. It's temporary while we don't have good images. |
SetImageAlignment(ALIGN_LEFT, ALIGN_BOTTOM); |
- if (ash::Shell::IsForcedMaximizeMode()) |
+ if (Shell::IsForcedMaximizeMode()) |
views::View::SetVisible(false); |
} |
@@ -316,7 +315,7 @@ void FrameMaximizeButton::OnGestureEvent(ui::GestureEvent* event) { |
void FrameMaximizeButton::SetVisible(bool visible) { |
// In the enforced maximized mode we do not allow to be made visible. |
- if (ash::Shell::IsForcedMaximizeMode()) |
+ if (Shell::IsForcedMaximizeMode()) |
return; |
views::View::SetVisible(visible); |
@@ -499,8 +498,10 @@ gfx::Rect FrameMaximizeButton::ScreenBoundsForType( |
return rect; |
} |
case SNAP_RESTORE: { |
- const gfx::Rect* restore = GetRestoreBoundsInScreen(window); |
- return restore ? *restore : frame_->GetWindowBoundsInScreen(); |
+ wm::WindowState* window_state = wm::GetWindowState(window); |
+ return window_state->HasRestoreBounds() ? |
+ window_state->GetRestoreBoundsInScreen() : |
+ frame_->GetWindowBoundsInScreen(); |
} |
case SNAP_NONE: |
NOTREACHED(); |
@@ -516,66 +517,65 @@ gfx::Point FrameMaximizeButton::LocationForSnapSizer( |
} |
void FrameMaximizeButton::Snap(const SnapSizer& snap_sizer) { |
- ash::Shell* shell = ash::Shell::GetInstance(); |
+ Shell* shell = Shell::GetInstance(); |
+ |
switch (snap_type_) { |
case SNAP_LEFT: |
case SNAP_RIGHT: { |
shell->delegate()->RecordUserMetricsAction( |
snap_type_ == SNAP_LEFT ? |
- ash::UMA_WINDOW_MAXIMIZE_BUTTON_MAXIMIZE_LEFT : |
- ash::UMA_WINDOW_MAXIMIZE_BUTTON_MAXIMIZE_RIGHT); |
+ UMA_WINDOW_MAXIMIZE_BUTTON_MAXIMIZE_LEFT : |
+ UMA_WINDOW_MAXIMIZE_BUTTON_MAXIMIZE_RIGHT); |
+ wm::WindowState* window_state = wm::GetWindowState( |
+ frame_->GetNativeWindow()); |
// Get the bounds in screen coordinates for restore purposes. |
gfx::Rect restore = frame_->GetWindowBoundsInScreen(); |
if (frame_->IsMaximized() || frame_->IsFullscreen()) { |
- aura::Window* window = frame_->GetNativeWindow(); |
// In case of maximized we have a restore boundary. |
- DCHECK(ash::GetRestoreBoundsInScreen(window)); |
+ DCHECK(window_state->HasRestoreBounds()); |
// If it was maximized we need to recover the old restore set. |
- restore = *ash::GetRestoreBoundsInScreen(window); |
+ restore = window_state->GetRestoreBoundsInScreen(); |
// The auto position manager will kick in when this is the only window. |
// To avoid interference with it we tell it temporarily to not change |
// the coordinates of this window. |
- wm::WindowSettings* settings = wm::GetWindowSettings(window); |
- bool was_managed = settings->window_position_managed(); |
- settings->set_window_position_managed(false); |
+ bool was_managed = window_state->window_position_managed(); |
+ window_state->set_window_position_managed(false); |
// Set the restore size we want to restore to. |
- ash::SetRestoreBoundsInScreen(window, |
- ScreenBoundsForType(snap_type_, |
- snap_sizer)); |
+ window_state->SetRestoreBoundsInScreen( |
+ ScreenBoundsForType(snap_type_, snap_sizer)); |
frame_->Restore(); |
// After the window is where we want it to be we allow the window to be |
// auto managed again. |
- settings->set_window_position_managed(was_managed); |
+ window_state->set_window_position_managed(was_managed); |
} else { |
// Others might also have set up a restore rectangle already. If so, |
// we should not overwrite the restore rectangle. |
- bool restore_set = |
- GetRestoreBoundsInScreen(frame_->GetNativeWindow()) != NULL; |
+ bool restore_set = window_state->HasRestoreBounds(); |
frame_->SetBounds(ScreenBoundsForType(snap_type_, snap_sizer)); |
if (restore_set) |
break; |
} |
// Remember the widow's bounds for restoration. |
- ash::SetRestoreBoundsInScreen(frame_->GetNativeWindow(), restore); |
+ window_state->SetRestoreBoundsInScreen(restore); |
break; |
} |
case SNAP_MAXIMIZE: |
frame_->Maximize(); |
shell->delegate()->RecordUserMetricsAction( |
- ash::UMA_WINDOW_MAXIMIZE_BUTTON_MAXIMIZE); |
+ UMA_WINDOW_MAXIMIZE_BUTTON_MAXIMIZE); |
break; |
case SNAP_MINIMIZE: |
frame_->Minimize(); |
shell->delegate()->RecordUserMetricsAction( |
- ash::UMA_WINDOW_MAXIMIZE_BUTTON_MINIMIZE); |
+ UMA_WINDOW_MAXIMIZE_BUTTON_MINIMIZE); |
break; |
case SNAP_RESTORE: |
frame_->Restore(); |
shell->delegate()->RecordUserMetricsAction( |
- ash::UMA_WINDOW_MAXIMIZE_BUTTON_RESTORE); |
+ UMA_WINDOW_MAXIMIZE_BUTTON_RESTORE); |
break; |
case SNAP_NONE: |
NOTREACHED(); |
@@ -584,8 +584,10 @@ void FrameMaximizeButton::Snap(const SnapSizer& snap_sizer) { |
MaximizeBubbleFrameState |
FrameMaximizeButton::GetMaximizeBubbleFrameState() const { |
+ wm::WindowState* window_state = |
+ wm::GetWindowState(frame_->GetNativeWindow()); |
// When there are no restore bounds, we are in normal mode. |
- if (!ash::GetRestoreBoundsInScreen(frame_->GetNativeWindow())) |
+ if (!window_state->HasRestoreBounds()) |
return FRAME_STATE_NONE; |
// The normal maximized test can be used. |
if (frame_->IsMaximized()) |