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

Unified Diff: components/arc/ime/arc_ime_struct_traits.h

Issue 2876693004: Implement GetTextFromRange(), GetTextRange() and GetSelectionRange() for ArcImeService. (Closed)
Patch Set: add TODOs in ime.mojom Created 3 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
« no previous file with comments | « components/arc/ime/arc_ime_service_unittest.cc ('k') | components/arc/ime/arc_ime_struct_traits.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/arc/ime/arc_ime_struct_traits.h
diff --git a/components/arc/ime/arc_ime_struct_traits.h b/components/arc/ime/arc_ime_struct_traits.h
new file mode 100644
index 0000000000000000000000000000000000000000..91a7addffde99fddf5a621ff3f3a52b83b72b98f
--- /dev/null
+++ b/components/arc/ime/arc_ime_struct_traits.h
@@ -0,0 +1,33 @@
+// Copyright 2017 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 COMPONENTS_ARC_IME_ARC_IME_STRUCT_TRAITS_H_
+#define COMPONENTS_ARC_IME_ARC_IME_STRUCT_TRAITS_H_
+
+#include "components/arc/common/ime.mojom.h"
+#include "ui/gfx/geometry/rect.h"
+
+namespace mojo {
+
+template <>
+struct StructTraits<arc::mojom::CursorRectDataView, gfx::Rect> {
+ static int32_t left(const gfx::Rect& r) { return r.x(); }
+ static int32_t top(const gfx::Rect& r) { return r.y(); }
+ static int32_t right(const gfx::Rect& r) { return r.right(); }
+ static int32_t bottom(const gfx::Rect& r) { return r.bottom(); }
+
+ static bool Read(arc::mojom::CursorRectDataView data, gfx::Rect* out);
+};
+
+template <>
+struct StructTraits<arc::mojom::TextRangeDataView, gfx::Range> {
+ static uint32_t start(const gfx::Range& r) { return r.start(); }
+ static uint32_t end(const gfx::Range& r) { return r.end(); }
+
+ static bool Read(arc::mojom::TextRangeDataView data, gfx::Range* out);
+};
+
+} // namespace mojo
+
+#endif // COMPONENTS_ARC_IME_ARC_IME_STRUCT_TRAITS_H_
« no previous file with comments | « components/arc/ime/arc_ime_service_unittest.cc ('k') | components/arc/ime/arc_ime_struct_traits.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698