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

Side by Side Diff: chrome/browser/ui/input_method/input_method_engine_base.cc

Issue 2077783002: Make limitations for input.ime.sendKeyEvents API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix chromeos error. Created 4 years, 5 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "chrome/browser/ui/input_method/input_method_engine_base.h" 5 #include "chrome/browser/ui/input_method/input_method_engine_base.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #undef FocusIn 9 #undef FocusIn
10 #undef FocusOut 10 #undef FocusOut
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 KeyboardEvent ext_event; 362 KeyboardEvent ext_event;
363 GetExtensionKeyboardEventFromKeyEvent(key_event, &ext_event); 363 GetExtensionKeyboardEventFromKeyEvent(key_event, &ext_event);
364 364
365 // If the given key event is equal to the key event sent by 365 // If the given key event is equal to the key event sent by
366 // SendKeyEvents, this engine ID is propagated to the extension IME. 366 // SendKeyEvents, this engine ID is propagated to the extension IME.
367 // Note, this check relies on that ui::KeyEvent is propagated as 367 // Note, this check relies on that ui::KeyEvent is propagated as
368 // reference without copying. 368 // reference without copying.
369 if (&key_event == sent_key_event_) 369 if (&key_event == sent_key_event_)
370 ext_event.extension_id = extension_id_; 370 ext_event.extension_id = extension_id_;
371 371
372 observer_->OnKeyEvent(active_component_id_, ext_event, callback); 372 // Should not pass key event in password field.
373 if (current_input_type_ != ui::TEXT_INPUT_TYPE_PASSWORD)
374 observer_->OnKeyEvent(active_component_id_, ext_event, callback);
373 } 375 }
374 376
375 void InputMethodEngineBase::SetSurroundingText(const std::string& text, 377 void InputMethodEngineBase::SetSurroundingText(const std::string& text,
376 uint32_t cursor_pos, 378 uint32_t cursor_pos,
377 uint32_t anchor_pos, 379 uint32_t anchor_pos,
378 uint32_t offset_pos) { 380 uint32_t offset_pos) {
379 observer_->OnSurroundingTextChanged( 381 observer_->OnSurroundingTextChanged(
380 active_component_id_, text, static_cast<int>(cursor_pos), 382 active_component_id_, text, static_cast<int>(cursor_pos),
381 static_cast<int>(anchor_pos), static_cast<int>(offset_pos)); 383 static_cast<int>(anchor_pos), static_cast<int>(offset_pos));
382 } 384 }
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 ui::EventTimeForNow()); 454 ui::EventTimeForNow());
453 base::AutoReset<const ui::KeyEvent*> reset_sent_key(&sent_key_event_, 455 base::AutoReset<const ui::KeyEvent*> reset_sent_key(&sent_key_event_,
454 &ui_event); 456 &ui_event);
455 if (!SendKeyEvent(&ui_event, event.code)) 457 if (!SendKeyEvent(&ui_event, event.code))
456 return false; 458 return false;
457 } 459 }
458 return true; 460 return true;
459 } 461 }
460 462
461 } // namespace input_method 463 } // namespace input_method
OLDNEW
« no previous file with comments | « chrome/browser/ui/input_method/input_method_engine.cc ('k') | chrome/browser/ui/views/ime/input_ime_apitest_nonchromeos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698