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

Unified Diff: ash/common/wm_window.cc

Issue 2320273002: Refactors DimWindow and moves to ash/common (Closed)
Patch Set: git add wm_window Created 4 years, 3 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/common/wm_window.cc
diff --git a/ash/mus/bridge/wm_shelf_mus.cc b/ash/common/wm_window.cc
similarity index 26%
copy from ash/mus/bridge/wm_shelf_mus.cc
copy to ash/common/wm_window.cc
index c8ee95c08ae060a4f10dd66140438d251d8a41e0..fe7f61606a5b3096dcc91e6121a9e27c119d9614 100644
--- a/ash/mus/bridge/wm_shelf_mus.cc
+++ b/ash/common/wm_window.cc
@@ -2,35 +2,36 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "ash/mus/bridge/wm_shelf_mus.h"
-
-#include "ash/common/shelf/shelf_widget.h"
-#include "ash/common/wm_root_window_controller.h"
-#include "ash/common/wm_shell.h"
#include "ash/common/wm_window.h"
+#include "base/memory/ptr_util.h"
+#include "base/supports_user_data.h"
+
namespace ash {
-namespace mus {
-
-WmShelfMus::WmShelfMus(WmWindow* root_window) {
- DCHECK(root_window);
- WmShell::Get()->CreateShelfDelegate();
- CreateShelfWidget(root_window);
- InitializeShelf();
- WmShell::Get()->NotifyShelfCreatedForRootWindow(root_window);
- shelf_widget()->PostCreateShelf();
+
+class WmWindow::SupportsUserDataImpl : public base::SupportsUserData {
James Cook 2016/09/09 00:03:35 Is the whole point of this to get around the prote
sky 2016/09/09 03:50:04 I think it's better to keep SUDs destructor protec
+ public:
+ SupportsUserDataImpl() {}
+ ~SupportsUserDataImpl() override {}
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(SupportsUserDataImpl);
+};
+
+base::SupportsUserData* WmWindow::GetUserData() {
+ return user_data_.get();
}
-WmShelfMus::~WmShelfMus() {
- ShutdownShelfWidget();
- DestroyShelfWidget();
- ShutdownShelf();
+WmWindow::WmWindow() : user_data_(base::MakeUnique<SupportsUserDataImpl>()) {}
+
+WmWindow::~WmWindow() {
+ // Subclasses should explicitly destroy |user_data_| in destructor to ensure
+ // pure virtual methods are still valid while destroying |user_data_|.
James Cook 2016/09/09 00:03:35 Thanks for documenting this.
+ DCHECK(!user_data_);
}
-void WmShelfMus::WillDeleteShelfLayoutManager() {
- ShutdownShelfWidget();
- WmShelf::WillDeleteShelfLayoutManager();
+void WmWindow::DestroyUserData() {
+ user_data_.reset();
}
-} // namespace mus
} // namespace ash

Powered by Google App Engine
This is Rietveld 408576698