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

Side by Side Diff: components/mus/ws/window_tree_impl.cc

Issue 1474543002: Makes NewWindow() take set of properties for window (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nuke shadow_style changes Created 5 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 unified diff | Download patch
« no previous file with comments | « components/mus/ws/window_tree_impl.h ('k') | components/mus/ws/window_tree_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/mus/ws/window_tree_impl.h" 5 #include "components/mus/ws/window_tree_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/stl_util.h" 8 #include "base/stl_util.h"
9 #include "components/mus/ws/connection_manager.h" 9 #include "components/mus/ws/connection_manager.h"
10 #include "components/mus/ws/default_access_policy.h" 10 #include "components/mus/ws/default_access_policy.h"
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 root_.reset(); 112 root_.reset();
113 } 113 }
114 114
115 void WindowTreeImpl::NotifyChangeCompleted( 115 void WindowTreeImpl::NotifyChangeCompleted(
116 uint32_t change_id, 116 uint32_t change_id,
117 mojom::WindowManagerErrorCode error_code) { 117 mojom::WindowManagerErrorCode error_code) {
118 client_->OnChangeCompleted( 118 client_->OnChangeCompleted(
119 change_id, error_code == mojom::WINDOW_MANAGER_ERROR_CODE_SUCCESS); 119 change_id, error_code == mojom::WINDOW_MANAGER_ERROR_CODE_SUCCESS);
120 } 120 }
121 121
122 bool WindowTreeImpl::NewWindow(const WindowId& window_id) { 122 bool WindowTreeImpl::NewWindow(
123 const WindowId& window_id,
124 const std::map<std::string, std::vector<uint8_t>>& properties) {
123 if (window_id.connection_id != id_) 125 if (window_id.connection_id != id_)
124 return false; 126 return false;
125 if (window_map_.find(window_id.window_id) != window_map_.end()) 127 if (window_map_.find(window_id.window_id) != window_map_.end())
126 return false; 128 return false;
127 window_map_[window_id.window_id] = 129 window_map_[window_id.window_id] =
128 connection_manager_->CreateServerWindow(window_id); 130 connection_manager_->CreateServerWindow(window_id, properties);
129 known_windows_.insert(WindowIdToTransportId(window_id)); 131 known_windows_.insert(WindowIdToTransportId(window_id));
130 return true; 132 return true;
131 } 133 }
132 134
133 bool WindowTreeImpl::AddWindow(const WindowId& parent_id, 135 bool WindowTreeImpl::AddWindow(const WindowId& parent_id,
134 const WindowId& child_id) { 136 const WindowId& child_id) {
135 ServerWindow* parent = GetWindow(parent_id); 137 ServerWindow* parent = GetWindow(parent_id);
136 ServerWindow* child = GetWindow(child_id); 138 ServerWindow* child = GetWindow(child_id);
137 if (parent && child && child->parent() != parent && 139 if (parent && child && child->parent() != parent &&
138 !child->Contains(parent) && access_policy_->CanAddWindow(parent, child)) { 140 !child->Contains(parent) && access_policy_->CanAddWindow(parent, child)) {
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after
598 600
599 void WindowTreeImpl::RemoveChildrenAsPartOfEmbed(const WindowId& window_id) { 601 void WindowTreeImpl::RemoveChildrenAsPartOfEmbed(const WindowId& window_id) {
600 ServerWindow* window = GetWindow(window_id); 602 ServerWindow* window = GetWindow(window_id);
601 CHECK(window); 603 CHECK(window);
602 CHECK(window->id().connection_id == window_id.connection_id); 604 CHECK(window->id().connection_id == window_id.connection_id);
603 std::vector<ServerWindow*> children = window->GetChildren(); 605 std::vector<ServerWindow*> children = window->GetChildren();
604 for (size_t i = 0; i < children.size(); ++i) 606 for (size_t i = 0; i < children.size(); ++i)
605 window->Remove(children[i]); 607 window->Remove(children[i]);
606 } 608 }
607 609
608 void WindowTreeImpl::NewWindow(uint32_t change_id, Id transport_window_id) { 610 void WindowTreeImpl::NewWindow(
611 uint32_t change_id,
612 Id transport_window_id,
613 mojo::Map<mojo::String, mojo::Array<uint8_t>> transport_properties) {
614 std::map<std::string, std::vector<uint8_t>> properties;
615 if (!transport_properties.is_null()) {
616 properties =
617 transport_properties.To<std::map<std::string, std::vector<uint8_t>>>();
618 }
609 client_->OnChangeCompleted( 619 client_->OnChangeCompleted(
610 change_id, NewWindow(WindowIdFromTransportId(transport_window_id))); 620 change_id,
621 NewWindow(WindowIdFromTransportId(transport_window_id), properties));
611 } 622 }
612 623
613 void WindowTreeImpl::DeleteWindow(Id transport_window_id, 624 void WindowTreeImpl::DeleteWindow(Id transport_window_id,
614 const Callback<void(bool)>& callback) { 625 const Callback<void(bool)>& callback) {
615 ServerWindow* window = 626 ServerWindow* window =
616 GetWindow(WindowIdFromTransportId(transport_window_id)); 627 GetWindow(WindowIdFromTransportId(transport_window_id));
617 bool success = false; 628 bool success = false;
618 bool should_close = window && (access_policy_->CanDeleteWindow(window) || 629 bool should_close = window && (access_policy_->CanDeleteWindow(window) ||
619 ShouldRouteToWindowManager(window)); 630 ShouldRouteToWindowManager(window));
620 if (should_close) { 631 if (should_close) {
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
846 return connection && connection != this; 857 return connection && connection != this;
847 } 858 }
848 859
849 bool WindowTreeImpl::IsDescendantOfEmbedRoot(const ServerWindow* window) { 860 bool WindowTreeImpl::IsDescendantOfEmbedRoot(const ServerWindow* window) {
850 return is_embed_root_ && root_ && GetWindow(*root_)->Contains(window); 861 return is_embed_root_ && root_ && GetWindow(*root_)->Contains(window);
851 } 862 }
852 863
853 } // namespace ws 864 } // namespace ws
854 865
855 } // namespace mus 866 } // namespace mus
OLDNEW
« no previous file with comments | « components/mus/ws/window_tree_impl.h ('k') | components/mus/ws/window_tree_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698