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 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
409 | 409 |
410 void InputMethodEngineIBus::FocusIn(ibus::TextInputType text_input_type) { | 410 void InputMethodEngineIBus::FocusIn(ibus::TextInputType text_input_type) { |
411 focused_ = true; | 411 focused_ = true; |
412 if (!active_) | 412 if (!active_) |
413 return; | 413 return; |
414 context_id_ = next_context_id_; | 414 context_id_ = next_context_id_; |
415 ++next_context_id_; | 415 ++next_context_id_; |
416 | 416 |
417 InputContext context; | 417 InputContext context; |
418 context.id = context_id_; | 418 context.id = context_id_; |
419 // TODO: Other types | 419 switch (text_input_type) { |
420 context.type = "text"; | 420 case ibus::TEXT_INPUT_TYPE_SEARCH: |
Seigo Nonaka
2013/10/30 04:00:00
nit: need two-space indent.
yoichio
2013/10/30 05:32:22
Done.
| |
421 context.type = "search"; | |
422 break; | |
423 case ibus::TEXT_INPUT_TYPE_TELEPHONE: | |
424 context.type = "tel"; | |
425 break; | |
426 case ibus::TEXT_INPUT_TYPE_URL: | |
427 context.type = "url"; | |
428 break; | |
429 case ibus::TEXT_INPUT_TYPE_EMAIL: | |
430 context.type = "email"; | |
431 break; | |
432 case ibus::TEXT_INPUT_TYPE_PASSWORD: | |
433 context.type = "password"; | |
434 break; | |
435 case ibus::TEXT_INPUT_TYPE_NUMBER: | |
436 context.type = "number"; | |
437 break; | |
438 default: | |
439 context.type = "text"; | |
440 break; | |
441 } | |
421 | 442 |
422 observer_->OnFocus(context); | 443 observer_->OnFocus(context); |
423 } | 444 } |
424 | 445 |
425 void InputMethodEngineIBus::FocusOut() { | 446 void InputMethodEngineIBus::FocusOut() { |
426 focused_ = false; | 447 focused_ = false; |
427 if (!active_) | 448 if (!active_) |
428 return; | 449 return; |
429 int context_id = context_id_; | 450 int context_id = context_id_; |
430 context_id_ = -1; | 451 context_id_ = -1; |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
611 DBusThreadManager::Get()->RemoveIBusEngineService(object_path_); | 632 DBusThreadManager::Get()->RemoveIBusEngineService(object_path_); |
612 | 633 |
613 object_path_ = DBusThreadManager::Get()->GetIBusEngineFactoryService()-> | 634 object_path_ = DBusThreadManager::Get()->GetIBusEngineFactoryService()-> |
614 GenerateUniqueObjectPath(); | 635 GenerateUniqueObjectPath(); |
615 | 636 |
616 GetCurrentService()->SetEngine(this); | 637 GetCurrentService()->SetEngine(this); |
617 sender.Run(object_path_); | 638 sender.Run(object_path_); |
618 } | 639 } |
619 | 640 |
620 } // namespace chromeos | 641 } // namespace chromeos |
OLD | NEW |