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

Unified Diff: components/mus/ws/window_tree.cc

Issue 2008193002: Change mojo geometry structs from using type converters to StructTraits. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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: components/mus/ws/window_tree.cc
diff --git a/components/mus/ws/window_tree.cc b/components/mus/ws/window_tree.cc
index d213e77dbfefb2431057b7f93b89b50388e3a830..d30c4b07de05313947a7a114fbb2b6bd27293e2d 100644
--- a/components/mus/ws/window_tree.cc
+++ b/components/mus/ws/window_tree.cc
@@ -25,7 +25,6 @@
#include "components/mus/ws/window_manager_state.h"
#include "components/mus/ws/window_server.h"
#include "components/mus/ws/window_tree_binding.h"
-#include "mojo/converters/geometry/geometry_type_converters.h"
#include "mojo/converters/ime/ime_type_converters.h"
#include "mojo/converters/input_events/input_events_type_converters.h"
#include "mojo/converters/surfaces/surfaces_type_converters.h"
@@ -34,7 +33,6 @@
using mojo::Array;
using mojo::Callback;
using mojo::InterfaceRequest;
-using mojo::Rect;
using mojo::String;
namespace mus {
@@ -414,8 +412,7 @@ void WindowTree::ProcessWindowBoundsChanged(const ServerWindow* window,
ClientWindowId client_window_id;
if (originated_change || !IsWindowKnown(window, &client_window_id))
return;
- client()->OnWindowBoundsChanged(client_window_id.id, Rect::From(old_bounds),
- Rect::From(new_bounds));
+ client()->OnWindowBoundsChanged(client_window_id.id, old_bounds, new_bounds);
}
void WindowTree::ProcessClientAreaChanged(
@@ -427,8 +424,8 @@ void WindowTree::ProcessClientAreaChanged(
if (originated_change || !IsWindowKnown(window, &client_window_id))
return;
client()->OnClientAreaChanged(
- client_window_id.id, mojo::Insets::From(new_client_area),
- mojo::Array<mojo::RectPtr>::From(new_additional_client_areas));
+ client_window_id.id, new_client_area,
+ std::vector<gfx::Rect>(new_additional_client_areas));
}
void WindowTree::ProcessViewportMetricsChanged(
@@ -880,7 +877,7 @@ mojom::WindowDataPtr WindowTree::WindowToWindowData(
parent ? ClientWindowIdForWindow(parent).id : ClientWindowId().id;
window_data->window_id =
window ? ClientWindowIdForWindow(window).id : ClientWindowId().id;
- window_data->bounds = Rect::From(window->bounds());
+ window_data->bounds = window->bounds();
window_data->properties =
mojo::Map<String, Array<uint8_t>>::From(window->properties());
window_data->visible = window->visible();
@@ -1186,7 +1183,7 @@ void WindowTree::SetEventObserver(mojom::EventMatcherPtr matcher,
void WindowTree::SetWindowBounds(uint32_t change_id,
Id window_id,
- mojo::RectPtr bounds) {
+ const gfx::Rect& bounds) {
ServerWindow* window = GetWindowByClientId(ClientWindowId(window_id));
if (window && ShouldRouteToWindowManager(window)) {
const uint32_t wm_change_id =
@@ -1206,7 +1203,7 @@ void WindowTree::SetWindowBounds(uint32_t change_id,
bool success = window && access_policy_->CanSetWindowBounds(window);
if (success) {
Operation op(this, window_server_, OperationType::SET_WINDOW_BOUNDS);
- window->SetBounds(bounds.To<gfx::Rect>());
+ window->SetBounds(bounds);
}
client()->OnChangeCompleted(change_id, success);
}
@@ -1328,8 +1325,8 @@ void WindowTree::OnWindowInputEventAck(uint32_t event_id,
void WindowTree::SetClientArea(
Id transport_window_id,
- mojo::InsetsPtr insets,
- mojo::Array<mojo::RectPtr> transport_additional_client_areas) {
+ const gfx::Insets& insets,
+ mojo::Array<gfx::Rect> transport_additional_client_areas) {
ServerWindow* window =
GetWindowByClientId(ClientWindowId(transport_window_id));
if (!window || !access_policy_->CanSetClientArea(window))
@@ -1337,10 +1334,10 @@ void WindowTree::SetClientArea(
std::vector<gfx::Rect> additional_client_areas =
transport_additional_client_areas.To<std::vector<gfx::Rect>>();
- window->SetClientArea(insets.To<gfx::Insets>(), additional_client_areas);
+ window->SetClientArea(insets, additional_client_areas);
}
-void WindowTree::SetHitTestMask(Id transport_window_id, mojo::RectPtr mask) {
+void WindowTree::SetHitTestMask(Id transport_window_id, const gfx::Rect& mask) {
ServerWindow* window =
GetWindowByClientId(ClientWindowId(transport_window_id));
if (!window || !access_policy_->CanSetHitTestMask(window)) {
@@ -1348,8 +1345,8 @@ void WindowTree::SetHitTestMask(Id transport_window_id, mojo::RectPtr mask) {
return;
}
- if (mask)
- window->SetHitTestMask(mask.To<gfx::Rect>());
+ if (!mask.IsEmpty())
+ window->SetHitTestMask(mask);
else
window->ClearHitTestMask();
}
@@ -1447,13 +1444,13 @@ void WindowTree::SetUnderlaySurfaceOffsetAndExtendedHitArea(
Id window_id,
int32_t x_offset,
int32_t y_offset,
- mojo::InsetsPtr hit_area) {
+ const gfx::Insets& hit_area) {
ServerWindow* window = GetWindowByClientId(ClientWindowId(window_id));
if (!window)
return;
window->SetUnderlayOffset(gfx::Vector2d(x_offset, y_offset));
- window->set_extended_hit_test_region(hit_area.To<gfx::Insets>());
+ window->set_extended_hit_test_region(hit_area);
}
void WindowTree::WmResponse(uint32_t change_id, bool response) {

Powered by Google App Engine
This is Rietveld 408576698