| 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..b34e9f6f86ee2b15c198a56ee80d228ca6193207 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"
|
| @@ -151,6 +157,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 +195,14 @@ bool RemoteRootWindowHostWin::OnMessageReceived(const IPC::Message& message) {
|
| OnWindowSizeChanged)
|
| IPC_MESSAGE_HANDLER(MetroViewerHostMsg_ActivateDesktopDone,
|
| OnDesktopActivated)
|
| + IPC_MESSAGE_HANDLER(MetroViewerHostMsg_ImeCandidatePopupChanged,
|
| + OnImeCandidatePopupChanged)
|
| + IPC_MESSAGE_HANDLER(MetroViewerHostMsg_ImeCompositionChanged,
|
| + OnImeCompositionChanged)
|
| + IPC_MESSAGE_HANDLER(MetroViewerHostMsg_ImeTextCommitted,
|
| + OnImeTextCommitted)
|
| + IPC_MESSAGE_HANDLER(MetroViewerHostMsg_ImeInputSourceChanged,
|
| + OnImeInputSourceChanged)
|
| IPC_MESSAGE_UNHANDLED(handled = false)
|
| IPC_END_MESSAGE_MAP()
|
| return handled;
|
| @@ -314,6 +332,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 +440,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 +624,67 @@ 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::OnImeCandidatePopupChanged(bool visible) {
|
| + ui::RemoteInputMethodPrivateWin* remote_input_method_private =
|
| + GetRemoteInputMethodPrivate();
|
| + if (remote_input_method_private)
|
| + remote_input_method_private->OnCandidatePopupChanged(visible);
|
| +}
|
| +
|
| +void RemoteRootWindowHostWin::OnImeCompositionChanged(
|
| + const string16& text,
|
| + int32 selection_start,
|
| + int32 selection_end,
|
| + const std::vector<metro_viewer::UnderlineInfo>& underlines) {
|
| + ui::InputMethod* input_method = GetAshWindow()->GetProperty(
|
| + aura::client::kRootWindowInputMethodKey);
|
| + if (!input_method)
|
| + return;
|
| + ui::TextInputClient* text_input_client = input_method->GetTextInputClient();
|
| + if (!text_input_client)
|
| + return;
|
| + ui::CompositionText composition_text;
|
| + composition_text.text = text;
|
| + composition_text.selection.set_start(selection_start);
|
| + composition_text.selection.set_end(selection_end);
|
| + composition_text.underlines.reserve(underlines.size());
|
| + for (size_t i = 0; i < underlines.size(); ++i) {
|
| + ui::CompositionUnderline underline;
|
| + underline.start_offset = underlines[i].start_offset;
|
| + underline.end_offset = underlines[i].end_offset;
|
| + underline.color = SK_ColorBLACK;
|
| + underline.thick = underlines[i].thick;
|
| + composition_text.underlines.push_back(underline);
|
| + }
|
| + text_input_client->SetCompositionText(composition_text);
|
| +}
|
| +
|
| +void RemoteRootWindowHostWin::OnImeTextCommitted(const string16& text) {
|
| + ui::InputMethod* input_method = GetAshWindow()->GetProperty(
|
| + aura::client::kRootWindowInputMethodKey);
|
| + if (!input_method)
|
| + return;
|
| + ui::TextInputClient* text_input_client = input_method->GetTextInputClient();
|
| + if (!text_input_client)
|
| + return;
|
| + text_input_client->InsertText(text);
|
| +}
|
| +
|
| +void RemoteRootWindowHostWin::OnImeInputSourceChanged(uint16 language_id,
|
| + bool is_ime) {
|
| + ui::RemoteInputMethodPrivateWin* remote_input_method_private =
|
| + GetRemoteInputMethodPrivate();
|
| + if (remote_input_method_private)
|
| + remote_input_method_private->OnInputSourceChanged(language_id, is_ime);
|
| +}
|
| +
|
| void RemoteRootWindowHostWin::DispatchKeyboardMessage(ui::EventType type,
|
| uint32 vkey,
|
| uint32 repeat_count,
|
|
|