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

Unified Diff: ui/wm/core/default_activation_client.cc

Issue 1151133003: Added an ActivationReason parameter to ActivationChangeObserver::OnWindowActivated(...). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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
Index: ui/wm/core/default_activation_client.cc
diff --git a/ui/wm/core/default_activation_client.cc b/ui/wm/core/default_activation_client.cc
index 20c0d79b7dc7fd121c7d21c236ce38e34581bc1b..e48418450652e5563c460ac1654d94c3466e410c 100644
--- a/ui/wm/core/default_activation_client.cc
+++ b/ui/wm/core/default_activation_client.cc
@@ -59,6 +59,14 @@ void DefaultActivationClient::RemoveObserver(
}
void DefaultActivationClient::ActivateWindow(aura::Window* window) {
+ ActivateWindowImpl(aura::client::ActivationChangeObserver::ActivationReason::
+ ACTIVATION_CLIENT,
+ window);
+}
+
+void DefaultActivationClient::ActivateWindowImpl(
+ aura::client::ActivationChangeObserver::ActivationReason reason,
+ aura::Window* window) {
aura::Window* last_active = GetActiveWindow();
if (last_active == window)
return;
@@ -69,24 +77,28 @@ void DefaultActivationClient::ActivateWindow(aura::Window* window) {
window->parent()->StackChildAtTop(window);
window->AddObserver(this);
- FOR_EACH_OBSERVER(aura::client::ActivationChangeObserver,
- observers_,
- OnWindowActivated(window, last_active));
+ FOR_EACH_OBSERVER(aura::client::ActivationChangeObserver, observers_,
+ OnWindowActivated(reason, window, last_active));
aura::client::ActivationChangeObserver* observer =
aura::client::GetActivationChangeObserver(last_active);
- if (observer)
- observer->OnWindowActivated(window, last_active);
+ if (observer) {
+ observer->OnWindowActivated(reason, window, last_active);
+ }
observer = aura::client::GetActivationChangeObserver(window);
- if (observer)
- observer->OnWindowActivated(window, last_active);
+ if (observer) {
+ observer->OnWindowActivated(reason, window, last_active);
+ }
}
void DefaultActivationClient::DeactivateWindow(aura::Window* window) {
aura::client::ActivationChangeObserver* observer =
aura::client::GetActivationChangeObserver(window);
- if (observer)
- observer->OnWindowActivated(NULL, window);
+ if (observer) {
+ observer->OnWindowActivated(aura::client::ActivationChangeObserver::
+ ActivationReason::ACTIVATION_CLIENT,
+ NULL, window);
sky 2015/06/04 20:02:03 nullptr
bruthig 2015/06/04 21:07:41 Done.
+ }
if (last_active_)
ActivateWindow(last_active_);
}
@@ -121,8 +133,10 @@ void DefaultActivationClient::OnWindowDestroyed(aura::Window* window) {
active_windows_.pop_back();
aura::Window* next_active = GetActiveWindow();
if (next_active && aura::client::GetActivationChangeObserver(next_active)) {
- aura::client::GetActivationChangeObserver(next_active)->OnWindowActivated(
- next_active, NULL);
+ aura::client::GetActivationChangeObserver(next_active)
+ ->OnWindowActivated(aura::client::ActivationChangeObserver::
+ ActivationReason::WINDOW_DISPOSITION_CHANGED,
+ next_active, NULL);
sky 2015/06/04 20:02:03 nullptr
bruthig 2015/06/04 21:07:41 Done.
}
return;
}

Powered by Google App Engine
This is Rietveld 408576698