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

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

Issue 50243005: ChromeOS: Remove unused IBus classes from chromeos/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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
« no previous file with comments | « chrome/browser/chromeos/input_method/input_method_engine_ibus.h ('k') | chromeos/chromeos.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_ibus.h" 5 #include "chrome/browser/chromeos/input_method/input_method_engine_ibus.h"
6 6
7 #define XK_MISCELLANY 7 #define XK_MISCELLANY
8 #include <X11/keysymdef.h> 8 #include <X11/keysymdef.h>
9 #include <map> 9 #include <map>
10 10
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 next_context_id_(1), 47 next_context_id_(1),
48 aux_text_(new IBusText()), 48 aux_text_(new IBusText()),
49 aux_text_visible_(false), 49 aux_text_visible_(false),
50 observer_(NULL), 50 observer_(NULL),
51 preedit_text_(new IBusText()), 51 preedit_text_(new IBusText()),
52 preedit_cursor_(0), 52 preedit_cursor_(0),
53 component_(new IBusComponent()), 53 component_(new IBusComponent()),
54 candidate_window_(new input_method::CandidateWindow()), 54 candidate_window_(new input_method::CandidateWindow()),
55 window_visible_(false), 55 window_visible_(false),
56 weak_ptr_factory_(this) { 56 weak_ptr_factory_(this) {
57 ibus_engine_factory_service_.reset(IBusEngineFactoryService::Create());
satorux1 2013/11/05 03:37:55 do this in the initializer list? ibus_engine_f
pneubeck (no reviews) 2013/11/06 09:07:56 Done.
57 } 58 }
58 59
59 InputMethodEngineIBus::~InputMethodEngineIBus() { 60 InputMethodEngineIBus::~InputMethodEngineIBus() {
60 input_method::InputMethodManager::Get()->RemoveInputMethodExtension(ibus_id_); 61 input_method::InputMethodManager::Get()->RemoveInputMethodExtension(ibus_id_);
61 62
62 // Do not unset engine before removing input method extension, above function 63 // Do not unset engine before removing input method extension, above function
63 // may call reset function of engine object. 64 // may call reset function of engine object.
64 // TODO(nona): Call Reset manually here and remove relevant code from 65 // TODO(nona): Call Reset manually here and remove relevant code from
65 // InputMethodManager once ibus-daemon is gone. (crbug.com/158273) 66 // InputMethodManager once ibus-daemon is gone. (crbug.com/158273)
66 if (!object_path_.value().empty()) { 67 if (!object_path_.value().empty()) {
67 GetCurrentService()->UnsetEngine(this); 68 GetCurrentService()->UnsetEngine(this);
68 DBusThreadManager::Get()->RemoveIBusEngineService(object_path_); 69 ibus_engine_service_.reset();
69 } 70 }
70 } 71 }
71 72
72 void InputMethodEngineIBus::Initialize( 73 void InputMethodEngineIBus::Initialize(
73 InputMethodEngine::Observer* observer, 74 InputMethodEngine::Observer* observer,
74 const char* engine_name, 75 const char* engine_name,
75 const char* extension_id, 76 const char* extension_id,
76 const char* engine_id, 77 const char* engine_id,
77 const char* description, 78 const char* description,
78 const std::vector<std::string>& languages, 79 const std::vector<std::string>& languages,
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after
520 void InputMethodEngineIBus::SetSurroundingText(const std::string& text, 521 void InputMethodEngineIBus::SetSurroundingText(const std::string& text,
521 uint32 cursor_pos, 522 uint32 cursor_pos,
522 uint32 anchor_pos) { 523 uint32 anchor_pos) {
523 observer_->OnSurroundingTextChanged(engine_id_, 524 observer_->OnSurroundingTextChanged(engine_id_,
524 text, 525 text,
525 static_cast<int>(cursor_pos), 526 static_cast<int>(cursor_pos),
526 static_cast<int>(anchor_pos)); 527 static_cast<int>(anchor_pos));
527 } 528 }
528 529
529 IBusEngineService* InputMethodEngineIBus::GetCurrentService() { 530 IBusEngineService* InputMethodEngineIBus::GetCurrentService() {
530 return DBusThreadManager::Get()->GetIBusEngineService(object_path_); 531 if (!ibus_engine_service_)
532 ibus_engine_service_.reset(IBusEngineService::Create());
533 return ibus_engine_service_.get();
531 } 534 }
532 535
533 void InputMethodEngineIBus::MenuItemToProperty( 536 void InputMethodEngineIBus::MenuItemToProperty(
534 const MenuItem& item, 537 const MenuItem& item,
535 input_method::InputMethodProperty* property) { 538 input_method::InputMethodProperty* property) {
536 property->key = item.id; 539 property->key = item.id;
537 540
538 if (item.modified & MENU_ITEM_MODIFIED_LABEL) { 541 if (item.modified & MENU_ITEM_MODIFIED_LABEL) {
539 property->label = item.label; 542 property->label = item.label;
540 } 543 }
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 IBusClient* client = DBusThreadManager::Get()->GetIBusClient(); 589 IBusClient* client = DBusThreadManager::Get()->GetIBusClient();
587 client->RegisterComponent( 590 client->RegisterComponent(
588 *component_.get(), 591 *component_.get(),
589 base::Bind(&InputMethodEngineIBus::OnComponentRegistered, 592 base::Bind(&InputMethodEngineIBus::OnComponentRegistered,
590 weak_ptr_factory_.GetWeakPtr()), 593 weak_ptr_factory_.GetWeakPtr()),
591 base::Bind(&InputMethodEngineIBus::OnComponentRegistrationFailed, 594 base::Bind(&InputMethodEngineIBus::OnComponentRegistrationFailed,
592 weak_ptr_factory_.GetWeakPtr())); 595 weak_ptr_factory_.GetWeakPtr()));
593 } 596 }
594 597
595 void InputMethodEngineIBus::OnComponentRegistered() { 598 void InputMethodEngineIBus::OnComponentRegistered() {
596 DBusThreadManager::Get()->GetIBusEngineFactoryService()-> 599 ibus_engine_factory_service_->SetCreateEngineHandler(
597 SetCreateEngineHandler(ibus_id_, 600 ibus_id_,
598 base::Bind( 601 base::Bind(&InputMethodEngineIBus::CreateEngineHandler,
599 &InputMethodEngineIBus::CreateEngineHandler, 602 weak_ptr_factory_.GetWeakPtr()));
600 weak_ptr_factory_.GetWeakPtr()));
601 } 603 }
602 604
603 void InputMethodEngineIBus::OnComponentRegistrationFailed() { 605 void InputMethodEngineIBus::OnComponentRegistrationFailed() {
604 DVLOG(1) << "Failed to register input method components."; 606 DVLOG(1) << "Failed to register input method components.";
605 // TODO(nona): Implement error handling. 607 // TODO(nona): Implement error handling.
606 } 608 }
607 609
608 void InputMethodEngineIBus::CreateEngineHandler( 610 void InputMethodEngineIBus::CreateEngineHandler(
609 const IBusEngineFactoryService::CreateEngineResponseSender& sender) { 611 const IBusEngineFactoryService::CreateEngineResponseSender& sender) {
610 GetCurrentService()->UnsetEngine(this); 612 GetCurrentService()->UnsetEngine(this);
611 DBusThreadManager::Get()->RemoveIBusEngineService(object_path_); 613 ibus_engine_service_.reset();
612 614 object_path_ = ibus_engine_factory_service_->GenerateUniqueObjectPath();
613 object_path_ = DBusThreadManager::Get()->GetIBusEngineFactoryService()->
614 GenerateUniqueObjectPath();
615 615
616 GetCurrentService()->SetEngine(this); 616 GetCurrentService()->SetEngine(this);
617 sender.Run(object_path_); 617 sender.Run(object_path_);
618 } 618 }
619 619
620 } // namespace chromeos 620 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/input_method/input_method_engine_ibus.h ('k') | chromeos/chromeos.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698