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_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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 observer_(NULL), | 54 observer_(NULL), |
55 preedit_text_(new IBusText()), | 55 preedit_text_(new IBusText()), |
56 preedit_cursor_(0), | 56 preedit_cursor_(0), |
57 component_(new IBusComponent()), | 57 component_(new IBusComponent()), |
58 table_(new IBusLookupTable()), | 58 table_(new IBusLookupTable()), |
59 window_visible_(false), | 59 window_visible_(false), |
60 weak_ptr_factory_(this) { | 60 weak_ptr_factory_(this) { |
61 } | 61 } |
62 | 62 |
63 InputMethodEngineIBus::~InputMethodEngineIBus() { | 63 InputMethodEngineIBus::~InputMethodEngineIBus() { |
64 if (object_path_.IsValid()) | |
65 GetCurrentService()->UnsetEngine(); | |
66 input_method::GetInputMethodManager()->RemoveInputMethodExtension(ibus_id_); | 64 input_method::GetInputMethodManager()->RemoveInputMethodExtension(ibus_id_); |
| 65 |
| 66 // Do not unset engine before removing input method extension, above function |
| 67 // may call reset function of engine object. |
| 68 // TODO(nona): Call Reset manually here and remove relevant code from |
| 69 // InputMethodManager once ibus-daemon is gone. (crbug.com/158273) |
| 70 GetCurrentService()->UnsetEngine(this); |
67 } | 71 } |
68 | 72 |
69 void InputMethodEngineIBus::Initialize( | 73 void InputMethodEngineIBus::Initialize( |
70 InputMethodEngine::Observer* observer, | 74 InputMethodEngine::Observer* observer, |
71 const char* engine_name, | 75 const char* engine_name, |
72 const char* extension_id, | 76 const char* extension_id, |
73 const char* engine_id, | 77 const char* engine_id, |
74 const char* description, | 78 const char* description, |
75 const char* language, | 79 const char* language, |
76 const std::vector<std::string>& layouts, | 80 const std::vector<std::string>& layouts, |
(...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
616 DBusThreadManager::Get()->RemoveIBusEngineService(object_path_); | 620 DBusThreadManager::Get()->RemoveIBusEngineService(object_path_); |
617 | 621 |
618 current_object_path_++; | 622 current_object_path_++; |
619 object_path_ = dbus::ObjectPath(kObjectPathPrefix + | 623 object_path_ = dbus::ObjectPath(kObjectPathPrefix + |
620 base::IntToString(current_object_path_)); | 624 base::IntToString(current_object_path_)); |
621 GetCurrentService()->SetEngine(this); | 625 GetCurrentService()->SetEngine(this); |
622 sender.Run(object_path_); | 626 sender.Run(object_path_); |
623 } | 627 } |
624 | 628 |
625 } // namespace chromeos | 629 } // namespace chromeos |
OLD | NEW |