summaryrefslogtreecommitdiffstats
path: root/mojo/services
diff options
context:
space:
mode:
authorben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-21 19:07:40 +0000
committerben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-21 19:07:40 +0000
commit7eb25d94230406a437e34acb7316b07135ae1ac0 (patch)
tree44da68548dab627baa22fbe438e6c3999c06428b /mojo/services
parentcbf426d5c0530101898dd9b78f462041340f21a5 (diff)
downloadchromium_src-7eb25d94230406a437e34acb7316b07135ae1ac0.zip
chromium_src-7eb25d94230406a437e34acb7316b07135ae1ac0.tar.gz
chromium_src-7eb25d94230406a437e34acb7316b07135ae1ac0.tar.bz2
Move geometry types to a more central location.
R=sky@chromium.org BUG= Review URL: https://codereview.chromium.org/298563003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@271936 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'mojo/services')
-rw-r--r--mojo/services/native_viewport/DEPS1
-rw-r--r--mojo/services/native_viewport/geometry_conversions.h64
-rw-r--r--mojo/services/native_viewport/native_viewport.mojom17
-rw-r--r--mojo/services/native_viewport/native_viewport_service.cc2
4 files changed, 4 insertions, 80 deletions
diff --git a/mojo/services/native_viewport/DEPS b/mojo/services/native_viewport/DEPS
index 6e465aa..b5edc8b 100644
--- a/mojo/services/native_viewport/DEPS
+++ b/mojo/services/native_viewport/DEPS
@@ -1,4 +1,5 @@
include_rules = [
+ "+mojo/geometry",
"+mojo/services/gles2",
"+ui/events",
"+ui/gfx",
diff --git a/mojo/services/native_viewport/geometry_conversions.h b/mojo/services/native_viewport/geometry_conversions.h
deleted file mode 100644
index 27e9c5a..0000000
--- a/mojo/services/native_viewport/geometry_conversions.h
+++ /dev/null
@@ -1,64 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef MOJO_SERVICES_NATIVE_VIEWPORT_GEOMETRY_CONVERSIONS_H_
-#define MOJO_SERVICES_NATIVE_VIEWPORT_GEOMETRY_CONVERSIONS_H_
-
-#include "mojo/services/native_viewport/native_viewport.mojom.h"
-#include "ui/gfx/rect.h"
-
-namespace mojo {
-
-template<>
-class TypeConverter<Point, gfx::Point> {
-public:
- static Point ConvertFrom(const gfx::Point& input, Buffer* buf) {
- Point::Builder point(buf);
- point.set_x(input.x());
- point.set_y(input.y());
- return point.Finish();
- }
- static gfx::Point ConvertTo(const Point& input) {
- return gfx::Point(input.x(), input.y());
- }
-
- MOJO_ALLOW_IMPLICIT_TYPE_CONVERSION();
-};
-
-template<>
-class TypeConverter<Size, gfx::Size> {
-public:
- static Size ConvertFrom(const gfx::Size& input, Buffer* buf) {
- Size::Builder size(buf);
- size.set_width(input.width());
- size.set_height(input.height());
- return size.Finish();
- }
- static gfx::Size ConvertTo(const Size& input) {
- return gfx::Size(input.width(), input.height());
- }
-
- MOJO_ALLOW_IMPLICIT_TYPE_CONVERSION();
-};
-
-template<>
-class TypeConverter<Rect, gfx::Rect> {
- public:
- static Rect ConvertFrom(const gfx::Rect& input, Buffer* buf) {
- Rect::Builder rect(buf);
- rect.set_position(input.origin());
- rect.set_size(input.size());
- return rect.Finish();
- }
- static gfx::Rect ConvertTo(const Rect& input) {
- return gfx::Rect(input.position().x(), input.position().y(),
- input.size().width(), input.size().height());
- }
-
- MOJO_ALLOW_IMPLICIT_TYPE_CONVERSION();
-};
-
-} // namespace mojo
-
-#endif // MOJO_SERVICES_NATIVE_VIEWPORT_GEOMETRY_CONVERSIONS_H_
diff --git a/mojo/services/native_viewport/native_viewport.mojom b/mojo/services/native_viewport/native_viewport.mojom
index eef750c..8e0edb55 100644
--- a/mojo/services/native_viewport/native_viewport.mojom
+++ b/mojo/services/native_viewport/native_viewport.mojom
@@ -2,22 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-module mojo {
-
-struct Point {
- float x;
- float y;
-};
+import "../../public/interfaces/geometry/geometry.mojom"
-struct Size {
- float width;
- float height;
-};
-
-struct Rect {
- Point position;
- Size size;
-};
+module mojo {
struct KeyData {
int32 key_code;
diff --git a/mojo/services/native_viewport/native_viewport_service.cc b/mojo/services/native_viewport/native_viewport_service.cc
index 04f7c4c..4e339bf 100644
--- a/mojo/services/native_viewport/native_viewport_service.cc
+++ b/mojo/services/native_viewport/native_viewport_service.cc
@@ -7,10 +7,10 @@
#include "base/macros.h"
#include "base/message_loop/message_loop.h"
#include "base/time/time.h"
+#include "mojo/geometry/geometry_type_converters.h"
#include "mojo/public/cpp/bindings/allocation_scope.h"
#include "mojo/public/interfaces/shell/shell.mojom.h"
#include "mojo/services/gles2/command_buffer_impl.h"
-#include "mojo/services/native_viewport/geometry_conversions.h"
#include "mojo/services/native_viewport/native_viewport.h"
#include "mojo/services/native_viewport/native_viewport.mojom.h"
#include "ui/events/event.h"