Index: ash/wm/overview/window_overview.cc |
diff --git a/ash/wm/overview/window_overview.cc b/ash/wm/overview/window_overview.cc |
index da615f755825d499a2b8ac56e3706114ea6c98ee..ec5efc76a6bc8036a206850c48ed95be0ac1607e 100644 |
--- a/ash/wm/overview/window_overview.cc |
+++ b/ash/wm/overview/window_overview.cc |
@@ -22,6 +22,7 @@ |
#include "ui/compositor/layer_animation_observer.h" |
#include "ui/compositor/scoped_layer_animation_settings.h" |
#include "ui/events/event.h" |
+#include "ui/gfx/screen.h" |
#include "ui/views/background.h" |
#include "ui/views/widget/widget.h" |
@@ -132,7 +133,7 @@ WindowOverview::WindowOverview(WindowSelector* window_selector, |
iter != windows_->end(); ++iter) { |
(*iter)->PrepareForOverview(); |
} |
- PositionWindows(); |
+ PositionWindows(/* animate */ true); |
DCHECK(!windows_->empty()); |
cursor_client_ = aura::client::GetCursorClient( |
windows_->front()->GetRootWindow()); |
@@ -146,6 +147,7 @@ WindowOverview::WindowOverview(WindowSelector* window_selector, |
cursor_client_->LockCursor(); |
} |
shell->PrependPreTargetHandler(this); |
+ shell->GetScreen()->AddObserver(this); |
shell->metrics()->RecordUserMetricsAction(UMA_WINDOW_OVERVIEW); |
HideAndTrackNonOverviewWindows(); |
} |
@@ -167,6 +169,7 @@ WindowOverview::~WindowOverview() { |
cursor_client_->UnlockCursor(); |
ash::Shell* shell = ash::Shell::GetInstance(); |
shell->RemovePreTargetHandler(this); |
+ shell->GetScreen()->RemoveObserver(this); |
UMA_HISTOGRAM_MEDIUM_TIMES( |
"Ash.WindowSelector.TimeInOverview", |
base::Time::Now() - overview_start_time_); |
@@ -242,12 +245,12 @@ void WindowOverview::SetSelection(size_t index) { |
} |
void WindowOverview::OnWindowsChanged() { |
- PositionWindows(); |
+ PositionWindows(/* animate */ true); |
} |
void WindowOverview::MoveToSingleRootWindow(aura::Window* root_window) { |
single_root_window_ = root_window; |
- PositionWindows(); |
+ PositionWindows(/* animate */ true); |
} |
void WindowOverview::OnKeyEvent(ui::KeyEvent* event) { |
@@ -298,6 +301,16 @@ void WindowOverview::OnTouchEvent(ui::TouchEvent* event) { |
window_selector_->SelectWindow(target); |
} |
+void WindowOverview::OnDisplayBoundsChanged(const gfx::Display& display) { |
+ PositionWindows(/* animate */ false); |
+} |
+ |
+void WindowOverview::OnDisplayAdded(const gfx::Display& display) { |
+} |
+ |
+void WindowOverview::OnDisplayRemoved(const gfx::Display& display) { |
+} |
+ |
aura::Window* WindowOverview::GetEventTarget(ui::LocatedEvent* event) { |
aura::Window* target = static_cast<aura::Window*>(event->target()); |
// If the target window doesn't actually contain the event location (i.e. |
@@ -358,34 +371,36 @@ void WindowOverview::HideAndTrackNonOverviewWindows() { |
} |
} |
-void WindowOverview::PositionWindows() { |
+void WindowOverview::PositionWindows(bool animate) { |
if (single_root_window_) { |
std::vector<WindowSelectorItem*> windows; |
for (WindowSelectorItemList::iterator iter = windows_->begin(); |
iter != windows_->end(); ++iter) { |
windows.push_back(*iter); |
} |
- PositionWindowsOnRoot(single_root_window_, windows); |
+ PositionWindowsOnRoot(single_root_window_, windows, animate); |
} else { |
aura::Window::Windows root_window_list = Shell::GetAllRootWindows(); |
for (size_t i = 0; i < root_window_list.size(); ++i) |
- PositionWindowsFromRoot(root_window_list[i]); |
+ PositionWindowsFromRoot(root_window_list[i], animate); |
} |
} |
-void WindowOverview::PositionWindowsFromRoot(aura::Window* root_window) { |
+void WindowOverview::PositionWindowsFromRoot(aura::Window* root_window, |
+ bool animate) { |
std::vector<WindowSelectorItem*> windows; |
for (WindowSelectorItemList::iterator iter = windows_->begin(); |
iter != windows_->end(); ++iter) { |
if ((*iter)->GetRootWindow() == root_window) |
windows.push_back(*iter); |
} |
- PositionWindowsOnRoot(root_window, windows); |
+ PositionWindowsOnRoot(root_window, windows, animate); |
} |
void WindowOverview::PositionWindowsOnRoot( |
aura::Window* root_window, |
- const std::vector<WindowSelectorItem*>& windows) { |
+ const std::vector<WindowSelectorItem*>& windows, |
+ bool animate) { |
if (windows.empty()) |
return; |
@@ -422,7 +437,7 @@ void WindowOverview::PositionWindowsOnRoot( |
window_size.width(), |
window_size.height()); |
target_bounds.Inset(kWindowMargin, kWindowMargin); |
- windows[i]->SetBounds(root_window, target_bounds); |
+ windows[i]->SetBounds(root_window, target_bounds, animate); |
} |
} |