Revert "Reland "Removes ui/platform_window/mojo as it is not used by anyone.""
This reverts commit 6700540dcbab00b4120fa39b41ea51d4c5fc3a3b.
Reason for revert: Win x64 Builder failure!
https://ci.chromium.org/p/chromium/builders/ci/Win%20x64%20Builder%20%28dbg%29/90510
Original change's description:
> Reland "Removes ui/platform_window/mojo as it is not used by anyone."
>
> This is a reland of 6eb61402c1b1b4301762c6aaaea28b2921cbf4c2
>
> Original change's description:
> > Removes ui/platform_window/mojo as it is not used by anyone.
> >
> > This is to remove the ref to some types under ui/base/ime/mojo, which will be removed later.
> >
> > Bug: 965908
> > Change-Id: I7979524066104c829b4f4e287a0ab87c9365f124
> > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1626055
> > Reviewed-by: Dominick Ng <dominickn@chromium.org>
> > Reviewed-by: Scott Violet <sky@chromium.org>
> > Commit-Queue: Shu Chen <shuchen@chromium.org>
> > Cr-Commit-Position: refs/heads/master@{#662924}
>
> Bug: 965908
> Change-Id: I6bb1c6d081ce235c959cc30e53d20b57dd0e1459
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1626841
> Reviewed-by: Dominick Ng <dominickn@chromium.org>
> Reviewed-by: Scott Violet <sky@chromium.org>
> Commit-Queue: Shu Chen <shuchen@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#663381}
TBR=sky@chromium.org,shuchen@chromium.org,dominickn@chromium.org
Change-Id: I1649ad44813f8de696a3b5f651515a9145f478bd
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 965908
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1630127
Reviewed-by: Shu Chen <shuchen@chromium.org>
Commit-Queue: Shu Chen <shuchen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#663384}
diff --git a/ash/BUILD.gn b/ash/BUILD.gn
index 674512c..70b198f 100644
--- a/ash/BUILD.gn
+++ b/ash/BUILD.gn
@@ -1406,6 +1406,7 @@
"//ui/native_theme",
"//ui/ozone",
"//ui/platform_window",
+ "//ui/platform_window/mojo",
"//ui/platform_window/stub",
"//ui/snapshot",
"//ui/views/window/vector_icons",
diff --git a/ash/host/ash_window_tree_host_platform.cc b/ash/host/ash_window_tree_host_platform.cc
index ef143bf..7c917a3 100644
--- a/ash/host/ash_window_tree_host_platform.cc
+++ b/ash/host/ash_window_tree_host_platform.cc
@@ -24,6 +24,7 @@
#include "ui/gfx/geometry/rect_conversions.h"
#include "ui/gfx/geometry/rect_f.h"
#include "ui/gfx/transform.h"
+#include "ui/platform_window/mojo/ime_type_converters.h"
#include "ui/platform_window/platform_ime_controller.h"
#include "ui/platform_window/platform_window.h"
#include "ui/platform_window/platform_window_init_properties.h"
diff --git a/content/common/render_widget_host_ns_view.mojom b/content/common/render_widget_host_ns_view.mojom
index 2104e7c..48c46bd 100644
--- a/content/common/render_widget_host_ns_view.mojom
+++ b/content/common/render_widget_host_ns_view.mojom
@@ -13,6 +13,7 @@
import "ui/gfx/geometry/mojo/geometry.mojom";
import "ui/gfx/mojo/ca_layer_params.mojom";
import "ui/gfx/range/mojo/range.mojom";
+import "ui/platform_window/mojo/text_input_state.mojom";
// The interface through which code in the browser process, in
// RenderWidgetHostViewMac, sends messages to the app shim process, targeting
diff --git a/services/ws/public/mojom/BUILD.gn b/services/ws/public/mojom/BUILD.gn
index f19658b..8d53c49 100644
--- a/services/ws/public/mojom/BUILD.gn
+++ b/services/ws/public/mojom/BUILD.gn
@@ -22,6 +22,7 @@
"//mojo/public/mojom/base",
"//ui/gfx/geometry/mojo",
"//ui/gfx/mojo",
+ "//ui/platform_window/mojo:interfaces",
]
if (is_chromeos) {
diff --git a/ui/aura/BUILD.gn b/ui/aura/BUILD.gn
index e296dc2..f201984 100644
--- a/ui/aura/BUILD.gn
+++ b/ui/aura/BUILD.gn
@@ -126,6 +126,7 @@
"//ui/gfx/geometry",
"//ui/gl",
"//ui/platform_window",
+ "//ui/platform_window/mojo",
"//ui/platform_window/stub",
]
diff --git a/ui/platform_window/mojo/BUILD.gn b/ui/platform_window/mojo/BUILD.gn
new file mode 100644
index 0000000..b42cf4f
--- /dev/null
+++ b/ui/platform_window/mojo/BUILD.gn
@@ -0,0 +1,39 @@
+# Copyright 2015 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.
+
+import("//build/config/jumbo.gni")
+import("//mojo/public/tools/bindings/mojom.gni")
+
+# This target does NOT depend on skia. One can depend on this target to avoid
+# picking up a dependency on skia.
+jumbo_component("mojo") {
+ output_name = "mojo_ime_lib"
+
+ public_deps = [
+ "//ui/base/ime",
+ ]
+ deps = [
+ ":interfaces",
+ "//base",
+ "//ui/platform_window",
+ ]
+
+ defines = [ "MOJO_IME_IMPLEMENTATION" ]
+
+ sources = [
+ "ime_type_converters.cc",
+ "ime_type_converters.h",
+ "mojo_ime_export.h",
+ ]
+}
+
+mojom("interfaces") {
+ sources = [
+ "text_input_state.mojom",
+ ]
+
+ public_deps = [
+ "//ui/base/ime/mojo",
+ ]
+}
diff --git a/ui/platform_window/mojo/DEPS b/ui/platform_window/mojo/DEPS
new file mode 100644
index 0000000..1d56d19d
--- /dev/null
+++ b/ui/platform_window/mojo/DEPS
@@ -0,0 +1,5 @@
+include_rules = [
+ "+ui/base/ime/text_input_flags.h",
+ "+ui/base/ime/text_input_type.h",
+ "+ui/platform_window/text_input_state.h",
+]
diff --git a/ui/platform_window/mojo/OWNERS b/ui/platform_window/mojo/OWNERS
new file mode 100644
index 0000000..5d54957
--- /dev/null
+++ b/ui/platform_window/mojo/OWNERS
@@ -0,0 +1,5 @@
+per-file *_type_converter*.*=set noparent
+per-file *_type_converter*.*=file://ipc/SECURITY_OWNERS
+
+per-file *.mojom=set noparent
+per-file *.mojom=file://ipc/SECURITY_OWNERS
diff --git a/ui/platform_window/mojo/ime_type_converters.cc b/ui/platform_window/mojo/ime_type_converters.cc
new file mode 100644
index 0000000..9435045
--- /dev/null
+++ b/ui/platform_window/mojo/ime_type_converters.cc
@@ -0,0 +1,63 @@
+// Copyright 2015 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.
+
+#include "ui/platform_window/mojo/ime_type_converters.h"
+
+#include <stdint.h>
+
+#include "base/macros.h"
+
+namespace mojo {
+
+#define TEXT_INPUT_TYPE_ASSERT(NAME) \
+ static_assert(static_cast<int32_t>(ui::mojom::TextInputType::NAME) == \
+ static_cast<int32_t>(ui::TEXT_INPUT_TYPE_##NAME), \
+ "TEXT_INPUT_TYPE must match")
+TEXT_INPUT_TYPE_ASSERT(NONE);
+TEXT_INPUT_TYPE_ASSERT(TEXT);
+TEXT_INPUT_TYPE_ASSERT(PASSWORD);
+TEXT_INPUT_TYPE_ASSERT(SEARCH);
+TEXT_INPUT_TYPE_ASSERT(EMAIL);
+TEXT_INPUT_TYPE_ASSERT(NUMBER);
+TEXT_INPUT_TYPE_ASSERT(TELEPHONE);
+TEXT_INPUT_TYPE_ASSERT(URL);
+TEXT_INPUT_TYPE_ASSERT(DATE);
+TEXT_INPUT_TYPE_ASSERT(DATE_TIME);
+TEXT_INPUT_TYPE_ASSERT(DATE_TIME_LOCAL);
+TEXT_INPUT_TYPE_ASSERT(MONTH);
+TEXT_INPUT_TYPE_ASSERT(TIME);
+TEXT_INPUT_TYPE_ASSERT(WEEK);
+TEXT_INPUT_TYPE_ASSERT(TEXT_AREA);
+TEXT_INPUT_TYPE_ASSERT(CONTENT_EDITABLE);
+TEXT_INPUT_TYPE_ASSERT(DATE_TIME_FIELD);
+TEXT_INPUT_TYPE_ASSERT(MAX);
+
+#define TEXT_INPUT_FLAG_ASSERT(NAME) \
+ static_assert(static_cast<int32_t>(ui::mojom::TextInputFlag::NAME) == \
+ static_cast<int32_t>(ui::TEXT_INPUT_FLAG_##NAME), \
+ "TEXT_INPUT_FLAG must match")
+TEXT_INPUT_FLAG_ASSERT(NONE);
+TEXT_INPUT_FLAG_ASSERT(AUTOCOMPLETE_ON);
+TEXT_INPUT_FLAG_ASSERT(AUTOCOMPLETE_OFF);
+TEXT_INPUT_FLAG_ASSERT(AUTOCORRECT_ON);
+TEXT_INPUT_FLAG_ASSERT(AUTOCORRECT_OFF);
+TEXT_INPUT_FLAG_ASSERT(SPELLCHECK_ON);
+TEXT_INPUT_FLAG_ASSERT(SPELLCHECK_OFF);
+TEXT_INPUT_FLAG_ASSERT(AUTOCAPITALIZE_NONE);
+TEXT_INPUT_FLAG_ASSERT(AUTOCAPITALIZE_CHARACTERS);
+TEXT_INPUT_FLAG_ASSERT(AUTOCAPITALIZE_WORDS);
+TEXT_INPUT_FLAG_ASSERT(AUTOCAPITALIZE_SENTENCES);
+
+// static
+ui::TextInputState
+TypeConverter<ui::TextInputState, ui::mojom::TextInputStatePtr>::Convert(
+ const ui::mojom::TextInputStatePtr& input) {
+ return ui::TextInputState(
+ ConvertTo<ui::TextInputType>(input->type), input->flags,
+ input->text.has_value() ? input->text.value() : std::string(),
+ input->selection_start, input->selection_end, input->composition_start,
+ input->composition_end, input->can_compose_inline);
+}
+
+} // namespace mojo
diff --git a/ui/platform_window/mojo/ime_type_converters.h b/ui/platform_window/mojo/ime_type_converters.h
new file mode 100644
index 0000000..a55125d
--- /dev/null
+++ b/ui/platform_window/mojo/ime_type_converters.h
@@ -0,0 +1,23 @@
+// Copyright 2015 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 UI_PLATFORM_WINDOW_MOJO_IME_TYPE_CONVERTERS_H_
+#define UI_PLATFORM_WINDOW_MOJO_IME_TYPE_CONVERTERS_H_
+
+#include "ui/base/ime/ime_text_span.h"
+#include "ui/platform_window/mojo/mojo_ime_export.h"
+#include "ui/platform_window/mojo/text_input_state.mojom.h"
+#include "ui/platform_window/text_input_state.h"
+
+namespace mojo {
+
+template <>
+struct MOJO_IME_EXPORT
+ TypeConverter<ui::TextInputState, ui::mojom::TextInputStatePtr> {
+ static ui::TextInputState Convert(const ui::mojom::TextInputStatePtr& input);
+};
+
+} // namespace mojo
+
+#endif // UI_PLATFORM_WINDOW_MOJO_IME_TYPE_CONVERTERS_H_
diff --git a/ui/platform_window/mojo/mojo_ime_export.h b/ui/platform_window/mojo/mojo_ime_export.h
new file mode 100644
index 0000000..e616f25
--- /dev/null
+++ b/ui/platform_window/mojo/mojo_ime_export.h
@@ -0,0 +1,32 @@
+// Copyright 2015 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 UI_PLATFORM_WINDOW_MOJO_MOJO_IME_EXPORT_H_
+#define UI_PLATFORM_WINDOW_MOJO_MOJO_IME_EXPORT_H_
+
+#if defined(COMPONENT_BUILD)
+
+#if defined(WIN32)
+
+#if defined(MOJO_IME_IMPLEMENTATION)
+#define MOJO_IME_EXPORT __declspec(dllexport)
+#else
+#define MOJO_IME_EXPORT __declspec(dllimport)
+#endif
+
+#else // !defined(WIN32)
+
+#if defined(MOJO_IME_IMPLEMENTATION)
+#define MOJO_IME_EXPORT __attribute__((visibility("default")))
+#else
+#define MOJO_IME_EXPORT
+#endif
+
+#endif // defined(WIN32)
+
+#else // !defined(COMPONENT_BUILD)
+#define MOJO_IME_EXPORT
+#endif
+
+#endif // UI_PLATFORM_WINDOW_MOJO_MOJO_IME_EXPORT_H_
diff --git a/ui/platform_window/mojo/text_input_state.mojom b/ui/platform_window/mojo/text_input_state.mojom
new file mode 100644
index 0000000..21767a5
--- /dev/null
+++ b/ui/platform_window/mojo/text_input_state.mojom
@@ -0,0 +1,36 @@
+// Copyright 2015 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.
+
+module ui.mojom;
+
+import "ui/base/ime/mojo/ime_types.mojom";
+
+// Text input info which is based on blink::WebTextInputInfo.
+struct TextInputState {
+ // The type of input field.
+ TextInputType type;
+
+ // The flags of the input field (autocorrect, autocomplete, etc.).
+ int32 flags;
+
+ // The value of the input field.
+ string? text;
+
+ // The cursor position of the current selection start, or the caret position
+ // if nothing is selected.
+ int32 selection_start;
+
+ // The cursor position of the current selection end, or the caret position
+ // if nothing is selected.
+ int32 selection_end;
+
+ // The start position of the current composition, or -1 if there is none.
+ int32 composition_start;
+
+ // The end position of the current composition, or -1 if there is none.
+ int32 composition_end;
+
+ // Whether or not inline composition can be performed for the current input.
+ bool can_compose_inline;
+};