OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ui/base/ime/remote_input_method_win.h" | 5 #include "ui/base/ime/remote_input_method_win.h" |
6 | 6 |
7 #include "base/observer_list.h" | 7 #include "base/observer_list.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "ui/base/ime/input_method.h" | 9 #include "ui/base/ime/input_method.h" |
10 #include "ui/base/ime/input_method_delegate.h" | 10 #include "ui/base/ime/input_method_delegate.h" |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 } | 139 } |
140 | 140 |
141 virtual void OnBlur() OVERRIDE { | 141 virtual void OnBlur() OVERRIDE { |
142 FOR_EACH_OBSERVER(InputMethodObserver, | 142 FOR_EACH_OBSERVER(InputMethodObserver, |
143 observer_list_, | 143 observer_list_, |
144 OnBlur()); | 144 OnBlur()); |
145 } | 145 } |
146 | 146 |
147 virtual bool OnUntranslatedIMEMessage(const base::NativeEvent& event, | 147 virtual bool OnUntranslatedIMEMessage(const base::NativeEvent& event, |
148 NativeEventResult* result) OVERRIDE { | 148 NativeEventResult* result) OVERRIDE { |
149 FOR_EACH_OBSERVER(InputMethodObserver, | |
150 observer_list_, | |
151 OnUntranslatedIMEMessage(event)); | |
152 return false; | 149 return false; |
153 } | 150 } |
154 | 151 |
155 virtual void SetFocusedTextInputClient(TextInputClient* client) OVERRIDE { | 152 virtual void SetFocusedTextInputClient(TextInputClient* client) OVERRIDE { |
156 std::vector<int32> prev_input_scopes; | 153 std::vector<int32> prev_input_scopes; |
157 std::swap(input_scopes_, prev_input_scopes); | 154 std::swap(input_scopes_, prev_input_scopes); |
158 std::vector<gfx::Rect> prev_bounds; | 155 std::vector<gfx::Rect> prev_bounds; |
159 std::swap(composition_character_bounds_, prev_bounds); | 156 std::swap(composition_character_bounds_, prev_bounds); |
160 if (client) { | 157 if (client) { |
161 input_scopes_ = GetInputScopesAsInt(client->GetTextInputType(), | 158 input_scopes_ = GetInputScopesAsInt(client->GetTextInputType(), |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 observer_list_, | 251 observer_list_, |
255 OnCaretBoundsChanged(client)); | 252 OnCaretBoundsChanged(client)); |
256 } | 253 } |
257 | 254 |
258 virtual void CancelComposition(const TextInputClient* client) OVERRIDE { | 255 virtual void CancelComposition(const TextInputClient* client) OVERRIDE { |
259 if (CanSendRemoteNotification(client)) | 256 if (CanSendRemoteNotification(client)) |
260 remote_delegate_->CancelComposition(); | 257 remote_delegate_->CancelComposition(); |
261 } | 258 } |
262 | 259 |
263 virtual void OnInputLocaleChanged() OVERRIDE { | 260 virtual void OnInputLocaleChanged() OVERRIDE { |
264 FOR_EACH_OBSERVER(InputMethodObserver, | |
265 observer_list_, | |
266 OnInputLocaleChanged()); | |
267 } | 261 } |
268 | 262 |
269 virtual std::string GetInputLocale() OVERRIDE { | 263 virtual std::string GetInputLocale() OVERRIDE { |
270 const LCID locale_id = MAKELCID(langid_, SORT_DEFAULT); | 264 const LCID locale_id = MAKELCID(langid_, SORT_DEFAULT); |
271 std::string language = | 265 std::string language = |
272 GetLocaleString(locale_id, LOCALE_SISO639LANGNAME); | 266 GetLocaleString(locale_id, LOCALE_SISO639LANGNAME); |
273 if (SUBLANGID(langid_) == SUBLANG_NEUTRAL || language.empty()) | 267 if (SUBLANGID(langid_) == SUBLANG_NEUTRAL || language.empty()) |
274 return language; | 268 return language; |
275 const std::string& region = | 269 const std::string& region = |
276 GetLocaleString(locale_id, LOCALE_SISO3166CTRYNAME); | 270 GetLocaleString(locale_id, LOCALE_SISO3166CTRYNAME); |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 return scoped_ptr<InputMethod>(new RemoteInputMethodWin(delegate)); | 374 return scoped_ptr<InputMethod>(new RemoteInputMethodWin(delegate)); |
381 } | 375 } |
382 | 376 |
383 // static | 377 // static |
384 RemoteInputMethodPrivateWin* RemoteInputMethodPrivateWin::Get( | 378 RemoteInputMethodPrivateWin* RemoteInputMethodPrivateWin::Get( |
385 InputMethod* input_method) { | 379 InputMethod* input_method) { |
386 return GetPrivate(input_method); | 380 return GetPrivate(input_method); |
387 } | 381 } |
388 | 382 |
389 } // namespace ui | 383 } // namespace ui |
OLD | NEW |