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

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

Issue 2712203002: c++ / mojo changes for 'external window mode'
Patch Set: rebased Created 3 years, 9 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_tree.h ('k') | services/ui/ws/window_tree_host_factory.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/ui/ws/window_tree.cc
diff --git a/services/ui/ws/window_tree.cc b/services/ui/ws/window_tree.cc
index 89ef41112b3c944243ac3b9822f10b336d9e6656..9eefc515e168c2b984f90a679313f94bd0b0769c 100644
--- a/services/ui/ws/window_tree.cc
+++ b/services/ui/ws/window_tree.cc
@@ -100,7 +100,34 @@ 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) {
+ bool in_external_window_mode = !!root_window;
+ if (in_external_window_mode) {
+ DCHECK(!tree);
+ CHECK_LE(1u, roots_.size());
+
+ Display* display = GetDisplay(root_window);
+ int64_t display_id =
+ display ? display->GetId() : display::kInvalidDisplayId;
+
+ ClientWindowId window_id;
+ IsWindowKnown(root_window, &window_id);
+
+ const bool drawn =
+ root_window->parent() && root_window->parent()->IsDrawn();
+ client()->OnEmbed(id_, WindowToWindowData(root_window),
+ nullptr /*mojom::WindowTreePtr*/, display_id,
+ window_id.id, drawn);
+ return;
+ }
+
std::vector<const ServerWindow*> to_send;
+
+ DCHECK(!root_window);
CHECK_EQ(1u, roots_.size());
const ServerWindow* root = *roots_.begin();
GetUnknownWindowsFrom(root, &to_send);
@@ -189,6 +216,22 @@ void WindowTree::PrepareForWindowServerShutdown() {
window_manager_internal_ = binding_->GetWindowManager();
}
+void WindowTree::AddRoot(const ServerWindow* root) {
+ DCHECK(pending_client_id_ != kInvalidClientId);
+
+ const ClientWindowId client_window_id(pending_client_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();
+ window_id_to_client_id_map_[root->id()] = client_window_id;
+ pending_client_id_ = kInvalidClientId;
+
+ roots_.insert(root);
+
+ Display* display = GetDisplay(root);
+ DCHECK(display);
+}
+
void WindowTree::AddRootForWindowManager(const ServerWindow* root) {
DCHECK(window_manager_internal_);
const ClientWindowId client_window_id(WindowIdToTransportId(root->id()));
@@ -2078,7 +2121,7 @@ bool WindowTree::IsWindowCreatedByWindowManager(
// WindowManager attached, the window manager didn't create this window.
const WindowManagerDisplayRoot* display_root =
GetWindowManagerDisplayRoot(window);
- if (!display_root)
+ if (!display_root || !display_root->window_manager_state())
return false;
return display_root->window_manager_state()->window_tree()->id() ==
« no previous file with comments | « services/ui/ws/window_tree.h ('k') | services/ui/ws/window_tree_host_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698