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

Unified Diff: ash/shelf/shelf_window_watcher.cc

Issue 2185743002: Remove ash::ScopedObserverWithDuplicatedSources (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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
« no previous file with comments | « ash/shelf/shelf_window_watcher.h ('k') | chrome/browser/ui/ash/launcher/browser_status_monitor.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/shelf/shelf_window_watcher.cc
diff --git a/ash/shelf/shelf_window_watcher.cc b/ash/shelf/shelf_window_watcher.cc
index 6ca0240b2685a16c6b4e0ac0767717cbb30da19a..e9e73e83e4962561fc084bd5c8ee605161b160cf 100644
--- a/ash/shelf/shelf_window_watcher.cc
+++ b/ash/shelf/shelf_window_watcher.cc
@@ -105,10 +105,8 @@ ShelfWindowWatcher::ShelfWindowWatcher(ShelfModel* model)
removed_window_observer_(this),
observed_windows_(this),
observed_root_windows_(&root_window_observer_),
- observed_removed_windows_(&removed_window_observer_),
- observed_activation_clients_(this) {
- // We can't assume all RootWindows have the same ActivationClient.
- // Add a RootWindow and its ActivationClient to the observed list.
+ observed_removed_windows_(&removed_window_observer_) {
+ Shell::GetInstance()->activation_client()->AddObserver(this);
James Cook 2016/07/26 17:48:31 This will get converted to WmShell in my next CL.
for (aura::Window* root : Shell::GetAllRootWindows())
OnRootWindowAdded(WmWindowAura::Get(root));
@@ -117,6 +115,7 @@ ShelfWindowWatcher::ShelfWindowWatcher(ShelfModel* model)
ShelfWindowWatcher::~ShelfWindowWatcher() {
display::Screen::GetScreen()->RemoveObserver(this);
+ Shell::GetInstance()->activation_client()->RemoveObserver(this);
}
void ShelfWindowWatcher::AddShelfItem(aura::Window* window) {
@@ -139,10 +138,6 @@ void ShelfWindowWatcher::RemoveShelfItem(aura::Window* window) {
void ShelfWindowWatcher::OnRootWindowAdded(WmWindow* root_window_wm) {
aura::Window* root_window = WmWindowAura::GetAuraWindow(root_window_wm);
- // |observed_activation_clients_| can have the same ActivationClient multiple
- // times - which would be handled by the |observed_activation_clients_|.
- observed_activation_clients_.Add(
- aura::client::GetActivationClient(root_window));
observed_root_windows_.Add(root_window);
aura::Window* default_container =
@@ -154,8 +149,6 @@ void ShelfWindowWatcher::OnRootWindowAdded(WmWindow* root_window_wm) {
void ShelfWindowWatcher::OnRootWindowRemoved(aura::Window* root_window) {
observed_root_windows_.Remove(root_window);
- observed_activation_clients_.Remove(
- aura::client::GetActivationClient(root_window));
}
void ShelfWindowWatcher::UpdateShelfItemStatus(aura::Window* window,
« no previous file with comments | « ash/shelf/shelf_window_watcher.h ('k') | chrome/browser/ui/ash/launcher/browser_status_monitor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698