summaryrefslogtreecommitdiffstats
path: root/win8/metro_driver/chrome_app_view_ash.cc
diff options
context:
space:
mode:
authoryukawa@chromium.org <yukawa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-05 08:31:40 +0000
committeryukawa@chromium.org <yukawa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-05 08:31:40 +0000
commit69b5d489f120a19375ca4a06321bbf1123e9db76 (patch)
tree0527bb7001765cdf0eaca25d6242de6ca2c78dfa /win8/metro_driver/chrome_app_view_ash.cc
parenta31ecc0d319f9490e67319e6bcabb78341e361a4 (diff)
downloadchromium_src-69b5d489f120a19375ca4a06321bbf1123e9db76.zip
chromium_src-69b5d489f120a19375ca4a06321bbf1123e9db76.tar.gz
chromium_src-69b5d489f120a19375ca4a06321bbf1123e9db76.tar.bz2
Enable basic IME functionality under Ash on Windows
With this CL, IMEs become functional under Ash environment on Windows. Some optional features for Chromium internal use (e.g., IME popup window detection, RTL language detection) will be covered by subsequent CLs. DesignDoc: https://docs.google.com/a/chromium.org/document/d/14TBE0LoamQz_MImcNWzeTIW_lo5EUrLJwNwmCi20V1o/edit# Note: In this CL, ui/base/ime/win/tsf_text_store.* is not moved but copied to win8/metro_driver/ime/text_store.* in order not to break non-Aura build. That said, hereafter we will use win8/metro_driver/ime/text_store.* as primary implementation of TSF TextStore. Anyway, ui/base/ime/win/tsf_text_store.* will be removed when Aura transition is successfully completed. I also found some style issues in win8/metro_driver/ime/text_store.cc but I'd like to fix them in subsequent CLs to keep this CL as minimum as possible. BUG=164964 TEST=manually done on Windows 8.1 Review URL: https://codereview.chromium.org/83233002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@238921 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'win8/metro_driver/chrome_app_view_ash.cc')
-rw-r--r--win8/metro_driver/chrome_app_view_ash.cc54
1 files changed, 54 insertions, 0 deletions
diff --git a/win8/metro_driver/chrome_app_view_ash.cc b/win8/metro_driver/chrome_app_view_ash.cc
index 331ec16..c557bb5 100644
--- a/win8/metro_driver/chrome_app_view_ash.cc
+++ b/win8/metro_driver/chrome_app_view_ash.cc
@@ -24,6 +24,7 @@
#include "ui/events/gestures/gesture_sequence.h"
#include "ui/metro_viewer/metro_viewer_messages.h"
#include "win8/metro_driver/file_picker_ash.h"
+#include "win8/metro_driver/ime/text_service.h"
#include "win8/metro_driver/metro_driver.h"
#include "win8/metro_driver/winrt_utils.h"
#include "win8/viewer/metro_viewer_constants.h"
@@ -164,6 +165,10 @@ class ChromeChannelListener : public IPC::Listener {
IPC_MESSAGE_HANDLER(MetroViewerHostMsg_DisplaySelectFolder,
OnDisplayFolderPicker)
IPC_MESSAGE_HANDLER(MetroViewerHostMsg_SetCursorPos, OnSetCursorPos)
+ IPC_MESSAGE_HANDLER(MetroViewerHostMsg_ImeCancelComposition,
+ OnImeCancelComposition)
+ IPC_MESSAGE_HANDLER(MetroViewerHostMsg_ImeTextInputClientUpdated,
+ OnImeTextInputClientChanged)
IPC_MESSAGE_UNHANDLED(__debugbreak())
IPC_END_MESSAGE_MAP()
return true;
@@ -241,6 +246,23 @@ class ChromeChannelListener : public IPC::Listener {
x, y));
}
+ void OnImeCancelComposition() {
+ ui_proxy_->PostTask(
+ FROM_HERE,
+ base::Bind(&ChromeAppViewAsh::OnImeCancelComposition,
+ base::Unretained(app_view_)));
+ }
+
+ void OnImeTextInputClientChanged(
+ const std::vector<int32>& input_scopes,
+ const std::vector<metro_viewer::CharacterBounds>& character_bounds) {
+ ui_proxy_->PostTask(
+ FROM_HERE,
+ base::Bind(&ChromeAppViewAsh::OnImeUpdateTextInputClient,
+ base::Unretained(app_view_),
+ input_scopes,
+ character_bounds));
+ }
scoped_refptr<base::MessageLoopProxy> ui_proxy_;
ChromeAppViewAsh* app_view_;
@@ -472,6 +494,8 @@ ChromeAppViewAsh::SetWindow(winui::Core::ICoreWindow* window) {
hr = interop->get_WindowHandle(&core_window_hwnd_);
CheckHR(hr);
+ text_service_ = metro_driver::CreateTextService(this, core_window_hwnd_);
+
hr = window_->add_SizeChanged(mswr::Callback<SizeChangedHandler>(
this, &ChromeAppViewAsh::OnSizeChanged).Get(),
&sizechange_token_);
@@ -619,6 +643,7 @@ ChromeAppViewAsh::Run() {
IFACEMETHODIMP
ChromeAppViewAsh::Uninitialize() {
DVLOG(1) << __FUNCTION__;
+ text_service_.reset();
window_ = nullptr;
view_ = nullptr;
core_window_hwnd_ = NULL;
@@ -787,6 +812,33 @@ void ChromeAppViewAsh::OnFolderPickerCompleted(
delete folder_picker;
}
+void ChromeAppViewAsh::OnImeCancelComposition() {
+ if (!text_service_)
+ return;
+ text_service_->CancelComposition();
+}
+
+void ChromeAppViewAsh::OnImeUpdateTextInputClient(
+ const std::vector<int32>& input_scopes,
+ const std::vector<metro_viewer::CharacterBounds>& character_bounds) {
+ if (!text_service_)
+ return;
+ text_service_->OnDocumentChanged(input_scopes, character_bounds);
+}
+
+void ChromeAppViewAsh::OnCompositionChanged(
+ const string16& text,
+ int32 selection_start,
+ int32 selection_end,
+ const std::vector<metro_viewer::UnderlineInfo>& underlines) {
+ ui_channel_->Send(new MetroViewerHostMsg_ImeCompositionChanged(
+ text, selection_start, selection_end, underlines));
+}
+
+void ChromeAppViewAsh::OnTextCommitted(const string16& text) {
+ ui_channel_->Send(new MetroViewerHostMsg_ImeTextCommitted(text));
+}
+
HRESULT ChromeAppViewAsh::OnActivate(
winapp::Core::ICoreApplicationView*,
winapp::Activation::IActivatedEventArgs* args) {
@@ -1033,6 +1085,8 @@ HRESULT ChromeAppViewAsh::OnWindowActivated(
// clicked back in Ash after using another app on another monitor) the same.
if (state == winui::Core::CoreWindowActivationState_CodeActivated ||
state == winui::Core::CoreWindowActivationState_PointerActivated) {
+ if (text_service_)
+ text_service_->OnWindowActivated();
ui_channel_->Send(new MetroViewerHostMsg_WindowActivated());
}
return S_OK;