| Index: ui/aura/remote_root_window_host_win.cc
|
| diff --git a/ui/aura/remote_root_window_host_win.cc b/ui/aura/remote_root_window_host_win.cc
|
| index 6084885e1d327c477ace838bdb9055a0c918bf1d..f5bb17cc469e698d1177a55906840676dcb657a0 100644
|
| --- a/ui/aura/remote_root_window_host_win.cc
|
| +++ b/ui/aura/remote_root_window_host_win.cc
|
| @@ -11,9 +11,15 @@
|
| #include "base/message_loop/message_loop.h"
|
| #include "ipc/ipc_message.h"
|
| #include "ipc/ipc_sender.h"
|
| +#include "ui/aura/client/aura_constants.h"
|
| #include "ui/aura/client/cursor_client.h"
|
| #include "ui/aura/root_window.h"
|
| +#include "ui/aura/window_property.h"
|
| #include "ui/base/cursor/cursor_loader_win.h"
|
| +#include "ui/base/ime/composition_text.h"
|
| +#include "ui/base/ime/input_method.h"
|
| +#include "ui/base/ime/remote_input_method_win.h"
|
| +#include "ui/base/ime/text_input_client.h"
|
| #include "ui/events/event_utils.h"
|
| #include "ui/events/keycodes/keyboard_code_conversion_win.h"
|
| #include "ui/base/view_prop.h"
|
| @@ -54,6 +60,25 @@ void SetVirtualKeyStates(uint32 flags) {
|
| ::SetKeyboardState(keyboard_state);
|
| }
|
|
|
| +void FillCompositionText(
|
| + const string16& text,
|
| + int32 selection_start,
|
| + int32 selection_end,
|
| + const std::vector<metro_viewer::UnderlineInfo>& underlines,
|
| + ui::CompositionText* composition_text) {
|
| + composition_text->Clear();
|
| + composition_text->text = text;
|
| + composition_text->selection.set_start(selection_start);
|
| + composition_text->selection.set_end(selection_end);
|
| + composition_text->underlines.resize(underlines.size());
|
| + for (size_t i = 0; i < underlines.size(); ++i) {
|
| + composition_text->underlines[i].start_offset = underlines[i].start_offset;
|
| + composition_text->underlines[i].end_offset = underlines[i].end_offset;
|
| + composition_text->underlines[i].color = SK_ColorBLACK;
|
| + composition_text->underlines[i].thick = underlines[i].thick;
|
| + }
|
| +}
|
| +
|
| } // namespace
|
|
|
| void HandleOpenFile(const base::string16& title,
|
| @@ -151,6 +176,10 @@ void RemoteRootWindowHostWin::Connected(IPC::Sender* host, HWND remote_window) {
|
| void RemoteRootWindowHostWin::Disconnected() {
|
| // Don't CHECK here, Disconnected is called on a channel error which can
|
| // happen before we're successfully Connected.
|
| + ui::RemoteInputMethodPrivateWin* remote_input_method_private =
|
| + GetRemoteInputMethodPrivate();
|
| + if (remote_input_method_private)
|
| + remote_input_method_private->SetRemoteDelegate(NULL);
|
| host_ = NULL;
|
| remote_window_ = NULL;
|
| }
|
| @@ -185,6 +214,10 @@ bool RemoteRootWindowHostWin::OnMessageReceived(const IPC::Message& message) {
|
| OnWindowSizeChanged)
|
| IPC_MESSAGE_HANDLER(MetroViewerHostMsg_ActivateDesktopDone,
|
| OnDesktopActivated)
|
| + IPC_MESSAGE_HANDLER(MetroViewerHostMsg_ImeCompositionChanged,
|
| + OnImeCompositionChanged)
|
| + IPC_MESSAGE_HANDLER(MetroViewerHostMsg_ImeTextCommitted,
|
| + OnImeTextCommitted)
|
| IPC_MESSAGE_UNHANDLED(handled = false)
|
| IPC_END_MESSAGE_MAP()
|
| return handled;
|
| @@ -314,6 +347,10 @@ gfx::AcceleratedWidget RemoteRootWindowHostWin::GetAcceleratedWidget() {
|
| }
|
|
|
| void RemoteRootWindowHostWin::Show() {
|
| + ui::RemoteInputMethodPrivateWin* remote_input_method_private =
|
| + GetRemoteInputMethodPrivate();
|
| + if (remote_input_method_private)
|
| + remote_input_method_private->SetRemoteDelegate(this);
|
| }
|
|
|
| void RemoteRootWindowHostWin::Hide() {
|
| @@ -418,6 +455,27 @@ void RemoteRootWindowHostWin::OnDeviceScaleFactorChanged(
|
| void RemoteRootWindowHostWin::PrepareForShutdown() {
|
| }
|
|
|
| +void RemoteRootWindowHostWin::CancelComposition() {
|
| + host_->Send(new MetroViewerHostMsg_ImeCancelComposition);
|
| +}
|
| +
|
| +void RemoteRootWindowHostWin::OnTextInputClientUpdated(
|
| + const std::vector<int32>& input_scopes,
|
| + const std::vector<gfx::Rect>& composition_character_bounds) {
|
| + std::vector<metro_viewer::CharacterBounds> character_bounds;
|
| + for (size_t i = 0; i < composition_character_bounds.size(); ++i) {
|
| + const gfx::Rect& rect = composition_character_bounds[i];
|
| + metro_viewer::CharacterBounds bounds;
|
| + bounds.left = rect.x();
|
| + bounds.top = rect.y();
|
| + bounds.right = rect.right();
|
| + bounds.bottom = rect.bottom();
|
| + character_bounds.push_back(bounds);
|
| + }
|
| + host_->Send(new MetroViewerHostMsg_ImeTextInputClientUpdated(
|
| + input_scopes, character_bounds));
|
| +}
|
| +
|
| void RemoteRootWindowHostWin::OnMouseMoved(int32 x, int32 y, int32 flags) {
|
| if (ignore_mouse_moves_until_set_cursor_ack_)
|
| return;
|
| @@ -581,6 +639,36 @@ void RemoteRootWindowHostWin::OnDesktopActivated() {
|
| temp.Run();
|
| }
|
|
|
| +ui::RemoteInputMethodPrivateWin*
|
| +RemoteRootWindowHostWin::GetRemoteInputMethodPrivate() {
|
| + ui::InputMethod* input_method = GetAshWindow()->GetProperty(
|
| + aura::client::kRootWindowInputMethodKey);
|
| + return ui::RemoteInputMethodPrivateWin::Get(input_method);
|
| +}
|
| +
|
| +void RemoteRootWindowHostWin::OnImeCompositionChanged(
|
| + const string16& text,
|
| + int32 selection_start,
|
| + int32 selection_end,
|
| + const std::vector<metro_viewer::UnderlineInfo>& underlines) {
|
| + ui::RemoteInputMethodPrivateWin* remote_input_method_private =
|
| + GetRemoteInputMethodPrivate();
|
| + if (!remote_input_method_private)
|
| + return;
|
| + ui::CompositionText composition_text;
|
| + FillCompositionText(
|
| + text, selection_start, selection_end, underlines, &composition_text);
|
| + remote_input_method_private->OnCompositionChanged(composition_text);
|
| +}
|
| +
|
| +void RemoteRootWindowHostWin::OnImeTextCommitted(const string16& text) {
|
| + ui::RemoteInputMethodPrivateWin* remote_input_method_private =
|
| + GetRemoteInputMethodPrivate();
|
| + if (!remote_input_method_private)
|
| + return;
|
| + remote_input_method_private->OnTextCommitted(text);
|
| +}
|
| +
|
| void RemoteRootWindowHostWin::DispatchKeyboardMessage(ui::EventType type,
|
| uint32 vkey,
|
| uint32 repeat_count,
|
|
|