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

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

Issue 9230004: Remove API elements that are no longer in the IME API design document (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix copyright Created 8 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include <map> 7 #include <map>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "base/string_util.h" 11 #include "base/string_util.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 input_method::InputMethodManager::GetInstance()->RemoveActiveIme(ibus_id_); 57 input_method::InputMethodManager::GetInstance()->RemoveActiveIme(ibus_id_);
58 } 58 }
59 59
60 bool Init(InputMethodEngine::Observer* observer, 60 bool Init(InputMethodEngine::Observer* observer,
61 const char* engine_name, 61 const char* engine_name,
62 const char* extension_id, 62 const char* extension_id,
63 const char* engine_id, 63 const char* engine_id,
64 const char* description, 64 const char* description,
65 const char* language, 65 const char* language,
66 const std::vector<std::string>& layouts, 66 const std::vector<std::string>& layouts,
67 KeyboardEvent& shortcut_key,
68 std::string* error); 67 std::string* error);
69 68
70 virtual bool SetComposition(int context_id, 69 virtual bool SetComposition(int context_id,
71 const char* text, int selection_start, 70 const char* text, int selection_start,
72 int selection_end, int cursor, 71 int selection_end, int cursor,
73 const std::vector<SegmentInfo>& segments, 72 const std::vector<SegmentInfo>& segments,
74 std::string* error); 73 std::string* error);
75 virtual bool ClearComposition(int context_id, 74 virtual bool ClearComposition(int context_id,
76 std::string* error); 75 std::string* error);
77 virtual bool CommitText(int context_id, 76 virtual bool CommitText(int context_id,
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 std::map<int, int> candidate_indexes_; 139 std::map<int, int> candidate_indexes_;
141 }; 140 };
142 141
143 bool InputMethodEngineImpl::Init(InputMethodEngine::Observer* observer, 142 bool InputMethodEngineImpl::Init(InputMethodEngine::Observer* observer,
144 const char* engine_name, 143 const char* engine_name,
145 const char* extension_id, 144 const char* extension_id,
146 const char* engine_id, 145 const char* engine_id,
147 const char* description, 146 const char* description,
148 const char* language, 147 const char* language,
149 const std::vector<std::string>& layouts, 148 const std::vector<std::string>& layouts,
150 KeyboardEvent& shortcut_key,
151 std::string* error) { 149 std::string* error) {
152 ibus_id_ = kExtensionImePrefix; 150 ibus_id_ = kExtensionImePrefix;
153 ibus_id_ += extension_id; 151 ibus_id_ += extension_id;
154 ibus_id_ += engine_id; 152 ibus_id_ += engine_id;
155 153
156 std::string layout; 154 std::string layout;
157 input_method::InputMethodManager* manager = 155 input_method::InputMethodManager* manager =
158 input_method::InputMethodManager::GetInstance(); 156 input_method::InputMethodManager::GetInstance();
159 157
160 if (!layouts.empty()) { 158 if (!layouts.empty()) {
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
480 observer_->OnBlur(context_id); 478 observer_->OnBlur(context_id);
481 } 479 }
482 480
483 void InputMethodEngineImpl::OnKeyEvent(bool key_press, unsigned int keyval, 481 void InputMethodEngineImpl::OnKeyEvent(bool key_press, unsigned int keyval,
484 unsigned int keycode, bool alt_key, 482 unsigned int keycode, bool alt_key,
485 bool ctrl_key, bool shift_key, 483 bool ctrl_key, bool shift_key,
486 input_method::KeyEventHandle* key_data) { 484 input_method::KeyEventHandle* key_data) {
487 KeyboardEvent event; 485 KeyboardEvent event;
488 event.type = key_press ? "keydown" : "keyup"; 486 event.type = key_press ? "keydown" : "keyup";
489 event.key = input_method::GetIBusKey(keyval); 487 event.key = input_method::GetIBusKey(keyval);
490 event.key_code = input_method::GetIBusKeyCode(keycode);
491 event.alt_key = alt_key; 488 event.alt_key = alt_key;
492 event.ctrl_key = ctrl_key; 489 event.ctrl_key = ctrl_key;
493 event.shift_key = shift_key; 490 event.shift_key = shift_key;
494 observer_->OnKeyEvent(engine_id_, event, key_data); 491 observer_->OnKeyEvent(engine_id_, event, key_data);
495 } 492 }
496 493
497 void InputMethodEngineImpl::OnPropertyActivate(const char* name, 494 void InputMethodEngineImpl::OnPropertyActivate(const char* name,
498 unsigned int state) { 495 unsigned int state) {
499 observer_->OnMenuItemActivated(engine_id_, name); 496 observer_->OnMenuItemActivated(engine_id_, name);
500 } 497 }
(...skipping 30 matching lines...) Expand all
531 ~InputMethodEngineStub() { 528 ~InputMethodEngineStub() {
532 } 529 }
533 530
534 bool Init(InputMethodEngine::Observer* observer, 531 bool Init(InputMethodEngine::Observer* observer,
535 const char* engine_name, 532 const char* engine_name,
536 const char* extension_id, 533 const char* extension_id,
537 const char* engine_id, 534 const char* engine_id,
538 const char* description, 535 const char* description,
539 const char* language, 536 const char* language,
540 const std::vector<std::string>& layouts, 537 const std::vector<std::string>& layouts,
541 KeyboardEvent& shortcut_key,
542 std::string* error) { 538 std::string* error) {
543 VLOG(0) << "Init"; 539 VLOG(0) << "Init";
544 return true; 540 return true;
545 } 541 }
546 542
547 virtual bool SetComposition(int context_id, 543 virtual bool SetComposition(int context_id,
548 const char* text, int selection_start, 544 const char* text, int selection_start,
549 int selection_end, int cursor, 545 int selection_end, int cursor,
550 const std::vector<SegmentInfo>& segments, 546 const std::vector<SegmentInfo>& segments,
551 std::string* error) { 547 std::string* error) {
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
639 }; 635 };
640 636
641 InputMethodEngine* InputMethodEngine::CreateEngine( 637 InputMethodEngine* InputMethodEngine::CreateEngine(
642 InputMethodEngine::Observer* observer, 638 InputMethodEngine::Observer* observer,
643 const char* engine_name, 639 const char* engine_name,
644 const char* extension_id, 640 const char* extension_id,
645 const char* engine_id, 641 const char* engine_id,
646 const char* description, 642 const char* description,
647 const char* language, 643 const char* language,
648 const std::vector<std::string>& layouts, 644 const std::vector<std::string>& layouts,
649 KeyboardEvent& shortcut_key,
650 std::string* error) { 645 std::string* error) {
651 646
652 #if defined(HAVE_IBUS) 647 #if defined(HAVE_IBUS)
653 InputMethodEngineImpl* new_engine = new InputMethodEngineImpl(); 648 InputMethodEngineImpl* new_engine = new InputMethodEngineImpl();
654 #else 649 #else
655 InputMethodEngineStub* new_engine = new InputMethodEngineStub(); 650 InputMethodEngineStub* new_engine = new InputMethodEngineStub();
656 #endif 651 #endif
657 652
658 if (!new_engine->Init(observer, engine_name, extension_id, engine_id, 653 if (!new_engine->Init(observer, engine_name, extension_id, engine_id,
659 description, language, layouts, shortcut_key, error)) { 654 description, language, layouts, error)) {
660 LOG(ERROR) << "Init() failed."; 655 LOG(ERROR) << "Init() failed.";
661 delete new_engine; 656 delete new_engine;
662 new_engine = NULL; 657 new_engine = NULL;
663 } 658 }
664 659
665 return new_engine; 660 return new_engine;
666 } 661 }
667 662
668 } // namespace chromeos 663 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/input_method/input_method_engine.h ('k') | chrome/browser/extensions/extension_input_ime_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698