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

Side by Side Diff: chrome/browser/chromeos/input_method/input_method_engine.cc

Issue 1547093002: Switch to standard integer types in chrome/browser/chromeos/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 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 "chrome/browser/chromeos/input_method/input_method_engine.h" 5 #include "chrome/browser/chromeos/input_method/input_method_engine.h"
6 6
7 #undef FocusIn 7 #undef FocusIn
8 #undef FocusOut 8 #undef FocusOut
9 #undef RootWindow 9 #undef RootWindow
10 #include <map> 10 #include <map>
(...skipping 30 matching lines...) Expand all
41 namespace chromeos { 41 namespace chromeos {
42 42
43 namespace { 43 namespace {
44 44
45 const char kErrorNotActive[] = "IME is not active"; 45 const char kErrorNotActive[] = "IME is not active";
46 const char kErrorWrongContext[] = "Context is not active"; 46 const char kErrorWrongContext[] = "Context is not active";
47 const char kCandidateNotFound[] = "Candidate not found"; 47 const char kCandidateNotFound[] = "Candidate not found";
48 48
49 // Notifies InputContextHandler that the composition is changed. 49 // Notifies InputContextHandler that the composition is changed.
50 void UpdateComposition(const ui::CompositionText& composition_text, 50 void UpdateComposition(const ui::CompositionText& composition_text,
51 uint32 cursor_pos, 51 uint32_t cursor_pos,
52 bool is_visible) { 52 bool is_visible) {
53 ui::IMEInputContextHandlerInterface* input_context = 53 ui::IMEInputContextHandlerInterface* input_context =
54 ui::IMEBridge::Get()->GetInputContextHandler(); 54 ui::IMEBridge::Get()->GetInputContextHandler();
55 if (input_context) 55 if (input_context)
56 input_context->UpdateCompositionText(composition_text, cursor_pos, 56 input_context->UpdateCompositionText(composition_text, cursor_pos,
57 is_visible); 57 is_visible);
58 } 58 }
59 59
60 // Returns the length of characters of a UTF-8 string with unknown string 60 // Returns the length of characters of a UTF-8 string with unknown string
61 // length. Cannot apply faster algorithm to count characters in an utf-8 61 // length. Cannot apply faster algorithm to count characters in an utf-8
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 return "AudioVolumeMute"; 113 return "AudioVolumeMute";
114 case ui::VKEY_VOLUME_DOWN: 114 case ui::VKEY_VOLUME_DOWN:
115 case ui::VKEY_F9: 115 case ui::VKEY_F9:
116 return "AudioVolumeDown"; 116 return "AudioVolumeDown";
117 case ui::VKEY_VOLUME_UP: 117 case ui::VKEY_VOLUME_UP:
118 case ui::VKEY_F10: 118 case ui::VKEY_F10:
119 return "AudioVolumeUp"; 119 return "AudioVolumeUp";
120 default: 120 default:
121 break; 121 break;
122 } 122 }
123 uint16 ch = 0; 123 uint16_t ch = 0;
124 // Ctrl+? cases, gets key value for Ctrl is not down. 124 // Ctrl+? cases, gets key value for Ctrl is not down.
125 if (event.flags() & ui::EF_CONTROL_DOWN) { 125 if (event.flags() & ui::EF_CONTROL_DOWN) {
126 ui::KeyEvent event_no_ctrl(event.type(), event.key_code(), 126 ui::KeyEvent event_no_ctrl(event.type(), event.key_code(),
127 event.flags() ^ ui::EF_CONTROL_DOWN); 127 event.flags() ^ ui::EF_CONTROL_DOWN);
128 ch = event_no_ctrl.GetCharacter(); 128 ch = event_no_ctrl.GetCharacter();
129 } else { 129 } else {
130 ch = event.GetCharacter(); 130 ch = event.GetCharacter();
131 } 131 }
132 return base::UTF16ToUTF8(base::string16(1, ch)); 132 return base::UTF16ToUTF8(base::string16(1, ch));
133 } 133 }
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after
592 // If the given key event is equal to the key event sent by 592 // If the given key event is equal to the key event sent by
593 // SendKeyEvents, this engine ID is propagated to the extension IME. 593 // SendKeyEvents, this engine ID is propagated to the extension IME.
594 // Note, this check relies on that ui::KeyEvent is propagated as 594 // Note, this check relies on that ui::KeyEvent is propagated as
595 // reference without copying. 595 // reference without copying.
596 if (&key_event == sent_key_event_) 596 if (&key_event == sent_key_event_)
597 ext_event.extension_id = extension_id_; 597 ext_event.extension_id = extension_id_;
598 598
599 observer_->OnKeyEvent(active_component_id_, ext_event, callback); 599 observer_->OnKeyEvent(active_component_id_, ext_event, callback);
600 } 600 }
601 601
602 void InputMethodEngine::CandidateClicked(uint32 index) { 602 void InputMethodEngine::CandidateClicked(uint32_t index) {
603 if (!CheckProfile()) 603 if (!CheckProfile())
604 return; 604 return;
605 if (index > candidate_ids_.size()) { 605 if (index > candidate_ids_.size()) {
606 return; 606 return;
607 } 607 }
608 608
609 // Only left button click is supported at this moment. 609 // Only left button click is supported at this moment.
610 observer_->OnCandidateClicked(active_component_id_, candidate_ids_.at(index), 610 observer_->OnCandidateClicked(active_component_id_, candidate_ids_.at(index),
611 ui::IMEEngineObserver::MOUSE_BUTTON_LEFT); 611 ui::IMEEngineObserver::MOUSE_BUTTON_LEFT);
612 } 612 }
613 613
614 void InputMethodEngine::SetSurroundingText(const std::string& text, 614 void InputMethodEngine::SetSurroundingText(const std::string& text,
615 uint32 cursor_pos, 615 uint32_t cursor_pos,
616 uint32 anchor_pos, 616 uint32_t anchor_pos,
617 uint32 offset_pos) { 617 uint32_t offset_pos) {
618 if (!CheckProfile()) 618 if (!CheckProfile())
619 return; 619 return;
620 observer_->OnSurroundingTextChanged( 620 observer_->OnSurroundingTextChanged(
621 active_component_id_, text, static_cast<int>(cursor_pos), 621 active_component_id_, text, static_cast<int>(cursor_pos),
622 static_cast<int>(anchor_pos), static_cast<int>(offset_pos)); 622 static_cast<int>(anchor_pos), static_cast<int>(offset_pos));
623 } 623 }
624 624
625 bool InputMethodEngine::CheckProfile() const { 625 bool InputMethodEngine::CheckProfile() const {
626 Profile* active_profile = ProfileManager::GetActiveUserProfile(); 626 Profile* active_profile = ProfileManager::GetActiveUserProfile();
627 return active_profile == profile_ || profile_->IsSameProfile(active_profile); 627 return active_profile == profile_ || profile_->IsSameProfile(active_profile);
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
663 // TODO(nona): Implement it. 663 // TODO(nona): Implement it.
664 break; 664 break;
665 } 665 }
666 } 666 }
667 } 667 }
668 668
669 // TODO(nona): Support item.children. 669 // TODO(nona): Support item.children.
670 } 670 }
671 671
672 } // namespace chromeos 672 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698