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

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: Fix tests. 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 663 matching lines...) Expand 10 before | Expand all | Expand 10 after
674 } 674 }
675 675
676 bool SystemTrayDelegateChromeOS::IsBluetoothDiscovering() { 676 bool SystemTrayDelegateChromeOS::IsBluetoothDiscovering() {
677 return bluetooth_adapter_->IsDiscovering(); 677 return bluetooth_adapter_->IsDiscovering();
678 } 678 }
679 679
680 void SystemTrayDelegateChromeOS::GetCurrentIME(ash::IMEInfo* info) { 680 void SystemTrayDelegateChromeOS::GetCurrentIME(ash::IMEInfo* info) {
681 input_method::InputMethodManager* manager = 681 input_method::InputMethodManager* manager =
682 input_method::InputMethodManager::Get(); 682 input_method::InputMethodManager::Get();
683 input_method::InputMethodUtil* util = manager->GetInputMethodUtil(); 683 input_method::InputMethodUtil* util = manager->GetInputMethodUtil();
684 input_method::InputMethodDescriptor ime = manager->GetCurrentInputMethod(); 684 input_method::InputMethodDescriptor ime =
685 manager->GetActiveIMEState()->GetCurrentInputMethod();
685 ExtractIMEInfo(ime, *util, info); 686 ExtractIMEInfo(ime, *util, info);
686 info->selected = true; 687 info->selected = true;
687 } 688 }
688 689
689 void SystemTrayDelegateChromeOS::GetAvailableIMEList(ash::IMEInfoList* list) { 690 void SystemTrayDelegateChromeOS::GetAvailableIMEList(ash::IMEInfoList* list) {
690 input_method::InputMethodManager* manager = 691 input_method::InputMethodManager* manager =
691 input_method::InputMethodManager::Get(); 692 input_method::InputMethodManager::Get();
692 input_method::InputMethodUtil* util = manager->GetInputMethodUtil(); 693 input_method::InputMethodUtil* util = manager->GetInputMethodUtil();
693 scoped_ptr<input_method::InputMethodDescriptors> ime_descriptors( 694 scoped_ptr<input_method::InputMethodDescriptors> ime_descriptors(
694 manager->GetActiveInputMethods()); 695 manager->GetActiveIMEState()->GetActiveInputMethods());
695 std::string current = manager->GetCurrentInputMethod().id(); 696 std::string current =
697 manager->GetActiveIMEState()->GetCurrentInputMethod().id();
696 for (size_t i = 0; i < ime_descriptors->size(); i++) { 698 for (size_t i = 0; i < ime_descriptors->size(); i++) {
697 input_method::InputMethodDescriptor& ime = ime_descriptors->at(i); 699 input_method::InputMethodDescriptor& ime = ime_descriptors->at(i);
698 ash::IMEInfo info; 700 ash::IMEInfo info;
699 ExtractIMEInfo(ime, *util, &info); 701 ExtractIMEInfo(ime, *util, &info);
700 info.selected = ime.id() == current; 702 info.selected = ime.id() == current;
701 list->push_back(info); 703 list->push_back(info);
702 } 704 }
703 } 705 }
704 706
705 void SystemTrayDelegateChromeOS::GetCurrentIMEProperties( 707 void SystemTrayDelegateChromeOS::GetCurrentIMEProperties(
706 ash::IMEPropertyInfoList* list) { 708 ash::IMEPropertyInfoList* list) {
707 ash::ime::InputMethodMenuItemList menu_list = 709 ash::ime::InputMethodMenuItemList menu_list =
708 ash::ime::InputMethodMenuManager::GetInstance()-> 710 ash::ime::InputMethodMenuManager::GetInstance()->
709 GetCurrentInputMethodMenuItemList(); 711 GetCurrentInputMethodMenuItemList();
710 for (size_t i = 0; i < menu_list.size(); ++i) { 712 for (size_t i = 0; i < menu_list.size(); ++i) {
711 ash::IMEPropertyInfo property; 713 ash::IMEPropertyInfo property;
712 property.key = menu_list[i].key; 714 property.key = menu_list[i].key;
713 property.name = base::UTF8ToUTF16(menu_list[i].label); 715 property.name = base::UTF8ToUTF16(menu_list[i].label);
714 property.selected = menu_list[i].is_selection_item_checked; 716 property.selected = menu_list[i].is_selection_item_checked;
715 list->push_back(property); 717 list->push_back(property);
716 } 718 }
717 } 719 }
718 720
719 void SystemTrayDelegateChromeOS::SwitchIME(const std::string& ime_id) { 721 void SystemTrayDelegateChromeOS::SwitchIME(const std::string& ime_id) {
720 input_method::InputMethodManager::Get()->ChangeInputMethod(ime_id); 722 input_method::InputMethodManager::Get()
723 ->GetActiveIMEState()
724 ->ChangeInputMethod(ime_id, false /* show_message */);
721 } 725 }
722 726
723 void SystemTrayDelegateChromeOS::ActivateIMEProperty(const std::string& key) { 727 void SystemTrayDelegateChromeOS::ActivateIMEProperty(const std::string& key) {
724 input_method::InputMethodManager::Get()->ActivateInputMethodMenuItem(key); 728 input_method::InputMethodManager::Get()->ActivateInputMethodMenuItem(key);
725 } 729 }
726 730
727 void SystemTrayDelegateChromeOS::ShowNetworkConfigure( 731 void SystemTrayDelegateChromeOS::ShowNetworkConfigure(
728 const std::string& network_id, 732 const std::string& network_id,
729 gfx::NativeWindow parent_window) { 733 gfx::NativeWindow parent_window) {
730 NetworkConfigView::Show(network_id, parent_window); 734 NetworkConfigView::Show(network_id, parent_window);
(...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after
1274 accessibility_subscription_.reset(); 1278 accessibility_subscription_.reset();
1275 else 1279 else
1276 OnAccessibilityModeChanged(details.notify); 1280 OnAccessibilityModeChanged(details.notify);
1277 } 1281 }
1278 1282
1279 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { 1283 ash::SystemTrayDelegate* CreateSystemTrayDelegate() {
1280 return new SystemTrayDelegateChromeOS(); 1284 return new SystemTrayDelegateChromeOS();
1281 } 1285 }
1282 1286
1283 } // namespace chromeos 1287 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698