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

Unified Diff: services/ui/ws/window_manager_state.cc

Issue 2804403002: Adds ability for WindowManager to create display roots (Closed)
Patch Set: cleanup Created 3 years, 8 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 | « services/ui/ws/window_manager_state.h ('k') | services/ui/ws/window_manager_window_tree_factory.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/ui/ws/window_manager_state.cc
diff --git a/services/ui/ws/window_manager_state.cc b/services/ui/ws/window_manager_state.cc
index 3229b818469b09f540804c1f5c79c8cd432dc22a..d7bad7871727a834db530d93cb5acb8e061d02f1 100644
--- a/services/ui/ws/window_manager_state.cc
+++ b/services/ui/ws/window_manager_state.cc
@@ -137,8 +137,10 @@ WindowManagerState::~WindowManagerState() {
for (auto& display_root : window_manager_display_roots_)
display_root->display()->OnWillDestroyTree(window_tree_);
- for (auto& display_root : orphaned_window_manager_display_roots_)
- display_root->root()->RemoveObserver(this);
+ if (window_tree_->automatically_create_display_roots()) {
+ for (auto& display_root : orphaned_window_manager_display_roots_)
+ display_root->root()->RemoveObserver(this);
+ }
}
void WindowManagerState::SetFrameDecorationValues(
@@ -212,6 +214,28 @@ void WindowManagerState::AddSystemModalWindow(ServerWindow* window) {
event_dispatcher_.AddSystemModalWindow(window);
}
+void WindowManagerState::DeleteWindowManagerDisplayRoot(
+ ServerWindow* display_root) {
+ for (auto iter = orphaned_window_manager_display_roots_.begin();
+ iter != orphaned_window_manager_display_roots_.end(); ++iter) {
+ if ((*iter)->root() == display_root) {
+ orphaned_window_manager_display_roots_.erase(iter);
+ return;
+ }
+ }
+
+ for (auto iter = window_manager_display_roots_.begin();
+ iter != window_manager_display_roots_.end(); ++iter) {
+ if ((*iter)->root() == display_root) {
+ (*iter)->display()->RemoveWindowManagerDisplayRoot((*iter).get());
+ window_manager_display_roots_.erase(iter);
+ return;
+ }
+ }
+
+ NOTREACHED();
+}
+
const UserId& WindowManagerState::user_id() const {
return window_tree_->user_id();
}
@@ -356,14 +380,15 @@ void WindowManagerState::OnDisplayDestroying(Display* display) {
for (auto iter = window_manager_display_roots_.begin();
iter != window_manager_display_roots_.end(); ++iter) {
if ((*iter)->display() == display) {
- (*iter)->root()->AddObserver(this);
+ if (window_tree_->automatically_create_display_roots())
+ (*iter)->root()->AddObserver(this);
orphaned_window_manager_display_roots_.push_back(std::move(*iter));
window_manager_display_roots_.erase(iter);
window_tree_->OnDisplayDestroying(display->GetId());
+ orphaned_window_manager_display_roots_.back()->display_ = nullptr;
return;
}
}
- NOTREACHED();
}
void WindowManagerState::SetAllRootWindowsVisible(bool value) {
« no previous file with comments | « services/ui/ws/window_manager_state.h ('k') | services/ui/ws/window_manager_window_tree_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698