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

Side by Side Diff: chrome/browser/ui/ash/system_tray_delegate_chromeos.cc

Issue 419293002: IME refactoring: ChromeOS introduce input methods State. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cleanup. Created 6 years, 4 months 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/ui/ash/system_tray_delegate_chromeos.h" 5 #include "chrome/browser/ui/ash/system_tray_delegate_chromeos.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after
663 } 663 }
664 664
665 bool SystemTrayDelegateChromeOS::IsBluetoothDiscovering() { 665 bool SystemTrayDelegateChromeOS::IsBluetoothDiscovering() {
666 return bluetooth_adapter_->IsDiscovering(); 666 return bluetooth_adapter_->IsDiscovering();
667 } 667 }
668 668
669 void SystemTrayDelegateChromeOS::GetCurrentIME(ash::IMEInfo* info) { 669 void SystemTrayDelegateChromeOS::GetCurrentIME(ash::IMEInfo* info) {
670 input_method::InputMethodManager* manager = 670 input_method::InputMethodManager* manager =
671 input_method::InputMethodManager::Get(); 671 input_method::InputMethodManager::Get();
672 input_method::InputMethodUtil* util = manager->GetInputMethodUtil(); 672 input_method::InputMethodUtil* util = manager->GetInputMethodUtil();
673 input_method::InputMethodDescriptor ime = manager->GetCurrentInputMethod(); 673 input_method::InputMethodDescriptor ime =
674 manager->GetActiveIMEState()->GetCurrentInputMethod();
674 ExtractIMEInfo(ime, *util, info); 675 ExtractIMEInfo(ime, *util, info);
675 info->selected = true; 676 info->selected = true;
676 } 677 }
677 678
678 void SystemTrayDelegateChromeOS::GetAvailableIMEList(ash::IMEInfoList* list) { 679 void SystemTrayDelegateChromeOS::GetAvailableIMEList(ash::IMEInfoList* list) {
679 input_method::InputMethodManager* manager = 680 input_method::InputMethodManager* manager =
680 input_method::InputMethodManager::Get(); 681 input_method::InputMethodManager::Get();
681 input_method::InputMethodUtil* util = manager->GetInputMethodUtil(); 682 input_method::InputMethodUtil* util = manager->GetInputMethodUtil();
682 scoped_ptr<input_method::InputMethodDescriptors> ime_descriptors( 683 scoped_ptr<input_method::InputMethodDescriptors> ime_descriptors(
683 manager->GetActiveInputMethods()); 684 manager->GetActiveIMEState()->GetActiveInputMethods());
684 std::string current = manager->GetCurrentInputMethod().id(); 685 std::string current =
686 manager->GetActiveIMEState()->GetCurrentInputMethod().id();
685 for (size_t i = 0; i < ime_descriptors->size(); i++) { 687 for (size_t i = 0; i < ime_descriptors->size(); i++) {
686 input_method::InputMethodDescriptor& ime = ime_descriptors->at(i); 688 input_method::InputMethodDescriptor& ime = ime_descriptors->at(i);
687 ash::IMEInfo info; 689 ash::IMEInfo info;
688 ExtractIMEInfo(ime, *util, &info); 690 ExtractIMEInfo(ime, *util, &info);
689 info.selected = ime.id() == current; 691 info.selected = ime.id() == current;
690 list->push_back(info); 692 list->push_back(info);
691 } 693 }
692 } 694 }
693 695
694 void SystemTrayDelegateChromeOS::GetCurrentIMEProperties( 696 void SystemTrayDelegateChromeOS::GetCurrentIMEProperties(
695 ash::IMEPropertyInfoList* list) { 697 ash::IMEPropertyInfoList* list) {
696 ash::ime::InputMethodMenuItemList menu_list = 698 ash::ime::InputMethodMenuItemList menu_list =
697 ash::ime::InputMethodMenuManager::GetInstance()-> 699 ash::ime::InputMethodMenuManager::GetInstance()->
698 GetCurrentInputMethodMenuItemList(); 700 GetCurrentInputMethodMenuItemList();
699 for (size_t i = 0; i < menu_list.size(); ++i) { 701 for (size_t i = 0; i < menu_list.size(); ++i) {
700 ash::IMEPropertyInfo property; 702 ash::IMEPropertyInfo property;
701 property.key = menu_list[i].key; 703 property.key = menu_list[i].key;
702 property.name = base::UTF8ToUTF16(menu_list[i].label); 704 property.name = base::UTF8ToUTF16(menu_list[i].label);
703 property.selected = menu_list[i].is_selection_item_checked; 705 property.selected = menu_list[i].is_selection_item_checked;
704 list->push_back(property); 706 list->push_back(property);
705 } 707 }
706 } 708 }
707 709
708 void SystemTrayDelegateChromeOS::SwitchIME(const std::string& ime_id) { 710 void SystemTrayDelegateChromeOS::SwitchIME(const std::string& ime_id) {
709 input_method::InputMethodManager::Get()->ChangeInputMethod(ime_id); 711 input_method::InputMethodManager::Get()
712 ->GetActiveIMEState()
713 ->ChangeInputMethod(ime_id, false /* show_message */);
710 } 714 }
711 715
712 void SystemTrayDelegateChromeOS::ActivateIMEProperty(const std::string& key) { 716 void SystemTrayDelegateChromeOS::ActivateIMEProperty(const std::string& key) {
713 input_method::InputMethodManager::Get()->ActivateInputMethodMenuItem(key); 717 input_method::InputMethodManager::Get()->ActivateInputMethodMenuItem(key);
714 } 718 }
715 719
716 void SystemTrayDelegateChromeOS::ShowNetworkConfigure( 720 void SystemTrayDelegateChromeOS::ShowNetworkConfigure(
717 const std::string& network_id, 721 const std::string& network_id,
718 gfx::NativeWindow parent_window) { 722 gfx::NativeWindow parent_window) {
719 NetworkConfigView::Show(network_id, parent_window); 723 NetworkConfigView::Show(network_id, parent_window);
(...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after
1263 accessibility_subscription_.reset(); 1267 accessibility_subscription_.reset();
1264 else 1268 else
1265 OnAccessibilityModeChanged(details.notify); 1269 OnAccessibilityModeChanged(details.notify);
1266 } 1270 }
1267 1271
1268 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { 1272 ash::SystemTrayDelegate* CreateSystemTrayDelegate() {
1269 return new SystemTrayDelegateChromeOS(); 1273 return new SystemTrayDelegateChromeOS();
1270 } 1274 }
1271 1275
1272 } // namespace chromeos 1276 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698