summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ash/shell.cc8
-rw-r--r--ash/shell.h8
-rw-r--r--ash/shell_observer.h8
-rw-r--r--ash/wm/overview/window_overview.cc9
4 files changed, 30 insertions, 3 deletions
diff --git a/ash/shell.cc b/ash/shell.cc
index d0cf6ec..f1a037b 100644
--- a/ash/shell.cc
+++ b/ash/shell.cc
@@ -382,6 +382,14 @@ void Shell::OnCastingSessionStartedOrStopped(bool started) {
#endif
}
+void Shell::OnOverviewModeStarting() {
+ FOR_EACH_OBSERVER(ShellObserver, observers_, OnOverviewModeStarting());
+}
+
+void Shell::OnOverviewModeEnding() {
+ FOR_EACH_OBSERVER(ShellObserver, observers_, OnOverviewModeEnding());
+}
+
void Shell::CreateShelf() {
RootWindowControllerList controllers = GetAllRootWindowControllers();
for (RootWindowControllerList::iterator iter = controllers.begin();
diff --git a/ash/shell.h b/ash/shell.h
index 02aaef3..ae79a29 100644
--- a/ash/shell.h
+++ b/ash/shell.h
@@ -291,6 +291,14 @@ class ASH_EXPORT Shell
// Called when a casting session is started or stopped.
void OnCastingSessionStartedOrStopped(bool started);
+ // Called when the overview mode is about to be started (before the windows
+ // get re-arranged).
+ void OnOverviewModeStarting();
+
+ // Called before the overview mode is ending (before the windows get arranged
+ // to their final position).
+ void OnOverviewModeEnding();
+
// Initializes |shelf_|. Does nothing if it's already initialized.
void CreateShelf();
diff --git a/ash/shell_observer.h b/ash/shell_observer.h
index 9d1db02..c2b652c 100644
--- a/ash/shell_observer.h
+++ b/ash/shell_observer.h
@@ -39,6 +39,14 @@ class ASH_EXPORT ShellObserver {
virtual void OnFullscreenStateChanged(bool is_fullscreen,
aura::Window* root_window) {}
+ // Called when the overview mode is about to be started (before the windows
+ // get re-arranged).
+ virtual void OnOverviewModeStarting() {}
+
+ // Called before the overview mode is ending (before the windows get arranged
+ // to their final position).
+ virtual void OnOverviewModeEnding() {}
+
protected:
virtual ~ShellObserver() {}
};
diff --git a/ash/wm/overview/window_overview.cc b/ash/wm/overview/window_overview.cc
index 6bc5e56..f2a4b86 100644
--- a/ash/wm/overview/window_overview.cc
+++ b/ash/wm/overview/window_overview.cc
@@ -125,6 +125,8 @@ WindowOverview::WindowOverview(WindowSelector* window_selector,
single_root_window_(single_root_window),
overview_start_time_(base::Time::Now()),
cursor_client_(NULL) {
+ Shell* shell = Shell::GetInstance();
+ shell->OnOverviewModeStarting();
for (WindowSelectorItemList::iterator iter = windows_->begin();
iter != windows_->end(); ++iter) {
(*iter)->PrepareForOverview();
@@ -142,8 +144,7 @@ WindowOverview::WindowOverview(WindowSelector* window_selector,
// as suggested there.
cursor_client_->LockCursor();
}
- ash::Shell::GetInstance()->PrependPreTargetHandler(this);
- Shell* shell = Shell::GetInstance();
+ shell->PrependPreTargetHandler(this);
shell->metrics()->RecordUserMetricsAction(UMA_WINDOW_OVERVIEW);
HideAndTrackNonOverviewWindows();
}
@@ -163,10 +164,12 @@ WindowOverview::~WindowOverview() {
}
if (cursor_client_)
cursor_client_->UnlockCursor();
- ash::Shell::GetInstance()->RemovePreTargetHandler(this);
+ ash::Shell* shell = ash::Shell::GetInstance();
+ shell->RemovePreTargetHandler(this);
UMA_HISTOGRAM_MEDIUM_TIMES(
"Ash.WindowSelector.TimeInOverview",
base::Time::Now() - overview_start_time_);
+ shell->OnOverviewModeEnding();
}
void WindowOverview::SetSelection(size_t index) {