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

Unified Diff: components/mus/ws/display.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/display.cc
diff --git a/components/mus/ws/display.cc b/components/mus/ws/display.cc
index 8a745a6f2ca69d2ef6e12dc2d24059f0e78cca63..2afef239f04f72606ef06b8d638c3f054b979de9 100644
--- a/components/mus/ws/display.cc
+++ b/components/mus/ws/display.cc
@@ -22,7 +22,6 @@
#include "components/mus/ws/window_tree.h"
#include "components/mus/ws/window_tree_binding.h"
#include "mojo/common/common_type_converters.h"
-#include "mojo/converters/geometry/geometry_type_converters.h"
#include "services/shell/public/interfaces/connector.mojom.h"
#include "ui/base/cursor/cursor.h"
@@ -83,14 +82,11 @@ mojom::DisplayPtr Display::ToMojomDisplay() const {
mojom::DisplayPtr display_ptr = mojom::Display::New();
display_ptr = mojom::Display::New();
display_ptr->id = id_;
- display_ptr->bounds = mojo::Rect::New();
// TODO(sky): Display should know it's origin.
- display_ptr->bounds->x = 0;
- display_ptr->bounds->y = 0;
- display_ptr->bounds->width = root_->bounds().size().width();
- display_ptr->bounds->height = root_->bounds().size().height();
+ display_ptr->bounds.SetRect(0, 0, root_->bounds().size().width(),
+ root_->bounds().size().height());
// TODO(sky): window manager needs an API to set the work area.
- display_ptr->work_area = display_ptr->bounds.Clone();
+ display_ptr->work_area = display_ptr->bounds;
display_ptr->device_pixel_ratio =
platform_display_->GetViewportMetrics().device_pixel_ratio;
display_ptr->rotation = platform_display_->GetRotation();
@@ -99,10 +95,6 @@ mojom::DisplayPtr Display::ToMojomDisplay() const {
// TODO(sky): make this real.
display_ptr->touch_support = mojom::TouchSupport::UNKNOWN;
display_ptr->frame_decoration_values = mojom::FrameDecorationValues::New();
- display_ptr->frame_decoration_values->normal_client_area_insets =
- mojo::Insets::New();
- display_ptr->frame_decoration_values->maximized_client_area_insets =
- mojo::Insets::New();
return display_ptr;
}
@@ -222,8 +214,8 @@ void Display::UpdateNativeCursor(int32_t cursor_id) {
}
}
-void Display::SetSize(mojo::SizePtr size) {
- platform_display_->SetViewportSize(size.To<gfx::Size>());
+void Display::SetSize(const gfx::Size& size) {
+ platform_display_->SetViewportSize(size);
}
void Display::SetTitle(const mojo::String& title) {
@@ -299,13 +291,13 @@ void Display::OnViewportMetricsChanged(
root_.reset(window_server_->CreateServerWindow(
display_manager()->GetAndAdvanceNextRootId(),
ServerWindow::Properties()));
- root_->SetBounds(gfx::Rect(new_metrics.size_in_pixels.To<gfx::Size>()));
+ root_->SetBounds(gfx::Rect(new_metrics.size_in_pixels));
root_->SetVisible(true);
focus_controller_.reset(new FocusController(this, root_.get()));
focus_controller_->AddObserver(this);
InitWindowManagersIfNecessary();
} else {
- root_->SetBounds(gfx::Rect(new_metrics.size_in_pixels.To<gfx::Size>()));
+ root_->SetBounds(gfx::Rect(new_metrics.size_in_pixels));
const gfx::Rect wm_bounds(root_->bounds().size());
for (auto& pair : window_manager_state_map_)
pair.second->root()->SetBounds(wm_bounds);

Powered by Google App Engine
This is Rietveld 408576698