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: |
| 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_NUMBER: |
| 433 context.type = "number"; |
| 434 break; |
| 435 default: |
| 436 context.type = "text"; |
| 437 break; |
| 438 } |
421 | 439 |
422 observer_->OnFocus(context); | 440 observer_->OnFocus(context); |
423 } | 441 } |
424 | 442 |
425 void InputMethodEngineIBus::FocusOut() { | 443 void InputMethodEngineIBus::FocusOut() { |
426 focused_ = false; | 444 focused_ = false; |
427 if (!active_) | 445 if (!active_) |
428 return; | 446 return; |
429 int context_id = context_id_; | 447 int context_id = context_id_; |
430 context_id_ = -1; | 448 context_id_ = -1; |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
611 DBusThreadManager::Get()->RemoveIBusEngineService(object_path_); | 629 DBusThreadManager::Get()->RemoveIBusEngineService(object_path_); |
612 | 630 |
613 object_path_ = DBusThreadManager::Get()->GetIBusEngineFactoryService()-> | 631 object_path_ = DBusThreadManager::Get()->GetIBusEngineFactoryService()-> |
614 GenerateUniqueObjectPath(); | 632 GenerateUniqueObjectPath(); |
615 | 633 |
616 GetCurrentService()->SetEngine(this); | 634 GetCurrentService()->SetEngine(this); |
617 sender.Run(object_path_); | 635 sender.Run(object_path_); |
618 } | 636 } |
619 | 637 |
620 } // namespace chromeos | 638 } // namespace chromeos |
OLD | NEW |