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

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

Issue 2712203002: c++ / mojo changes for 'external window mode'
Patch Set: addressed sky/fwang feedback (take 5), simpler mus_demo changes / passing unittests 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
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..ebd20a768b688ce601a0df5c7d508a43fbb7fde0 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()));
@@ -2055,7 +2098,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() ==

Powered by Google App Engine
This is Rietveld 408576698