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

Unified Diff: ui/aura/mus/window_tree_client.cc

Issue 2539263005: Makes WindowTreeHostMus supply properties directly to window creation (Closed)
Patch Set: comment Created 4 years 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 | « ui/aura/mus/window_tree_client.h ('k') | ui/aura/mus/window_tree_client_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/aura/mus/window_tree_client.cc
diff --git a/ui/aura/mus/window_tree_client.cc b/ui/aura/mus/window_tree_client.cc
index 9dfb2bb38bc873add46b9cf6463304f2edebc316..85e73073a60c5520575c5ed4351d5fc6bd30fe8e 100644
--- a/ui/aura/mus/window_tree_client.cc
+++ b/ui/aura/mus/window_tree_client.cc
@@ -535,7 +535,7 @@ void WindowTreeClient::OnWindowMusCreated(WindowMus* window) {
window->set_server_id(MakeTransportId(client_id_, next_window_id_++));
RegisterWindowMus(window);
- const bool create_top_level = !window_manager_delegate_ && IsRoot(window);
+ DCHECK(window_manager_delegate_ || !IsRoot(window));
std::unordered_map<std::string, std::vector<uint8_t>> transport_properties;
std::set<const void*> property_keys =
@@ -555,17 +555,10 @@ void WindowTreeClient::OnWindowMusCreated(WindowMus* window) {
}
}
- const uint32_t change_id =
- ScheduleInFlightChange(base::MakeUnique<CrashInFlightChange>(
- window, create_top_level ? ChangeType::NEW_TOP_LEVEL_WINDOW
- : ChangeType::NEW_WINDOW));
- if (create_top_level) {
- tree_->NewTopLevelWindow(change_id, window->server_id(),
- transport_properties);
- } else {
- tree_->NewWindow(change_id, window->server_id(),
- std::move(transport_properties));
- }
+ const uint32_t change_id = ScheduleInFlightChange(
+ base::MakeUnique<CrashInFlightChange>(window, ChangeType::NEW_WINDOW));
+ tree_->NewWindow(change_id, window->server_id(),
+ std::move(transport_properties));
}
void WindowTreeClient::OnWindowMusDestroyed(WindowMus* window, Origin origin) {
@@ -1533,10 +1526,26 @@ void WindowTreeClient::OnWindowTreeHostHitTestMaskWillChange(
out_rect);
}
-std::unique_ptr<WindowPortMus> WindowTreeClient::CreateWindowPortForTopLevel() {
+std::unique_ptr<WindowPortMus> WindowTreeClient::CreateWindowPortForTopLevel(
+ const std::map<std::string, std::vector<uint8_t>>* properties) {
std::unique_ptr<WindowPortMus> window_port =
base::MakeUnique<WindowPortMus>(this, WindowMusType::TOP_LEVEL);
roots_.insert(window_port.get());
+
+ window_port->set_server_id(MakeTransportId(client_id_, next_window_id_++));
+ RegisterWindowMus(window_port.get());
+
+ std::unordered_map<std::string, std::vector<uint8_t>> transport_properties;
+ if (properties) {
+ for (const auto& property_pair : *properties)
+ transport_properties[property_pair.first] = property_pair.second;
+ }
+
+ const uint32_t change_id =
+ ScheduleInFlightChange(base::MakeUnique<CrashInFlightChange>(
+ window_port.get(), ChangeType::NEW_TOP_LEVEL_WINDOW));
+ tree_->NewTopLevelWindow(change_id, window_port->server_id(),
+ transport_properties);
return window_port;
}
« no previous file with comments | « ui/aura/mus/window_tree_client.h ('k') | ui/aura/mus/window_tree_client_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698