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

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

Issue 1921883002: Removes WindowState::aura_window() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix windows build 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
« no previous file with comments | « ash/wm/lock_window_state.cc ('k') | ash/wm/panels/panel_layout_manager_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 5eb05d50cd85d9832a4ee9889c7b9efa7b315974..c56f11e492ba8fbd7269b6b8698fbc1604c61cf3 100644
--- a/ash/wm/maximize_mode/maximize_mode_window_state.cc
+++ b/ash/wm/maximize_mode/maximize_mode_window_state.cc
@@ -9,9 +9,11 @@
#include "ash/screen_util.h"
#include "ash/shell.h"
#include "ash/shell_window_ids.h"
+#include "ash/wm/aura/wm_window_aura.h"
#include "ash/wm/common/window_animation_types.h"
#include "ash/wm/common/window_state_util.h"
#include "ash/wm/common/wm_event.h"
+#include "ash/wm/common/wm_screen_util.h"
#include "ash/wm/maximize_mode/maximize_mode_window_manager.h"
#include "ash/wm/window_animations.h"
#include "ash/wm/window_properties.h"
@@ -37,14 +39,9 @@ gfx::Size GetMaximumSizeOfWindow(wm::WindowState* window_state) {
DCHECK(window_state->CanMaximize() || window_state->CanResize());
gfx::Size workspace_size =
- ScreenUtil::GetMaximizedWindowBoundsInParent(window_state->aura_window())
- .size();
+ wm::GetMaximizedWindowBoundsInParent(window_state->window()).size();
- aura::WindowDelegate* delegate = window_state->aura_window()->delegate();
- if (!delegate)
- return workspace_size;
-
- gfx::Size size = delegate->GetMaximumSize();
+ gfx::Size size = window_state->window()->GetMaximumSize();
if (size.IsEmpty())
return workspace_size;
@@ -56,7 +53,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->aura_window());
+ wm::GetDisplayWorkAreaBoundsInParent(state_object->window());
work_area_in_parent.ClampToCenteredSize(bounds_in_parent.size());
return work_area_in_parent;
}
@@ -64,7 +61,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->aura_window());
+ return wm::GetDisplayBoundsInParent(state_object->window());
gfx::Rect bounds_in_parent;
// Make the window as big as possible.
@@ -77,7 +74,7 @@ gfx::Rect GetBoundsInMaximizedMode(wm::WindowState* state_object) {
if (state_object->HasRestoreBounds())
bounds_in_parent = state_object->GetRestoreBoundsInParent();
else
- bounds_in_parent = state_object->aura_window()->bounds();
+ bounds_in_parent = state_object->window()->GetBounds();
}
return GetCenteredBounds(bounds_in_parent, state_object);
}
@@ -88,7 +85,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->aura_window()->bounds())
+ if (bounds_in_parent == window_state->window()->GetBounds())
return;
window_state->SetBoundsDirect(bounds_in_parent);
}
@@ -170,7 +167,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->aura_window()->bounds()) {
+ if (bounds_in_parent != window_state->window()->GetBounds()) {
if (window_state->window()->IsVisible())
window_state->SetBoundsDirectAnimated(bounds_in_parent);
else
@@ -208,18 +205,18 @@ void MaximizeModeWindowState::AttachState(
wm::WindowState::State* previous_state) {
current_state_type_ = previous_state->GetType();
- views::Widget* widget =
- views::Widget::GetWidgetForNativeWindow(window_state->aura_window());
+ aura::Window* window =
+ ash::wm::WmWindowAura::GetAuraWindow(window_state->window());
+ views::Widget* widget = views::Widget::GetWidgetForNativeWindow(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->aura_window()->SetProperty(
- ash::kRestoreShowStateOverrideKey, window_state->GetShowState());
- window_state->aura_window()->SetProperty(
- ash::kRestoreBoundsOverrideKey,
- new gfx::Rect(widget->GetRestoredBounds()));
+ window->SetProperty(ash::kRestoreShowStateOverrideKey,
+ window_state->GetShowState());
+ window->SetProperty(ash::kRestoreBoundsOverrideKey,
+ new gfx::Rect(widget->GetRestoredBounds()));
}
}
@@ -237,7 +234,8 @@ void MaximizeModeWindowState::AttachState(
void MaximizeModeWindowState::DetachState(wm::WindowState* window_state) {
// From now on, we can use the default session restore mechanism again.
- window_state->aura_window()->ClearProperty(ash::kRestoreBoundsOverrideKey);
+ ash::wm::WmWindowAura::GetAuraWindow(window_state->window())
+ ->ClearProperty(ash::kRestoreBoundsOverrideKey);
window_state->set_can_be_dragged(true);
}
@@ -255,8 +253,7 @@ void MaximizeModeWindowState::UpdateWindow(wm::WindowState* window_state,
return;
current_state_type_ = target_state;
- ::wm::SetWindowVisibilityAnimationType(
- window_state->aura_window(),
+ window_state->window()->SetVisibilityAnimationType(
wm::WINDOW_VISIBILITY_ANIMATION_TYPE_MINIMIZE);
window_state->window()->Hide();
if (window_state->IsActive())
@@ -277,9 +274,9 @@ void MaximizeModeWindowState::UpdateWindow(wm::WindowState* window_state,
UpdateBounds(window_state, animated);
window_state->NotifyPostStateTypeChange(old_state_type);
- if ((window_state->aura_window()->TargetVisibility() ||
+ if ((window_state->window()->GetTargetVisibility() ||
old_state_type == wm::WINDOW_STATE_TYPE_MINIMIZED) &&
- !window_state->aura_window()->layer()->visible()) {
+ !window_state->window()->GetLayer()->visible()) {
// The layer may be hidden if the window was previously minimized. Make
// sure it's visible.
window_state->window()->Show();
@@ -300,7 +297,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->aura_window()->bounds()) {
+ bounds_in_parent != window_state->window()->GetBounds()) {
if (current_state_type_ == wm::WINDOW_STATE_TYPE_MINIMIZED ||
!window_state->window()->IsVisible() ||
!animated) {
« no previous file with comments | « ash/wm/lock_window_state.cc ('k') | ash/wm/panels/panel_layout_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698