Chromium Code Reviews| OLD | NEW |
|---|---|
| 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> |
| 11 | 11 |
| 12 #include "ash/ash_switches.h" | 12 #include "ash/ash_switches.h" |
| 13 #include "ash/desktop_background/desktop_background_controller.h" | 13 #include "ash/desktop_background/desktop_background_controller.h" |
| 14 #include "ash/ime/input_method_menu_item.h" | |
| 15 #include "ash/ime/input_method_menu_manager.h" | |
| 14 #include "ash/metrics/user_metrics_recorder.h" | 16 #include "ash/metrics/user_metrics_recorder.h" |
| 15 #include "ash/session_state_delegate.h" | 17 #include "ash/session_state_delegate.h" |
| 16 #include "ash/session_state_observer.h" | 18 #include "ash/session_state_observer.h" |
| 17 #include "ash/shell.h" | 19 #include "ash/shell.h" |
| 18 #include "ash/shell_delegate.h" | 20 #include "ash/shell_delegate.h" |
| 19 #include "ash/shell_window_ids.h" | 21 #include "ash/shell_window_ids.h" |
| 20 #include "ash/system/bluetooth/bluetooth_observer.h" | 22 #include "ash/system/bluetooth/bluetooth_observer.h" |
| 21 #include "ash/system/date/clock_observer.h" | 23 #include "ash/system/date/clock_observer.h" |
| 22 #include "ash/system/drive/drive_observer.h" | 24 #include "ash/system/drive/drive_observer.h" |
| 23 #include "ash/system/ime/ime_observer.h" | 25 #include "ash/system/ime/ime_observer.h" |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 291 registrar_->Add( | 293 registrar_->Add( |
| 292 this, | 294 this, |
| 293 chrome::NOTIFICATION_CROS_ACCESSIBILITY_TOGGLE_VIRTUAL_KEYBOARD, | 295 chrome::NOTIFICATION_CROS_ACCESSIBILITY_TOGGLE_VIRTUAL_KEYBOARD, |
| 294 content::NotificationService::AllSources()); | 296 content::NotificationService::AllSources()); |
| 295 } | 297 } |
| 296 | 298 |
| 297 void SystemTrayDelegateChromeOS::Initialize() { | 299 void SystemTrayDelegateChromeOS::Initialize() { |
| 298 DBusThreadManager::Get()->GetSessionManagerClient()->AddObserver(this); | 300 DBusThreadManager::Get()->GetSessionManagerClient()->AddObserver(this); |
| 299 | 301 |
| 300 input_method::InputMethodManager::Get()->AddObserver(this); | 302 input_method::InputMethodManager::Get()->AddObserver(this); |
| 303 ash::ime::InputMethodMenuManager::Get()->AddObserver(this); | |
|
Daniel Erat
2014/02/12 15:17:35
i think you're missing a RemoveObserver() call in
Junichi Uekawa
2014/02/12 22:19:53
Done.
| |
| 301 UpdateClockType(); | 304 UpdateClockType(); |
| 302 | 305 |
| 303 if (SystemKeyEventListener::GetInstance()) | 306 if (SystemKeyEventListener::GetInstance()) |
| 304 SystemKeyEventListener::GetInstance()->AddCapsLockObserver(this); | 307 SystemKeyEventListener::GetInstance()->AddCapsLockObserver(this); |
| 305 | 308 |
| 306 device::BluetoothAdapterFactory::GetAdapter( | 309 device::BluetoothAdapterFactory::GetAdapter( |
| 307 base::Bind(&SystemTrayDelegateChromeOS::InitializeOnAdapterReady, | 310 base::Bind(&SystemTrayDelegateChromeOS::InitializeOnAdapterReady, |
| 308 weak_ptr_factory_.GetWeakPtr())); | 311 weak_ptr_factory_.GetWeakPtr())); |
| 309 | 312 |
| 310 ash::Shell::GetInstance()->session_state_delegate()->AddSessionStateObserver( | 313 ash::Shell::GetInstance()->session_state_delegate()->AddSessionStateObserver( |
| (...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 755 input_method::InputMethodDescriptor& ime = ime_descriptors->at(i); | 758 input_method::InputMethodDescriptor& ime = ime_descriptors->at(i); |
| 756 ash::IMEInfo info; | 759 ash::IMEInfo info; |
| 757 ExtractIMEInfo(ime, *util, &info); | 760 ExtractIMEInfo(ime, *util, &info); |
| 758 info.selected = ime.id() == current; | 761 info.selected = ime.id() == current; |
| 759 list->push_back(info); | 762 list->push_back(info); |
| 760 } | 763 } |
| 761 } | 764 } |
| 762 | 765 |
| 763 void SystemTrayDelegateChromeOS::GetCurrentIMEProperties( | 766 void SystemTrayDelegateChromeOS::GetCurrentIMEProperties( |
| 764 ash::IMEPropertyInfoList* list) { | 767 ash::IMEPropertyInfoList* list) { |
| 765 input_method::InputMethodManager* manager = | 768 ash::ime::InputMethodMenuItemList menu_list = |
| 766 input_method::InputMethodManager::Get(); | 769 ash::ime::InputMethodMenuManager::Get()-> |
| 767 input_method::InputMethodPropertyList properties = | 770 GetCurrentInputMethodMenuItemList(); |
| 768 manager->GetCurrentInputMethodProperties(); | 771 for (size_t i = 0; i < menu_list.size(); ++i) { |
| 769 for (size_t i = 0; i < properties.size(); ++i) { | |
| 770 ash::IMEPropertyInfo property; | 772 ash::IMEPropertyInfo property; |
| 771 property.key = properties[i].key; | 773 property.key = menu_list[i].key; |
| 772 property.name = base::UTF8ToUTF16(properties[i].label); | 774 property.name = base::UTF8ToUTF16(menu_list[i].label); |
| 773 property.selected = properties[i].is_selection_item_checked; | 775 property.selected = menu_list[i].is_selection_item_checked; |
| 774 list->push_back(property); | 776 list->push_back(property); |
| 775 } | 777 } |
| 776 } | 778 } |
| 777 | 779 |
| 778 void SystemTrayDelegateChromeOS::SwitchIME(const std::string& ime_id) { | 780 void SystemTrayDelegateChromeOS::SwitchIME(const std::string& ime_id) { |
| 779 input_method::InputMethodManager::Get()->ChangeInputMethod(ime_id); | 781 input_method::InputMethodManager::Get()->ChangeInputMethod(ime_id); |
| 780 } | 782 } |
| 781 | 783 |
| 782 void SystemTrayDelegateChromeOS::ActivateIMEProperty(const std::string& key) { | 784 void SystemTrayDelegateChromeOS::ActivateIMEProperty(const std::string& key) { |
| 783 input_method::InputMethodManager::Get()->ActivateInputMethodProperty(key); | 785 input_method::InputMethodManager::Get()->ActivateInputMethodMenuItem(key); |
| 784 } | 786 } |
| 785 | 787 |
| 786 void SystemTrayDelegateChromeOS::CancelDriveOperation(int32 operation_id) { | 788 void SystemTrayDelegateChromeOS::CancelDriveOperation(int32 operation_id) { |
| 787 DriveIntegrationService* integration_service = FindDriveIntegrationService(); | 789 DriveIntegrationService* integration_service = FindDriveIntegrationService(); |
| 788 if (!integration_service) | 790 if (!integration_service) |
| 789 return; | 791 return; |
| 790 | 792 |
| 791 integration_service->job_list()->CancelJob(operation_id); | 793 integration_service->job_list()->CancelJob(operation_id); |
| 792 } | 794 } |
| 793 | 795 |
| (...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1190 // |show_message| in ash means the message_center notifications | 1192 // |show_message| in ash means the message_center notifications |
| 1191 // which should not be shown unless kDisableIMEModeIndicator is | 1193 // which should not be shown unless kDisableIMEModeIndicator is |
| 1192 // on, since the mode indicator already notifies the user. | 1194 // on, since the mode indicator already notifies the user. |
| 1193 if (!CommandLine::ForCurrentProcess()->HasSwitch( | 1195 if (!CommandLine::ForCurrentProcess()->HasSwitch( |
| 1194 switches::kDisableIMEModeIndicator)) { | 1196 switches::kDisableIMEModeIndicator)) { |
| 1195 show_message = false; | 1197 show_message = false; |
| 1196 } | 1198 } |
| 1197 GetSystemTrayNotifier()->NotifyRefreshIME(show_message); | 1199 GetSystemTrayNotifier()->NotifyRefreshIME(show_message); |
| 1198 } | 1200 } |
| 1199 | 1201 |
| 1200 void SystemTrayDelegateChromeOS::InputMethodPropertyChanged( | 1202 // Overridden from InputMethodMenuManager::Observer. |
| 1201 input_method::InputMethodManager* manager) { | 1203 void SystemTrayDelegateChromeOS::InputMethodMenuItemChanged( |
| 1204 ash::ime::InputMethodMenuManager* manager) { | |
| 1202 GetSystemTrayNotifier()->NotifyRefreshIME(false); | 1205 GetSystemTrayNotifier()->NotifyRefreshIME(false); |
| 1203 } | 1206 } |
| 1204 | 1207 |
| 1205 // drive::JobListObserver overrides. | 1208 // drive::JobListObserver overrides. |
| 1206 void SystemTrayDelegateChromeOS::OnJobAdded(const drive::JobInfo& job_info) { | 1209 void SystemTrayDelegateChromeOS::OnJobAdded(const drive::JobInfo& job_info) { |
| 1207 OnJobUpdated(job_info); | 1210 OnJobUpdated(job_info); |
| 1208 } | 1211 } |
| 1209 | 1212 |
| 1210 void SystemTrayDelegateChromeOS::OnJobDone(const drive::JobInfo& job_info, | 1213 void SystemTrayDelegateChromeOS::OnJobDone(const drive::JobInfo& job_info, |
| 1211 drive::FileError error) { | 1214 drive::FileError error) { |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1297 void SystemTrayDelegateChromeOS::UserAddedToSession( | 1300 void SystemTrayDelegateChromeOS::UserAddedToSession( |
| 1298 const std::string& user_id) { | 1301 const std::string& user_id) { |
| 1299 GetSystemTrayNotifier()->NotifyUserAddedToSession(); | 1302 GetSystemTrayNotifier()->NotifyUserAddedToSession(); |
| 1300 } | 1303 } |
| 1301 | 1304 |
| 1302 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { | 1305 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { |
| 1303 return new SystemTrayDelegateChromeOS(); | 1306 return new SystemTrayDelegateChromeOS(); |
| 1304 } | 1307 } |
| 1305 | 1308 |
| 1306 } // namespace chromeos | 1309 } // namespace chromeos |
| OLD | NEW |