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

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

Issue 1419793006: Makes windowmanager draw non-client area (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: move wm nonclientframeview to wm Created 5 years, 1 month 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
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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 const gfx::Rect& old_bounds, 175 const gfx::Rect& old_bounds,
176 const gfx::Rect& new_bounds, 176 const gfx::Rect& new_bounds,
177 bool originated_change) { 177 bool originated_change) {
178 if (originated_change || !IsWindowKnown(window)) 178 if (originated_change || !IsWindowKnown(window))
179 return; 179 return;
180 client()->OnWindowBoundsChanged(WindowIdToTransportId(window->id()), 180 client()->OnWindowBoundsChanged(WindowIdToTransportId(window->id()),
181 Rect::From(old_bounds), 181 Rect::From(old_bounds),
182 Rect::From(new_bounds)); 182 Rect::From(new_bounds));
183 } 183 }
184 184
185 void WindowTreeImpl::ProcessClientAreaChanged(const ServerWindow* window, 185 void WindowTreeImpl::ProcessClientAreaChanged(
186 const gfx::Rect& old_client_area, 186 const ServerWindow* window,
187 const gfx::Rect& new_client_area, 187 const gfx::Insets& old_client_area,
188 bool originated_change) { 188 const gfx::Insets& new_client_area,
189 bool originated_change) {
189 if (originated_change || !IsWindowKnown(window)) 190 if (originated_change || !IsWindowKnown(window))
190 return; 191 return;
191 client()->OnClientAreaChanged(WindowIdToTransportId(window->id()), 192 client()->OnClientAreaChanged(WindowIdToTransportId(window->id()),
192 Rect::From(old_client_area), 193 mojo::Insets::From(old_client_area),
193 Rect::From(new_client_area)); 194 mojo::Insets::From(new_client_area));
194 } 195 }
195 196
196 void WindowTreeImpl::ProcessViewportMetricsChanged( 197 void WindowTreeImpl::ProcessViewportMetricsChanged(
197 const mojom::ViewportMetrics& old_metrics, 198 const mojom::ViewportMetrics& old_metrics,
198 const mojom::ViewportMetrics& new_metrics, 199 const mojom::ViewportMetrics& new_metrics,
199 bool originated_change) { 200 bool originated_change) {
200 client()->OnWindowViewportMetricsChanged(old_metrics.Clone(), 201 client()->OnWindowViewportMetricsChanged(old_metrics.Clone(),
201 new_metrics.Clone()); 202 new_metrics.Clone());
202 } 203 }
203 204
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after
662 if (success) { 663 if (success) {
663 if (!state.is_null()) 664 if (!state.is_null())
664 window->SetTextInputState(state.To<ui::TextInputState>()); 665 window->SetTextInputState(state.To<ui::TextInputState>());
665 666
666 WindowTreeHostImpl* host = GetHost(); 667 WindowTreeHostImpl* host = GetHost();
667 if (host) 668 if (host)
668 host->SetImeVisibility(window, visible); 669 host->SetImeVisibility(window, visible);
669 } 670 }
670 } 671 }
671 672
672 void WindowTreeImpl::SetClientArea(Id transport_window_id, mojo::RectPtr rect) { 673 void WindowTreeImpl::SetClientArea(Id transport_window_id,
674 mojo::InsetsPtr insets) {
673 ServerWindow* window = 675 ServerWindow* window =
674 GetWindow(WindowIdFromTransportId(transport_window_id)); 676 GetWindow(WindowIdFromTransportId(transport_window_id));
675 if (!window || !access_policy_->CanSetClientArea(window)) 677 if (!window || !access_policy_->CanSetClientArea(window))
676 return; 678 return;
677 679
678 if (rect.is_null()) 680 window->SetClientArea(insets.To<gfx::Insets>());
679 window->SetClientArea(gfx::Rect(window->bounds().size()));
680 else
681 window->SetClientArea(rect.To<gfx::Rect>());
682 } 681 }
683 682
684 void WindowTreeImpl::Embed(Id transport_window_id, 683 void WindowTreeImpl::Embed(Id transport_window_id,
685 mojom::WindowTreeClientPtr client, 684 mojom::WindowTreeClientPtr client,
686 uint32_t policy_bitmask, 685 uint32_t policy_bitmask,
687 const EmbedCallback& callback) { 686 const EmbedCallback& callback) {
688 ConnectionSpecificId connection_id = kInvalidConnectionId; 687 ConnectionSpecificId connection_id = kInvalidConnectionId;
689 const bool result = Embed(WindowIdFromTransportId(transport_window_id), 688 const bool result = Embed(WindowIdFromTransportId(transport_window_id),
690 client.Pass(), policy_bitmask, &connection_id); 689 client.Pass(), policy_bitmask, &connection_id);
691 callback.Run(result, connection_id); 690 callback.Run(result, connection_id);
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
728 void WindowTreeImpl::SetShowState(uint32_t window_id, 727 void WindowTreeImpl::SetShowState(uint32_t window_id,
729 mojom::ShowState show_state, 728 mojom::ShowState show_state,
730 const SetShowStateCallback& callback) { 729 const SetShowStateCallback& callback) {
731 if (!GetHost() || !GetHost()->window_manager()) 730 if (!GetHost() || !GetHost()->window_manager())
732 return; 731 return;
733 732
734 // TODO(sky): verify window_id is valid for the client. 733 // TODO(sky): verify window_id is valid for the client.
735 GetHost()->window_manager()->SetShowState(window_id, show_state, callback); 734 GetHost()->window_manager()->SetShowState(window_id, show_state, callback);
736 } 735 }
737 736
738 void WindowTreeImpl::GetDisplays(const GetDisplaysCallback& callback) {
739 if (!GetHost() || !GetHost()->window_manager())
740 return;
741
742 GetHost()->window_manager()->GetDisplays(callback);
743 }
744
745 bool WindowTreeImpl::IsRootForAccessPolicy(const WindowId& id) const { 737 bool WindowTreeImpl::IsRootForAccessPolicy(const WindowId& id) const {
746 return IsRoot(id); 738 return IsRoot(id);
747 } 739 }
748 740
749 bool WindowTreeImpl::IsWindowKnownForAccessPolicy( 741 bool WindowTreeImpl::IsWindowKnownForAccessPolicy(
750 const ServerWindow* window) const { 742 const ServerWindow* window) const {
751 return IsWindowKnown(window); 743 return IsWindowKnown(window);
752 } 744 }
753 745
754 bool WindowTreeImpl::IsWindowRootOfAnotherConnectionForAccessPolicy( 746 bool WindowTreeImpl::IsWindowRootOfAnotherConnectionForAccessPolicy(
755 const ServerWindow* window) const { 747 const ServerWindow* window) const {
756 WindowTreeImpl* connection = 748 WindowTreeImpl* connection =
757 connection_manager_->GetConnectionWithRoot(window->id()); 749 connection_manager_->GetConnectionWithRoot(window->id());
758 return connection && connection != this; 750 return connection && connection != this;
759 } 751 }
760 752
761 bool WindowTreeImpl::IsDescendantOfEmbedRoot(const ServerWindow* window) { 753 bool WindowTreeImpl::IsDescendantOfEmbedRoot(const ServerWindow* window) {
762 return is_embed_root_ && root_ && GetWindow(*root_)->Contains(window); 754 return is_embed_root_ && root_ && GetWindow(*root_)->Contains(window);
763 } 755 }
764 756
765 } // namespace ws 757 } // namespace ws
766 758
767 } // namespace mus 759 } // namespace mus
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698