summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorskuhne@chromium.org <skuhne@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-04 05:17:00 +0000
committerskuhne@chromium.org <skuhne@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-04 05:17:00 +0000
commitde42bccc36817496c10f99df4d204db460602afc (patch)
tree77d8ff1eb0e20ddc149b328d8514df699f84318d
parent46e3194153db054636b25cde51efeb0c34aa074e (diff)
downloadchromium_src-de42bccc36817496c10f99df4d204db460602afc.zip
chromium_src-de42bccc36817496c10f99df4d204db460602afc.tar.gz
chromium_src-de42bccc36817496c10f99df4d204db460602afc.tar.bz2
Adding Overview mode started / ended observable events to the shell
Splitting my CL for the backdrop creation into smaller fragments. This portion is adding an observable event to the shell which allows to monitor overview mode de-/activations. BUG=337567 TEST=none Review URL: https://codereview.chromium.org/185423002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@254664 0039d316-1c4b-4281-b951-d872f2087c98
-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) {