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

Unified Diff: ash/common/wm_window_user_data.h

Issue 2699033002: Replace WmWindowObserver with aura::WindowObserver. (Closed)
Patch Set: Check for null images in ShelfWindowWatcher. Created 3 years, 10 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/common/wm_window_unittest.cc ('k') | ash/display/screen_orientation_controller_chromeos.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/common/wm_window_user_data.h
diff --git a/ash/common/wm_window_user_data.h b/ash/common/wm_window_user_data.h
index bafd19faf347af44e9751b57b82d2f5f3c3ee398..2a6abd23378aa5a11cc97d7affc4b137bbe6b442 100644
--- a/ash/common/wm_window_user_data.h
+++ b/ash/common/wm_window_user_data.h
@@ -10,17 +10,18 @@
#include <utility>
#include "ash/common/wm_window.h"
-#include "ash/common/wm_window_observer.h"
#include "base/macros.h"
+#include "ui/aura/window.h"
+#include "ui/aura/window_observer.h"
namespace ash {
// WmWindowUserData provides a way to associate arbitrary objects with a
// WmWindow. WmWindowUserData owns the data, deleting it either when
// WmWindowUserData is deleted, or when the window the data is associated with
-// is destroyed (from WmWindowObserver::OnWindowDestroying()).
+// is destroyed (from aura::WindowObserver::OnWindowDestroying()).
template <typename UserData>
-class WmWindowUserData : public WmWindowObserver {
+class WmWindowUserData : public aura::WindowObserver {
public:
WmWindowUserData() {}
@@ -28,7 +29,7 @@ class WmWindowUserData : public WmWindowObserver {
void clear() {
for (auto& pair : window_to_data_)
- pair.first->RemoveObserver(this);
+ pair.first->aura_window()->RemoveObserver(this);
window_to_data_.clear();
}
@@ -37,11 +38,11 @@ class WmWindowUserData : public WmWindowObserver {
void Set(WmWindow* window, std::unique_ptr<UserData> data) {
if (!data) {
if (window_to_data_.erase(window))
- window->RemoveObserver(this);
+ window->aura_window()->RemoveObserver(this);
return;
}
if (window_to_data_.count(window) == 0u)
- window->AddObserver(this);
+ window->aura_window()->AddObserver(this);
window_to_data_[window] = std::move(data);
}
@@ -61,10 +62,10 @@ class WmWindowUserData : public WmWindowObserver {
}
private:
- // WmWindowObserver:
- void OnWindowDestroying(WmWindow* window) override {
+ // aura::WindowObserver:
+ void OnWindowDestroying(aura::Window* window) override {
window->RemoveObserver(this);
- window_to_data_.erase(window);
+ window_to_data_.erase(WmWindow::Get(window));
}
std::map<WmWindow*, std::unique_ptr<UserData>> window_to_data_;
« no previous file with comments | « ash/common/wm_window_unittest.cc ('k') | ash/display/screen_orientation_controller_chromeos.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698