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

Unified Diff: ash/shelf/shelf_window_watcher.h

Issue 2211463002: mash: Move ShelfWindowWatcher[ItemDelegate] to ash/common. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move ShelfWindowWatcher to WmShell. Created 4 years, 4 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: ash/shelf/shelf_window_watcher.h
diff --git a/ash/shelf/shelf_window_watcher.h b/ash/shelf/shelf_window_watcher.h
deleted file mode 100644
index cacad015baaf236a62a5ec715c255aba3323c833..0000000000000000000000000000000000000000
--- a/ash/shelf/shelf_window_watcher.h
+++ /dev/null
@@ -1,114 +0,0 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef ASH_SHELF_SHELF_WINDOW_WATCHER_H_
-#define ASH_SHELF_SHELF_WINDOW_WATCHER_H_
-
-#include "ash/common/wm_activation_observer.h"
-#include "ash/common/wm_window_observer.h"
-#include "base/macros.h"
-#include "base/scoped_observer.h"
-#include "ui/display/display_observer.h"
-
-namespace ash {
-
-class ShelfModel;
-class WmWindow;
-
-// ShelfWindowWatcher creates and handles a ShelfItem for windows in the default
-// container that have a ShelfItemDetails property (e.g. the task manager
-// dialog or the OS settings window). It adds the ShelfItem when the window is
-// added to the default container and maintains it until the window is closed,
-// even if the window is transiently reparented (e.g. during a drag).
-class ShelfWindowWatcher : public WmActivationObserver,
- public display::DisplayObserver {
- public:
- explicit ShelfWindowWatcher(ShelfModel* model);
- ~ShelfWindowWatcher() override;
-
- private:
- // Observes for windows being added to a root window's default container.
- class ContainerWindowObserver : public WmWindowObserver {
- public:
- explicit ContainerWindowObserver(ShelfWindowWatcher* window_watcher);
- ~ContainerWindowObserver() override;
-
- private:
- // WmWindowObserver:
- void OnWindowTreeChanged(WmWindow* window,
- const TreeChangeParams& params) override;
- void OnWindowDestroying(WmWindow* window) override;
-
- ShelfWindowWatcher* window_watcher_;
-
- DISALLOW_COPY_AND_ASSIGN(ContainerWindowObserver);
- };
-
- // Observes individual user windows to detect when they are closed or when
- // they have ShelfItemDetails changed.
- class UserWindowObserver : public WmWindowObserver {
- public:
- explicit UserWindowObserver(ShelfWindowWatcher* window_watcher);
- ~UserWindowObserver() override;
-
- private:
- // WmWindowObserver:
- void OnWindowPropertyChanged(WmWindow* window,
- WmWindowProperty property) override;
- void OnWindowDestroying(WmWindow* window) override;
-
- ShelfWindowWatcher* window_watcher_;
-
- DISALLOW_COPY_AND_ASSIGN(UserWindowObserver);
- };
-
- // Creates a ShelfItem for |window| that has ShelfItemDetails.
- void AddShelfItem(WmWindow* window);
-
- // Removes a ShelfItem for |window|.
- void RemoveShelfItem(WmWindow* window);
-
- // Updates the status of ShelfItem for |window|.
- void UpdateShelfItemStatus(WmWindow* window, bool is_active);
-
- // Returns the index of ShelfItem associated with |window|.
- int GetShelfItemIndexForWindow(WmWindow* window) const;
-
- // Cleans up observers on |container|.
- void OnContainerWindowDestroying(WmWindow* container);
-
- // Adds a shelf item for new windows added to the default container that have
- // a ShelfItemDetails property.
- void OnUserWindowAdded(WmWindow* window);
-
- // Adds, updates or removes the shelf item based on a property change.
- void OnUserWindowShelfItemDetailsChanged(WmWindow* window);
-
- // Removes the shelf item when a window closes.
- void OnUserWindowDestroying(WmWindow* window);
-
- // WmActivationObserver:
- void OnWindowActivated(WmWindow* gained_active,
- WmWindow* lost_active) override;
-
- // display::DisplayObserver overrides:
- void OnDisplayAdded(const display::Display& display) override;
- void OnDisplayRemoved(const display::Display& old_display) override;
- void OnDisplayMetricsChanged(const display::Display& display,
- uint32_t metrics) override;
-
- ShelfModel* model_;
-
- ContainerWindowObserver container_window_observer_;
- UserWindowObserver user_window_observer_;
-
- ScopedObserver<WmWindow, ContainerWindowObserver> observed_container_windows_;
- ScopedObserver<WmWindow, UserWindowObserver> observed_user_windows_;
-
- DISALLOW_COPY_AND_ASSIGN(ShelfWindowWatcher);
-};
-
-} // namespace ash
-
-#endif // ASH_SHELF_SHELF_WINDOW_WATCHER_H_

Powered by Google App Engine
This is Rietveld 408576698