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

Side by Side Diff: ui/base/ime/remote_input_method_win.cc

Issue 1566083002: Makes sure the keyboard typing isn't blocked when InputMethod::OnFocus() is not correctly called. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: compiled. Created 4 years, 11 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 unified diff | Download patch
OLDNEW
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 <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/observer_list.h" 12 #include "base/observer_list.h"
13 #include "base/strings/utf_string_conversions.h" 13 #include "base/strings/utf_string_conversions.h"
14 #include "base/win/metro.h" 14 #include "base/win/metro.h"
15 #include "base/win/scoped_handle.h" 15 #include "base/win/scoped_handle.h"
16 #include "ui/base/ime/input_method.h" 16 #include "ui/base/ime/input_method.h"
17 #include "ui/base/ime/input_method_delegate.h" 17 #include "ui/base/ime/input_method_delegate.h"
18 #include "ui/base/ime/input_method_log_collector.h"
18 #include "ui/base/ime/input_method_observer.h" 19 #include "ui/base/ime/input_method_observer.h"
19 #include "ui/base/ime/remote_input_method_delegate_win.h" 20 #include "ui/base/ime/remote_input_method_delegate_win.h"
20 #include "ui/base/ime/text_input_client.h" 21 #include "ui/base/ime/text_input_client.h"
21 #include "ui/base/ime/win/tsf_input_scope.h" 22 #include "ui/base/ime/win/tsf_input_scope.h"
22 #include "ui/base/ui_base_switches.h" 23 #include "ui/base/ui_base_switches.h"
23 #include "ui/events/event.h" 24 #include "ui/events/event.h"
24 #include "ui/events/event_utils.h" 25 #include "ui/events/event_utils.h"
25 #include "ui/gfx/geometry/rect.h" 26 #include "ui/gfx/geometry/rect.h"
26 27
27 namespace ui { 28 namespace ui {
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 115
115 class RemoteInputMethodWin : public InputMethod, 116 class RemoteInputMethodWin : public InputMethod,
116 public RemoteInputMethodPrivateWin { 117 public RemoteInputMethodPrivateWin {
117 public: 118 public:
118 explicit RemoteInputMethodWin(internal::InputMethodDelegate* delegate) 119 explicit RemoteInputMethodWin(internal::InputMethodDelegate* delegate)
119 : delegate_(delegate), 120 : delegate_(delegate),
120 remote_delegate_(NULL), 121 remote_delegate_(NULL),
121 text_input_client_(NULL), 122 text_input_client_(NULL),
122 is_candidate_popup_open_(false), 123 is_candidate_popup_open_(false),
123 is_ime_(false), 124 is_ime_(false),
124 langid_(kFallbackLangID) { 125 langid_(kFallbackLangID),
126 log_collector_(new InputMethodLogCollector()) {
125 RegisterInstance(this, this); 127 RegisterInstance(this, this);
126 } 128 }
127 129
128 ~RemoteInputMethodWin() override { 130 ~RemoteInputMethodWin() override {
129 FOR_EACH_OBSERVER(InputMethodObserver, 131 FOR_EACH_OBSERVER(InputMethodObserver,
130 observer_list_, 132 observer_list_,
131 OnInputMethodDestroyed(this)); 133 OnInputMethodDestroyed(this));
132 UnregisterInstance(this); 134 UnregisterInstance(this);
133 } 135 }
134 136
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 for (size_t i = 0; i < text.size(); ++i) { 325 for (size_t i = 0; i < text.size(); ++i) {
324 ui::KeyEvent char_event(text[i], static_cast<ui::KeyboardCode>(text[i]), 326 ui::KeyEvent char_event(text[i], static_cast<ui::KeyboardCode>(text[i]),
325 ui::EF_NONE); 327 ui::EF_NONE);
326 text_input_client_->InsertChar(char_event); 328 text_input_client_->InsertChar(char_event);
327 } 329 }
328 return; 330 return;
329 } 331 }
330 text_input_client_->InsertText(text); 332 text_input_client_->InsertText(text);
331 } 333 }
332 334
335 InputMethodLogCollector* GetLogCollector() override {
336 return log_collector_.get();
337 }
338
333 bool CanSendRemoteNotification( 339 bool CanSendRemoteNotification(
334 const TextInputClient* text_input_client) const { 340 const TextInputClient* text_input_client) const {
335 return text_input_client_ && 341 return text_input_client_ &&
336 text_input_client_ == text_input_client && 342 text_input_client_ == text_input_client &&
337 remote_delegate_; 343 remote_delegate_;
338 } 344 }
339 345
340 base::ObserverList<InputMethodObserver> observer_list_; 346 base::ObserverList<InputMethodObserver> observer_list_;
341 347
342 internal::InputMethodDelegate* delegate_; 348 internal::InputMethodDelegate* delegate_;
343 internal::RemoteInputMethodDelegateWin* remote_delegate_; 349 internal::RemoteInputMethodDelegateWin* remote_delegate_;
344 350
345 TextInputClient* text_input_client_; 351 TextInputClient* text_input_client_;
346 std::vector<int32_t> input_scopes_; 352 std::vector<int32_t> input_scopes_;
347 std::vector<gfx::Rect> composition_character_bounds_; 353 std::vector<gfx::Rect> composition_character_bounds_;
348 bool is_candidate_popup_open_; 354 bool is_candidate_popup_open_;
349 bool is_ime_; 355 bool is_ime_;
350 LANGID langid_; 356 LANGID langid_;
357 scoped_ptr<InputMethodLogCollector> log_collector_;
351 358
352 DISALLOW_COPY_AND_ASSIGN(RemoteInputMethodWin); 359 DISALLOW_COPY_AND_ASSIGN(RemoteInputMethodWin);
353 }; 360 };
354 361
355 } // namespace 362 } // namespace
356 363
357 bool IsRemoteInputMethodWinRequired(gfx::AcceleratedWidget widget) { 364 bool IsRemoteInputMethodWinRequired(gfx::AcceleratedWidget widget) {
358 // If the remote input method is already registered then don't do it again. 365 // If the remote input method is already registered then don't do it again.
359 if (ui::g_public_interface_ && ui::g_private_interface_) 366 if (ui::g_public_interface_ && ui::g_private_interface_)
360 return false; 367 return false;
(...skipping 17 matching lines...) Expand all
378 return make_scoped_ptr(new RemoteInputMethodWin(delegate)); 385 return make_scoped_ptr(new RemoteInputMethodWin(delegate));
379 } 386 }
380 387
381 // static 388 // static
382 RemoteInputMethodPrivateWin* RemoteInputMethodPrivateWin::Get( 389 RemoteInputMethodPrivateWin* RemoteInputMethodPrivateWin::Get(
383 InputMethod* input_method) { 390 InputMethod* input_method) {
384 return GetPrivate(input_method); 391 return GetPrivate(input_method);
385 } 392 }
386 393
387 } // namespace ui 394 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698