OLD | NEW |
1 // Copyright (c) 2012 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" |
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
517 DVLOG(1) << "Unknown button: " << button; | 517 DVLOG(1) << "Unknown button: " << button; |
518 pressed_button = MOUSE_BUTTON_LEFT; | 518 pressed_button = MOUSE_BUTTON_LEFT; |
519 } | 519 } |
520 | 520 |
521 observer_->OnCandidateClicked( | 521 observer_->OnCandidateClicked( |
522 engine_id_, candidate_ids_.at(index), pressed_button); | 522 engine_id_, candidate_ids_.at(index), pressed_button); |
523 } | 523 } |
524 | 524 |
525 class InputMethodEngineStub : public InputMethodEngine { | 525 class InputMethodEngineStub : public InputMethodEngine { |
526 public: | 526 public: |
527 InputMethodEngineStub() | 527 InputMethodEngineStub() : active_(false) {} |
528 : observer_(NULL), active_(false) {} | 528 ~InputMethodEngineStub() {} |
529 | |
530 ~InputMethodEngineStub() { | |
531 } | |
532 | 529 |
533 bool Init(InputMethodEngine::Observer* observer, | 530 bool Init(InputMethodEngine::Observer* observer, |
534 const char* engine_name, | 531 const char* engine_name, |
535 const char* extension_id, | 532 const char* extension_id, |
536 const char* engine_id, | 533 const char* engine_id, |
537 const char* description, | 534 const char* description, |
538 const char* language, | 535 const char* language, |
539 const std::vector<std::string>& layouts, | 536 const std::vector<std::string>& layouts, |
540 std::string* error) { | 537 std::string* error) { |
541 DVLOG(1) << "Init"; | 538 DVLOG(1) << "Init"; |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
613 virtual bool IsActive() const { | 610 virtual bool IsActive() const { |
614 DVLOG(1) << "IsActive"; | 611 DVLOG(1) << "IsActive"; |
615 return active_; | 612 return active_; |
616 } | 613 } |
617 | 614 |
618 virtual void KeyEventDone(input_method::KeyEventHandle* key_data, | 615 virtual void KeyEventDone(input_method::KeyEventHandle* key_data, |
619 bool handled) { | 616 bool handled) { |
620 } | 617 } |
621 | 618 |
622 private: | 619 private: |
623 // Pointer to the object recieving events for this IME. | |
624 InputMethodEngine::Observer* observer_; | |
625 | |
626 // True when this IME is active, false if deactive. | 620 // True when this IME is active, false if deactive. |
627 bool active_; | 621 bool active_; |
628 | 622 |
629 // User specified id of this IME. | 623 // User specified id of this IME. |
630 std::string engine_id_; | 624 std::string engine_id_; |
631 }; | 625 }; |
632 | 626 |
633 InputMethodEngine* InputMethodEngine::CreateEngine( | 627 InputMethodEngine* InputMethodEngine::CreateEngine( |
634 InputMethodEngine::Observer* observer, | 628 InputMethodEngine::Observer* observer, |
635 const char* engine_name, | 629 const char* engine_name, |
(...skipping 14 matching lines...) Expand all Loading... |
650 description, language, layouts, error)) { | 644 description, language, layouts, error)) { |
651 DVLOG(1) << "Init() failed."; | 645 DVLOG(1) << "Init() failed."; |
652 delete new_engine; | 646 delete new_engine; |
653 new_engine = NULL; | 647 new_engine = NULL; |
654 } | 648 } |
655 | 649 |
656 return new_engine; | 650 return new_engine; |
657 } | 651 } |
658 | 652 |
659 } // namespace chromeos | 653 } // namespace chromeos |
OLD | NEW |