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

Unified Diff: content/browser/frame_host/input/legacy_ipc_frame_input_handler.cc

Issue 2884243003: Add a mojo channel for frame messages. (Closed)
Patch Set: 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
Index: content/browser/frame_host/input/legacy_ipc_frame_input_handler.cc
diff --git a/content/browser/frame_host/input/legacy_ipc_frame_input_handler.cc b/content/browser/frame_host/input/legacy_ipc_frame_input_handler.cc
new file mode 100644
index 0000000000000000000000000000000000000000..e195afbf4f6ff764087e64f713544e93bfe8dedc
--- /dev/null
+++ b/content/browser/frame_host/input/legacy_ipc_frame_input_handler.cc
@@ -0,0 +1,148 @@
+// 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.
+
+#include "content/browser/frame_host/input/legacy_ipc_frame_input_handler.h"
+
+#include "base/strings/utf_string_conversions.h"
+#include "content/browser/renderer_host/render_widget_host_impl.h"
+#include "content/common/input_messages.h"
+
+namespace content {
+
+LegacyIPCFrameInputHandler::LegacyIPCFrameInputHandler(
+ RenderFrameHostImpl* frame_host,
+ int routing_id)
+ : frame_host_(frame_host), routing_id_(routing_id) {
+ DCHECK(frame_host);
+}
+
+LegacyIPCFrameInputHandler::~LegacyIPCFrameInputHandler() {}
+
+void LegacyIPCFrameInputHandler::SetCompositionFromExistingText(
+ int32_t start,
+ int32_t end,
+ const std::vector<ui::CompositionUnderline>& ui_underlines) {
+ std::vector<blink::WebCompositionUnderline> underlines;
+ for (const auto& underline : ui_underlines) {
+ blink::WebCompositionUnderline blink_underline(
+ underline.start_offset, underline.end_offset, underline.color,
+ underline.thick, underline.background_color);
+ underlines.push_back(blink_underline);
+ }
+
+ SendInput(base::WrapUnique(new InputMsg_SetCompositionFromExistingText(
dcheng 2017/05/17 04:49:06 General nit: writing base::MakeUnique<T>(...) is p
dtapuska 2017/05/17 17:08:07 Done.
+ routing_id_, start, end, underlines)));
+}
+
+void LegacyIPCFrameInputHandler::ExtendSelectionAndDelete(int32_t before,
+ int32_t after) {
+ SendInput(base::WrapUnique(
+ new InputMsg_ExtendSelectionAndDelete(routing_id_, before, after)));
+}
+
+void LegacyIPCFrameInputHandler::DeleteSurroundingText(int32_t before,
+ int32_t after) {
+ SendInput(base::WrapUnique(
+ new InputMsg_DeleteSurroundingText(routing_id_, before, after)));
+}
+
+void LegacyIPCFrameInputHandler::DeleteSurroundingTextInCodePoints(
+ int32_t before,
+ int32_t after) {
+ SendInput(base::WrapUnique(new InputMsg_DeleteSurroundingTextInCodePoints(
+ routing_id_, before, after)));
+}
+
+void LegacyIPCFrameInputHandler::SetEditableSelectionOffsets(int32_t start,
+ int32_t end) {
+ SendInput(base::WrapUnique(
+ new InputMsg_SetEditableSelectionOffsets(routing_id_, start, end)));
+}
+
+void LegacyIPCFrameInputHandler::ExecuteEditCommand(
+ const std::string& command,
+ const base::Optional<std::string>& value) {
+ if (!value.has_value()) {
dcheng 2017/05/17 04:49:06 Nit: this could be written as !value
dtapuska 2017/05/17 17:08:07 Done.
+ SendInput(base::WrapUnique(
+ new InputMsg_ExecuteNoValueEditCommand(routing_id_, command)));
+ }
+}
+
+void LegacyIPCFrameInputHandler::Undo() {
+ SendInput(base::WrapUnique(new InputMsg_Undo(routing_id_)));
+}
+
+void LegacyIPCFrameInputHandler::Redo() {
+ SendInput(base::WrapUnique(new InputMsg_Redo(routing_id_)));
+}
+
+void LegacyIPCFrameInputHandler::Cut() {
+ SendInput(base::WrapUnique(new InputMsg_Cut(routing_id_)));
+}
+
+void LegacyIPCFrameInputHandler::Copy() {
+ SendInput(base::WrapUnique(new InputMsg_Copy(routing_id_)));
+}
+
+void LegacyIPCFrameInputHandler::CopyToFindPboard() {
+#if defined(OS_MACOSX)
+ SendInput(base::WrapUnique(new InputMsg_CopyToFindPboard(routing_id_)));
+#endif
+}
+
+void LegacyIPCFrameInputHandler::Paste() {
+ SendInput(base::WrapUnique(new InputMsg_Paste(routing_id_)));
+}
+
+void LegacyIPCFrameInputHandler::PasteAndMatchStyle() {
+ SendInput(base::WrapUnique(new InputMsg_PasteAndMatchStyle(routing_id_)));
+}
+
+void LegacyIPCFrameInputHandler::Replace(const std::string& word) {
+ SendInput(base::WrapUnique(
+ new InputMsg_Replace(routing_id_, base::UTF8ToUTF16(word))));
+}
+
+void LegacyIPCFrameInputHandler::ReplaceMisspelling(const std::string& word) {
+ SendInput(base::WrapUnique(
+ new InputMsg_ReplaceMisspelling(routing_id_, base::UTF8ToUTF16(word))));
+}
+
+void LegacyIPCFrameInputHandler::Delete() {
+ SendInput(base::WrapUnique(new InputMsg_Delete(routing_id_)));
+}
+
+void LegacyIPCFrameInputHandler::SelectAll() {
+ SendInput(base::WrapUnique(new InputMsg_SelectAll(routing_id_)));
+}
+
+void LegacyIPCFrameInputHandler::CollapseSelection() {
+ SendInput(base::WrapUnique(new InputMsg_CollapseSelection(routing_id_)));
+}
+
+void LegacyIPCFrameInputHandler::SelectRange(const gfx::Point& point,
+ const gfx::Point& extent) {
+ SendInput(
+ base::WrapUnique(new InputMsg_SelectRange(routing_id_, point, extent)));
+}
+
+void LegacyIPCFrameInputHandler::AdjustSelectionByCharacterOffset(int32_t start,
+ int32_t end) {
+ SendInput(base::WrapUnique(
+ new InputMsg_AdjustSelectionByCharacterOffset(routing_id_, start, end)));
+}
+
+void LegacyIPCFrameInputHandler::MoveRangeSelectionExtent(
+ const gfx::Point& extent) {
+ SendInput(base::WrapUnique(
+ new InputMsg_MoveRangeSelectionExtent(routing_id_, extent)));
+}
+
+void LegacyIPCFrameInputHandler::SendInput(
+ std::unique_ptr<IPC::Message> message) {
+ frame_host_->GetRenderWidgetHost()->input_router()->SendInput(
+ std::move(message));
+}
+
+} // namespace content

Powered by Google App Engine
This is Rietveld 408576698