Index: ash/wm/overview/window_grid.cc |
diff --git a/ash/wm/overview/window_grid.cc b/ash/wm/overview/window_grid.cc |
index 7094f969106685a1aedecf01deecde38a996d927..f415ffb026b6a6ce68c945f066f6523a87f1d87e 100644 |
--- a/ash/wm/overview/window_grid.cc |
+++ b/ash/wm/overview/window_grid.cc |
@@ -42,6 +42,7 @@ |
#include "ui/views/painter.h" |
#include "ui/views/view.h" |
#include "ui/views/widget/widget.h" |
+#include "ui/wm/core/coordinate_conversion.h" |
#include "ui/wm/core/shadow.h" |
#include "ui/wm/core/shadow_types.h" |
#include "ui/wm/core/window_animations.h" |
@@ -49,18 +50,18 @@ |
namespace ash { |
namespace { |
-using Windows = std::vector<WmWindow*>; |
+using Windows = aura::Window::Windows; |
// A comparator for locating a given target window. |
struct WindowSelectorItemComparator { |
- explicit WindowSelectorItemComparator(const WmWindow* target_window) |
+ explicit WindowSelectorItemComparator(const aura::Window* target_window) |
: target(target_window) {} |
bool operator()(std::unique_ptr<WindowSelectorItem>& window) const { |
return window->GetWindow() == target; |
} |
- const WmWindow* target; |
+ const aura::Window* target; |
}; |
// Time it takes for the selector widget to move to the next target. The same |
@@ -222,7 +223,7 @@ gfx::Vector2d GetSlideVectorForFadeIn(WindowSelector::Direction direction, |
// When |border_thickness| is non-zero, a border is created having |
// |border_color|, otherwise |border_color| parameter is ignored. |
// The new background widget starts with |initial_opacity| and then fades in. |
-views::Widget* CreateBackgroundWidget(WmWindow* root_window, |
+views::Widget* CreateBackgroundWidget(aura::Window* root_window, |
ui::LayerType layer_type, |
SkColor background_color, |
int border_thickness, |
@@ -242,16 +243,18 @@ views::Widget* CreateBackgroundWidget(WmWindow* root_window, |
// the shield and selection widgets. Since that container is created with |
// USE_LOCAL_COORDINATES BoundsInScreenBehavior local bounds in |root_window_| |
// need to be provided. |
- root_window->GetRootWindowController()->ConfigureWidgetInitParamsForContainer( |
- widget, kShellWindowId_WallpaperContainer, ¶ms); |
+ RootWindowController::ForWindow(root_window) |
+ ->ConfigureWidgetInitParamsForContainer( |
+ widget, kShellWindowId_WallpaperContainer, ¶ms); |
widget->Init(params); |
- WmWindow* widget_window = WmWindow::Get(widget->GetNativeWindow()); |
+ aura::Window* widget_window = widget->GetNativeWindow(); |
// Disable the "bounce in" animation when showing the window. |
- widget_window->SetVisibilityAnimationTransition(::wm::ANIMATE_NONE); |
+ ::wm::SetWindowVisibilityAnimationTransition(widget_window, |
+ ::wm::ANIMATE_NONE); |
// The background widget should not activate the shelf when passing under it. |
- widget_window->GetWindowState()->set_ignored_by_shelf(true); |
+ wm::GetWindowState(widget_window)->set_ignored_by_shelf(true); |
if (params.layer_type == ui::LAYER_SOLID_COLOR) { |
- widget_window->GetLayer()->SetColor(background_color); |
+ widget_window->layer()->SetColor(background_color); |
} else { |
views::View* content_view = |
new RoundedRectView(border_radius, SK_ColorTRANSPARENT); |
@@ -259,9 +262,9 @@ views::Widget* CreateBackgroundWidget(WmWindow* root_window, |
background_color, border_color, border_thickness, border_radius)); |
widget->SetContentsView(content_view); |
} |
- widget_window->GetParent()->StackChildAtTop(widget_window); |
+ widget_window->parent()->StackChildAtTop(widget_window); |
widget->Show(); |
- widget_window->SetOpacity(initial_opacity); |
+ widget_window->layer()->SetOpacity(initial_opacity); |
return widget; |
} |
@@ -271,8 +274,8 @@ bool IsMinimizedStateType(wm::WindowStateType type) { |
} // namespace |
-WindowGrid::WindowGrid(WmWindow* root_window, |
- const std::vector<WmWindow*>& windows, |
+WindowGrid::WindowGrid(aura::Window* root_window, |
+ const std::vector<aura::Window*>& windows, |
WindowSelector* window_selector) |
: root_window_(root_window), |
window_selector_(window_selector), |
@@ -281,15 +284,15 @@ WindowGrid::WindowGrid(WmWindow* root_window, |
selected_index_(0), |
num_columns_(0), |
prepared_for_overview_(false) { |
- std::vector<WmWindow*> windows_in_root; |
+ aura::Window::Windows windows_in_root; |
for (auto* window : windows) { |
if (window->GetRootWindow() == root_window) |
windows_in_root.push_back(window); |
} |
for (auto* window : windows_in_root) { |
- window_observer_.Add(window->aura_window()); |
- window_state_observer_.Add(window->GetWindowState()); |
+ window_observer_.Add(window); |
+ window_state_observer_.Add(wm::GetWindowState(window)); |
window_list_.push_back( |
base::MakeUnique<WindowSelectorItem>(window, window_selector_)); |
} |
@@ -304,9 +307,9 @@ void WindowGrid::Shutdown() { |
if (shield_widget_) { |
// Fade out the shield widget. This animation continues past the lifetime |
// of |this|. |
- WmWindow* widget_window = WmWindow::Get(shield_widget_->GetNativeWindow()); |
+ aura::Window* widget_window = shield_widget_->GetNativeWindow(); |
ui::ScopedLayerAnimationSettings animation_settings( |
- widget_window->GetLayer()->GetAnimator()); |
+ widget_window->layer()->GetAnimator()); |
animation_settings.SetTransitionDuration(base::TimeDelta::FromMilliseconds( |
kOverviewSelectorTransitionMilliseconds)); |
animation_settings.SetTweenType(gfx::Tween::EASE_OUT); |
@@ -339,13 +342,12 @@ void WindowGrid::PositionWindows(bool animate) { |
return; |
DCHECK(shield_widget_.get()); |
// Keep the background shield widget covering the whole screen. |
- WmWindow* widget_window = WmWindow::Get(shield_widget_->GetNativeWindow()); |
- const gfx::Rect bounds = widget_window->GetParent()->GetBounds(); |
+ aura::Window* widget_window = shield_widget_->GetNativeWindow(); |
+ const gfx::Rect bounds = widget_window->parent()->bounds(); |
widget_window->SetBounds(bounds); |
- gfx::Rect total_bounds = root_window_->ConvertRectToScreen( |
- ScreenUtil::GetDisplayWorkAreaBoundsInParent( |
- root_window_->GetChildByShellWindowId(kShellWindowId_DefaultContainer) |
- ->aura_window())); |
+ gfx::Rect total_bounds = ScreenUtil::GetDisplayWorkAreaBoundsInParent( |
+ root_window_->GetChildById(kShellWindowId_DefaultContainer)); |
+ ::wm::ConvertRectToScreen(root_window_, &total_bounds); |
// Windows occupy vertically centered area with additional vertical insets. |
int horizontal_inset = |
gfx::ToFlooredInt(std::min(kOverviewInsetRatio * total_bounds.width(), |
@@ -527,7 +529,7 @@ WindowSelectorItem* WindowGrid::SelectedWindow() const { |
return window_list_[selected_index_].get(); |
} |
-bool WindowGrid::Contains(const WmWindow* window) const { |
+bool WindowGrid::Contains(const aura::Window* window) const { |
for (const auto& window_item : window_list_) { |
if (window_item->Contains(window)) |
return true; |
@@ -538,8 +540,7 @@ bool WindowGrid::Contains(const WmWindow* window) const { |
void WindowGrid::FilterItems(const base::string16& pattern) { |
base::i18n::FixedPatternStringSearchIgnoringCaseAndAccents finder(pattern); |
for (const auto& window : window_list_) { |
- if (finder.Search(window->GetWindow()->aura_window()->GetTitle(), nullptr, |
- nullptr)) { |
+ if (finder.Search(window->GetWindow()->GetTitle(), nullptr, nullptr)) { |
window->SetDimmed(false); |
} else { |
window->SetDimmed(true); |
@@ -555,8 +556,7 @@ void WindowGrid::FilterItems(const base::string16& pattern) { |
void WindowGrid::WindowClosing(WindowSelectorItem* window) { |
if (!selection_widget_ || SelectedWindow() != window) |
return; |
- WmWindow* selection_widget_window = |
- WmWindow::Get(selection_widget_->GetNativeWindow()); |
+ aura::Window* selection_widget_window = selection_widget_->GetNativeWindow(); |
std::unique_ptr<ScopedOverviewAnimationSettings> animation_settings_label = |
ScopedOverviewAnimationSettingsFactory::Get() |
->CreateOverviewAnimationSettings( |
@@ -569,7 +569,7 @@ void WindowGrid::OnWindowDestroying(aura::Window* window) { |
window_observer_.Remove(window); |
window_state_observer_.Remove(wm::GetWindowState(window)); |
auto iter = std::find_if(window_list_.begin(), window_list_.end(), |
- WindowSelectorItemComparator(WmWindow::Get(window))); |
+ WindowSelectorItemComparator(window)); |
DCHECK(iter != window_list_.end()); |
@@ -605,7 +605,7 @@ void WindowGrid::OnWindowBoundsChanged(aura::Window* window, |
return; |
auto iter = std::find_if(window_list_.begin(), window_list_.end(), |
- WindowSelectorItemComparator(WmWindow::Get(window))); |
+ WindowSelectorItemComparator(window)); |
DCHECK(iter != window_list_.end()); |
// Immediately finish any active bounds animation. |
@@ -625,11 +625,11 @@ void WindowGrid::OnPostWindowStateTypeChange(wm::WindowState* window_state, |
if (IsMinimizedStateType(old_type) == IsMinimizedStateType(new_type)) |
return; |
- auto iter = std::find_if( |
- window_list_.begin(), window_list_.end(), |
- [window_state](std::unique_ptr<WindowSelectorItem>& item) { |
- return item->Contains(WmWindow::Get(window_state->window())); |
- }); |
+ auto iter = |
+ std::find_if(window_list_.begin(), window_list_.end(), |
+ [window_state](std::unique_ptr<WindowSelectorItem>& item) { |
+ return item->Contains(window_state->window()); |
+ }); |
if (iter != window_list_.end()) { |
(*iter)->OnMinimizedStateChanged(); |
PositionWindows(false); |
@@ -641,20 +641,20 @@ void WindowGrid::InitShieldWidget() { |
// synonymous with a black shelf background. Update this code if that |
// assumption is no longer valid. |
const float initial_opacity = |
- (WmShelf::ForWindow(root_window_->aura_window())->GetBackgroundType() == |
+ (WmShelf::ForWindow(root_window_)->GetBackgroundType() == |
SHELF_BACKGROUND_MAXIMIZED) |
? 1.f |
: 0.f; |
shield_widget_.reset( |
CreateBackgroundWidget(root_window_, ui::LAYER_SOLID_COLOR, kShieldColor, |
0, 0, SK_ColorTRANSPARENT, initial_opacity)); |
- WmWindow* widget_window = WmWindow::Get(shield_widget_->GetNativeWindow()); |
- const gfx::Rect bounds = widget_window->GetParent()->GetBounds(); |
+ aura::Window* widget_window = shield_widget_->GetNativeWindow(); |
+ const gfx::Rect bounds = widget_window->parent()->bounds(); |
widget_window->SetBounds(bounds); |
- widget_window->aura_window()->SetName("OverviewModeShield"); |
+ widget_window->SetName("OverviewModeShield"); |
ui::ScopedLayerAnimationSettings animation_settings( |
- widget_window->GetLayer()->GetAnimator()); |
+ widget_window->layer()->GetAnimator()); |
animation_settings.SetTransitionDuration(base::TimeDelta::FromMilliseconds( |
kOverviewSelectorTransitionMilliseconds)); |
animation_settings.SetTweenType(gfx::Tween::EASE_OUT); |
@@ -668,13 +668,13 @@ void WindowGrid::InitSelectionWidget(WindowSelector::Direction direction) { |
root_window_, ui::LAYER_TEXTURED, kWindowSelectionColor, |
kWindowSelectionBorderThickness, kWindowSelectionRadius, |
kWindowSelectionBorderColor, 0.f)); |
- WmWindow* widget_window = WmWindow::Get(selection_widget_->GetNativeWindow()); |
- const gfx::Rect target_bounds = |
- root_window_->ConvertRectFromScreen(SelectedWindow()->target_bounds()); |
+ aura::Window* widget_window = selection_widget_->GetNativeWindow(); |
+ gfx::Rect target_bounds = SelectedWindow()->target_bounds(); |
+ ::wm::ConvertRectFromScreen(root_window_, &target_bounds); |
gfx::Vector2d fade_out_direction = |
GetSlideVectorForFadeIn(direction, target_bounds); |
widget_window->SetBounds(target_bounds - fade_out_direction); |
- widget_window->aura_window()->SetName("OverviewModeSelector"); |
+ widget_window->SetName("OverviewModeSelector"); |
selector_shadow_.reset(new ::wm::Shadow()); |
selector_shadow_->Init(::wm::ShadowElevation::LARGE); |
@@ -693,13 +693,12 @@ void WindowGrid::MoveSelectionWidget(WindowSelector::Direction direction, |
if (selection_widget_ && (recreate_selection_widget || out_of_bounds)) { |
// Animate the old selection widget and then destroy it. |
views::Widget* old_selection = selection_widget_.get(); |
- WmWindow* old_selection_window = |
- WmWindow::Get(old_selection->GetNativeWindow()); |
+ aura::Window* old_selection_window = old_selection->GetNativeWindow(); |
gfx::Vector2d fade_out_direction = |
- GetSlideVectorForFadeIn(direction, old_selection_window->GetBounds()); |
+ GetSlideVectorForFadeIn(direction, old_selection_window->bounds()); |
ui::ScopedLayerAnimationSettings animation_settings( |
- old_selection_window->GetLayer()->GetAnimator()); |
+ old_selection_window->layer()->GetAnimator()); |
animation_settings.SetTransitionDuration(base::TimeDelta::FromMilliseconds( |
kOverviewSelectorTransitionMilliseconds)); |
animation_settings.SetPreemptionStrategy( |
@@ -716,7 +715,7 @@ void WindowGrid::MoveSelectionWidget(WindowSelector::Direction direction, |
window_selector_->delegate()->AddDelayedAnimationObserver( |
std::move(observer)); |
old_selection->SetOpacity(0.f); |
- old_selection_window->SetBounds(old_selection_window->GetBounds() + |
+ old_selection_window->SetBounds(old_selection_window->bounds() + |
fade_out_direction); |
old_selection->Hide(); |
} |
@@ -734,13 +733,13 @@ void WindowGrid::MoveSelectionWidget(WindowSelector::Direction direction, |
} |
void WindowGrid::MoveSelectionWidgetToTarget(bool animate) { |
- gfx::Rect bounds = |
- root_window_->ConvertRectFromScreen(SelectedWindow()->target_bounds()); |
+ gfx::Rect bounds = SelectedWindow()->target_bounds(); |
+ ::wm::ConvertRectFromScreen(root_window_, &bounds); |
if (animate) { |
- WmWindow* selection_widget_window = |
- WmWindow::Get(selection_widget_->GetNativeWindow()); |
+ aura::Window* selection_widget_window = |
+ selection_widget_->GetNativeWindow(); |
ui::ScopedLayerAnimationSettings animation_settings( |
- selection_widget_window->GetLayer()->GetAnimator()); |
+ selection_widget_window->layer()->GetAnimator()); |
animation_settings.SetTransitionDuration(base::TimeDelta::FromMilliseconds( |
kOverviewSelectorTransitionMilliseconds)); |
animation_settings.SetTweenType(gfx::Tween::EASE_IN_OUT); |