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

Unified Diff: ash/wm/maximize_mode/maximize_mode_window_state.cc

Issue 1890713002: Adds WmWindow and converts WindowState to use it (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge again Created 4 years, 8 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: ash/wm/maximize_mode/maximize_mode_window_state.cc
diff --git a/ash/wm/maximize_mode/maximize_mode_window_state.cc b/ash/wm/maximize_mode/maximize_mode_window_state.cc
index 043ed788631d5222165c0c5b1f450a95b552d220..997ec638db595713a1d14aa69f4a911486fbbc03 100644
--- a/ash/wm/maximize_mode/maximize_mode_window_state.cc
+++ b/ash/wm/maximize_mode/maximize_mode_window_state.cc
@@ -14,6 +14,7 @@
#include "ash/wm/maximize_mode/maximize_mode_window_manager.h"
#include "ash/wm/window_animations.h"
#include "ash/wm/window_properties.h"
+#include "ash/wm/window_state_aura.h"
#include "ash/wm/window_state_delegate.h"
#include "ash/wm/window_state_util.h"
#include "ash/wm/window_util.h"
@@ -35,10 +36,11 @@ namespace {
gfx::Size GetMaximumSizeOfWindow(wm::WindowState* window_state) {
DCHECK(window_state->CanMaximize() || window_state->CanResize());
- gfx::Size workspace_size = ScreenUtil::GetMaximizedWindowBoundsInParent(
- window_state->window()).size();
+ gfx::Size workspace_size =
+ ScreenUtil::GetMaximizedWindowBoundsInParent(window_state->aura_window())
+ .size();
- aura::WindowDelegate* delegate = window_state->window()->delegate();
+ aura::WindowDelegate* delegate = window_state->aura_window()->delegate();
if (!delegate)
return workspace_size;
@@ -54,7 +56,7 @@ gfx::Size GetMaximumSizeOfWindow(wm::WindowState* window_state) {
gfx::Rect GetCenteredBounds(const gfx::Rect& bounds_in_parent,
wm::WindowState* state_object) {
gfx::Rect work_area_in_parent =
- ScreenUtil::GetDisplayWorkAreaBoundsInParent(state_object->window());
+ ScreenUtil::GetDisplayWorkAreaBoundsInParent(state_object->aura_window());
work_area_in_parent.ClampToCenteredSize(bounds_in_parent.size());
return work_area_in_parent;
}
@@ -62,7 +64,7 @@ gfx::Rect GetCenteredBounds(const gfx::Rect& bounds_in_parent,
// Returns the maximized/full screen and/or centered bounds of a window.
gfx::Rect GetBoundsInMaximizedMode(wm::WindowState* state_object) {
if (state_object->IsFullscreen())
- return ScreenUtil::GetDisplayBoundsInParent(state_object->window());
+ return ScreenUtil::GetDisplayBoundsInParent(state_object->aura_window());
gfx::Rect bounds_in_parent;
// Make the window as big as possible.
@@ -75,7 +77,7 @@ gfx::Rect GetBoundsInMaximizedMode(wm::WindowState* state_object) {
if (state_object->HasRestoreBounds())
bounds_in_parent = state_object->GetRestoreBoundsInParent();
else
- bounds_in_parent = state_object->window()->bounds();
+ bounds_in_parent = state_object->aura_window()->bounds();
}
return GetCenteredBounds(bounds_in_parent, state_object);
}
@@ -86,7 +88,7 @@ gfx::Rect GetBoundsInMaximizedMode(wm::WindowState* state_object) {
void MaximizeModeWindowState::UpdateWindowPosition(
wm::WindowState* window_state) {
gfx::Rect bounds_in_parent = GetBoundsInMaximizedMode(window_state);
- if (bounds_in_parent == window_state->window()->bounds())
+ if (bounds_in_parent == window_state->aura_window()->bounds())
return;
window_state->SetBoundsDirect(bounds_in_parent);
}
@@ -168,7 +170,7 @@ void MaximizeModeWindowState::OnWMEvent(wm::WindowState* window_state,
gfx::Rect bounds_in_parent =
(static_cast<const wm::SetBoundsEvent*>(event))->requested_bounds();
bounds_in_parent = GetCenteredBounds(bounds_in_parent, window_state);
- if (bounds_in_parent != window_state->window()->bounds()) {
+ if (bounds_in_parent != window_state->aura_window()->bounds()) {
if (window_state->window()->IsVisible())
window_state->SetBoundsDirectAnimated(bounds_in_parent);
else
@@ -207,15 +209,16 @@ void MaximizeModeWindowState::AttachState(
current_state_type_ = previous_state->GetType();
views::Widget* widget =
- views::Widget::GetWidgetForNativeWindow(window_state->window());
+ views::Widget::GetWidgetForNativeWindow(window_state->aura_window());
if (widget) {
gfx::Rect bounds = widget->GetRestoredBounds();
if (!bounds.IsEmpty()) {
// We do not want to do a session restore to our window states. Therefore
// we tell the window to use the current default states instead.
- window_state->window()->SetProperty(ash::kRestoreShowStateOverrideKey,
- window_state->GetShowState());
- window_state->window()->SetProperty(ash::kRestoreBoundsOverrideKey,
+ window_state->aura_window()->SetProperty(
+ ash::kRestoreShowStateOverrideKey, window_state->GetShowState());
+ window_state->aura_window()->SetProperty(
+ ash::kRestoreBoundsOverrideKey,
new gfx::Rect(widget->GetRestoredBounds()));
}
}
@@ -234,7 +237,7 @@ void MaximizeModeWindowState::AttachState(
void MaximizeModeWindowState::DetachState(wm::WindowState* window_state) {
// From now on, we can use the default session restore mechanism again.
- window_state->window()->ClearProperty(ash::kRestoreBoundsOverrideKey);
+ window_state->aura_window()->ClearProperty(ash::kRestoreBoundsOverrideKey);
window_state->set_can_be_dragged(true);
}
@@ -253,7 +256,7 @@ void MaximizeModeWindowState::UpdateWindow(wm::WindowState* window_state,
current_state_type_ = target_state;
::wm::SetWindowVisibilityAnimationType(
- window_state->window(), WINDOW_VISIBILITY_ANIMATION_TYPE_MINIMIZE);
+ window_state->aura_window(), WINDOW_VISIBILITY_ANIMATION_TYPE_MINIMIZE);
window_state->window()->Hide();
if (window_state->IsActive())
window_state->Deactivate();
@@ -273,9 +276,9 @@ void MaximizeModeWindowState::UpdateWindow(wm::WindowState* window_state,
UpdateBounds(window_state, animated);
window_state->NotifyPostStateTypeChange(old_state_type);
- if ((window_state->window()->TargetVisibility() ||
- old_state_type == wm::WINDOW_STATE_TYPE_MINIMIZED) &&
- !window_state->window()->layer()->visible()) {
+ if ((window_state->aura_window()->TargetVisibility() ||
+ old_state_type == wm::WINDOW_STATE_TYPE_MINIMIZED) &&
+ !window_state->aura_window()->layer()->visible()) {
// The layer may be hidden if the window was previously minimized. Make
// sure it's visible.
window_state->window()->Show();
@@ -296,7 +299,7 @@ void MaximizeModeWindowState::UpdateBounds(wm::WindowState* window_state,
// If we have a target bounds rectangle, we center it and set it
// accordingly.
if (!bounds_in_parent.IsEmpty() &&
- bounds_in_parent != window_state->window()->bounds()) {
+ bounds_in_parent != window_state->aura_window()->bounds()) {
if (current_state_type_ == wm::WINDOW_STATE_TYPE_MINIMIZED ||
!window_state->window()->IsVisible() ||
!animated) {
« no previous file with comments | « ash/wm/maximize_mode/maximize_mode_window_manager_unittest.cc ('k') | ash/wm/mru_window_tracker_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698