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

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

Issue 2712203002: c++ / mojo changes for 'external window mode'
Patch Set: addressing fwang/sky feedback 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
Index: services/ui/ws/window_tree.cc
diff --git a/services/ui/ws/window_tree.cc b/services/ui/ws/window_tree.cc
index f642e1f1c3291f98d25ebcc946bb1336a56e9068..f227b6cbcdaca550b06a74b05f4aa8cf1213d363 100644
--- a/services/ui/ws/window_tree.cc
+++ b/services/ui/ws/window_tree.cc
@@ -100,9 +100,20 @@ void WindowTree::Init(std::unique_ptr<WindowTreeBinding> binding,
if (roots_.empty())
return;
+ DoOnEmbed(std::move(tree), nullptr /*ServerWindow*/);
+}
+
+void WindowTree::DoOnEmbed(mojom::WindowTreePtr tree,
+ ServerWindow* root_window) {
std::vector<const ServerWindow*> to_send;
- CHECK_EQ(1u, roots_.size());
- const ServerWindow* root = *roots_.begin();
+
+ bool in_external_window_mode = !!root_window;
+ if (in_external_window_mode)
+ CHECK_LE(1u, roots_.size());
+ else
+ CHECK_EQ(1u, roots_.size());
fwang 2017/03/01 06:38:47 Does that compile when assertions are disabled?
+
+ const ServerWindow* root = root_window ? root_window : *roots_.begin();
GetUnknownWindowsFrom(root, &to_send);
Display* display = GetDisplay(root);
@@ -189,8 +200,7 @@ void WindowTree::PrepareForWindowServerShutdown() {
window_manager_internal_ = binding_->GetWindowManager();
}
-void WindowTree::AddRootForWindowManager(const ServerWindow* root) {
- DCHECK(window_manager_internal_);
+void WindowTree::AddRoot(const ServerWindow* root) {
const ClientWindowId client_window_id(WindowIdToTransportId(root->id()));
DCHECK_EQ(0u, client_id_to_window_id_map_.count(client_window_id));
client_id_to_window_id_map_[client_window_id] = root->id();
@@ -199,8 +209,12 @@ void WindowTree::AddRootForWindowManager(const ServerWindow* root) {
Display* display = GetDisplay(root);
DCHECK(display);
+}
- window_manager_internal_->WmNewDisplayAdded(display->ToDisplay(),
+void WindowTree::AddRootForWindowManager(const ServerWindow* root) {
+ DCHECK(window_manager_internal_);
+ AddRoot(root);
+ window_manager_internal_->WmNewDisplayAdded(GetDisplay(root)->ToDisplay(),
WindowToWindowData(root),
root->parent()->IsDrawn());
}

Powered by Google App Engine
This is Rietveld 408576698