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" | |
16 #include "ash/metrics/user_metrics_recorder.h" | 14 #include "ash/metrics/user_metrics_recorder.h" |
17 #include "ash/session/session_state_delegate.h" | 15 #include "ash/session/session_state_delegate.h" |
18 #include "ash/session/session_state_observer.h" | 16 #include "ash/session/session_state_observer.h" |
19 #include "ash/shell.h" | 17 #include "ash/shell.h" |
20 #include "ash/shell_delegate.h" | 18 #include "ash/shell_delegate.h" |
21 #include "ash/shell_window_ids.h" | 19 #include "ash/shell_window_ids.h" |
22 #include "ash/system/bluetooth/bluetooth_observer.h" | 20 #include "ash/system/bluetooth/bluetooth_observer.h" |
23 #include "ash/system/chromeos/session/logout_button_observer.h" | 21 #include "ash/system/chromeos/session/logout_button_observer.h" |
24 #include "ash/system/date/clock_observer.h" | 22 #include "ash/system/date/clock_observer.h" |
25 #include "ash/system/ime/ime_observer.h" | 23 #include "ash/system/ime/ime_observer.h" |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 #include "content/public/browser/notification_service.h" | 103 #include "content/public/browser/notification_service.h" |
106 #include "content/public/browser/user_metrics.h" | 104 #include "content/public/browser/user_metrics.h" |
107 #include "content/public/browser/web_contents.h" | 105 #include "content/public/browser/web_contents.h" |
108 #include "device/bluetooth/bluetooth_adapter.h" | 106 #include "device/bluetooth/bluetooth_adapter.h" |
109 #include "device/bluetooth/bluetooth_adapter_factory.h" | 107 #include "device/bluetooth/bluetooth_adapter_factory.h" |
110 #include "device/bluetooth/bluetooth_device.h" | 108 #include "device/bluetooth/bluetooth_device.h" |
111 #include "net/base/escape.h" | 109 #include "net/base/escape.h" |
112 #include "third_party/cros_system_api/dbus/service_constants.h" | 110 #include "third_party/cros_system_api/dbus/service_constants.h" |
113 #include "ui/base/l10n/l10n_util.h" | 111 #include "ui/base/l10n/l10n_util.h" |
114 #include "ui/base/l10n/time_format.h" | 112 #include "ui/base/l10n/time_format.h" |
| 113 #include "ui/chromeos/ime/input_method_menu_item.h" |
| 114 #include "ui/chromeos/ime/input_method_menu_manager.h" |
115 | 115 |
116 namespace chromeos { | 116 namespace chromeos { |
117 | 117 |
118 namespace { | 118 namespace { |
119 | 119 |
120 // The minimum session length limit that can be set. | 120 // The minimum session length limit that can be set. |
121 const int kSessionLengthLimitMinMs = 30 * 1000; // 30 seconds. | 121 const int kSessionLengthLimitMinMs = 30 * 1000; // 30 seconds. |
122 | 122 |
123 // The maximum session length limit that can be set. | 123 // The maximum session length limit that can be set. |
124 const int kSessionLengthLimitMaxMs = 24 * 60 * 60 * 1000; // 24 hours. | 124 const int kSessionLengthLimitMaxMs = 24 * 60 * 60 * 1000; // 24 hours. |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 base::Bind(&SystemTrayDelegateChromeOS::OnAccessibilityStatusChanged, | 226 base::Bind(&SystemTrayDelegateChromeOS::OnAccessibilityStatusChanged, |
227 base::Unretained(this))); | 227 base::Unretained(this))); |
228 | 228 |
229 user_manager::UserManager::Get()->AddSessionStateObserver(this); | 229 user_manager::UserManager::Get()->AddSessionStateObserver(this); |
230 } | 230 } |
231 | 231 |
232 void SystemTrayDelegateChromeOS::Initialize() { | 232 void SystemTrayDelegateChromeOS::Initialize() { |
233 DBusThreadManager::Get()->GetSessionManagerClient()->AddObserver(this); | 233 DBusThreadManager::Get()->GetSessionManagerClient()->AddObserver(this); |
234 | 234 |
235 input_method::InputMethodManager::Get()->AddObserver(this); | 235 input_method::InputMethodManager::Get()->AddObserver(this); |
236 ash::ime::InputMethodMenuManager::GetInstance()->AddObserver(this); | 236 ui::ime::InputMethodMenuManager::GetInstance()->AddObserver(this); |
237 UpdateClockType(); | 237 UpdateClockType(); |
238 | 238 |
239 device::BluetoothAdapterFactory::GetAdapter( | 239 device::BluetoothAdapterFactory::GetAdapter( |
240 base::Bind(&SystemTrayDelegateChromeOS::InitializeOnAdapterReady, | 240 base::Bind(&SystemTrayDelegateChromeOS::InitializeOnAdapterReady, |
241 weak_ptr_factory_.GetWeakPtr())); | 241 weak_ptr_factory_.GetWeakPtr())); |
242 | 242 |
243 ash::Shell::GetInstance()->session_state_delegate()->AddSessionStateObserver( | 243 ash::Shell::GetInstance()->session_state_delegate()->AddSessionStateObserver( |
244 this); | 244 this); |
245 | 245 |
246 if (LoginState::IsInitialized()) | 246 if (LoginState::IsInitialized()) |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 user_pref_registrar_.reset(); | 292 user_pref_registrar_.reset(); |
293 | 293 |
294 // Unregister content notifications before destroying any components. | 294 // Unregister content notifications before destroying any components. |
295 registrar_.reset(); | 295 registrar_.reset(); |
296 | 296 |
297 // Unregister a11y status subscription. | 297 // Unregister a11y status subscription. |
298 accessibility_subscription_.reset(); | 298 accessibility_subscription_.reset(); |
299 | 299 |
300 DBusThreadManager::Get()->GetSessionManagerClient()->RemoveObserver(this); | 300 DBusThreadManager::Get()->GetSessionManagerClient()->RemoveObserver(this); |
301 input_method::InputMethodManager::Get()->RemoveObserver(this); | 301 input_method::InputMethodManager::Get()->RemoveObserver(this); |
302 ash::ime::InputMethodMenuManager::GetInstance()->RemoveObserver(this); | 302 ui::ime::InputMethodMenuManager::GetInstance()->RemoveObserver(this); |
303 bluetooth_adapter_->RemoveObserver(this); | 303 bluetooth_adapter_->RemoveObserver(this); |
304 ash::Shell::GetInstance() | 304 ash::Shell::GetInstance() |
305 ->session_state_delegate() | 305 ->session_state_delegate() |
306 ->RemoveSessionStateObserver(this); | 306 ->RemoveSessionStateObserver(this); |
307 LoginState::Get()->RemoveObserver(this); | 307 LoginState::Get()->RemoveObserver(this); |
308 | 308 |
309 if (CrasAudioHandler::IsInitialized()) | 309 if (CrasAudioHandler::IsInitialized()) |
310 CrasAudioHandler::Get()->RemoveAudioObserver(this); | 310 CrasAudioHandler::Get()->RemoveAudioObserver(this); |
311 | 311 |
312 BrowserList::RemoveObserver(this); | 312 BrowserList::RemoveObserver(this); |
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
722 input_method::InputMethodDescriptor& ime = ime_descriptors->at(i); | 722 input_method::InputMethodDescriptor& ime = ime_descriptors->at(i); |
723 ash::IMEInfo info; | 723 ash::IMEInfo info; |
724 ExtractIMEInfo(ime, *util, &info); | 724 ExtractIMEInfo(ime, *util, &info); |
725 info.selected = ime.id() == current; | 725 info.selected = ime.id() == current; |
726 list->push_back(info); | 726 list->push_back(info); |
727 } | 727 } |
728 } | 728 } |
729 | 729 |
730 void SystemTrayDelegateChromeOS::GetCurrentIMEProperties( | 730 void SystemTrayDelegateChromeOS::GetCurrentIMEProperties( |
731 ash::IMEPropertyInfoList* list) { | 731 ash::IMEPropertyInfoList* list) { |
732 ash::ime::InputMethodMenuItemList menu_list = | 732 ui::ime::InputMethodMenuItemList menu_list = |
733 ash::ime::InputMethodMenuManager::GetInstance()-> | 733 ui::ime::InputMethodMenuManager::GetInstance()-> |
734 GetCurrentInputMethodMenuItemList(); | 734 GetCurrentInputMethodMenuItemList(); |
735 for (size_t i = 0; i < menu_list.size(); ++i) { | 735 for (size_t i = 0; i < menu_list.size(); ++i) { |
736 ash::IMEPropertyInfo property; | 736 ash::IMEPropertyInfo property; |
737 property.key = menu_list[i].key; | 737 property.key = menu_list[i].key; |
738 property.name = base::UTF8ToUTF16(menu_list[i].label); | 738 property.name = base::UTF8ToUTF16(menu_list[i].label); |
739 property.selected = menu_list[i].is_selection_item_checked; | 739 property.selected = menu_list[i].is_selection_item_checked; |
740 list->push_back(property); | 740 list->push_back(property); |
741 } | 741 } |
742 } | 742 } |
743 | 743 |
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1175 | 1175 |
1176 // Overridden from InputMethodManager::Observer. | 1176 // Overridden from InputMethodManager::Observer. |
1177 void SystemTrayDelegateChromeOS::InputMethodChanged( | 1177 void SystemTrayDelegateChromeOS::InputMethodChanged( |
1178 input_method::InputMethodManager* manager, | 1178 input_method::InputMethodManager* manager, |
1179 bool show_message) { | 1179 bool show_message) { |
1180 GetSystemTrayNotifier()->NotifyRefreshIME(); | 1180 GetSystemTrayNotifier()->NotifyRefreshIME(); |
1181 } | 1181 } |
1182 | 1182 |
1183 // Overridden from InputMethodMenuManager::Observer. | 1183 // Overridden from InputMethodMenuManager::Observer. |
1184 void SystemTrayDelegateChromeOS::InputMethodMenuItemChanged( | 1184 void SystemTrayDelegateChromeOS::InputMethodMenuItemChanged( |
1185 ash::ime::InputMethodMenuManager* manager) { | 1185 ui::ime::InputMethodMenuManager* manager) { |
1186 GetSystemTrayNotifier()->NotifyRefreshIME(); | 1186 GetSystemTrayNotifier()->NotifyRefreshIME(); |
1187 } | 1187 } |
1188 | 1188 |
1189 // Overridden from CrasAudioHandler::AudioObserver. | 1189 // Overridden from CrasAudioHandler::AudioObserver. |
1190 void SystemTrayDelegateChromeOS::OnOutputVolumeChanged() { | 1190 void SystemTrayDelegateChromeOS::OnOutputVolumeChanged() { |
1191 GetSystemTrayNotifier()->NotifyAudioOutputVolumeChanged(); | 1191 GetSystemTrayNotifier()->NotifyAudioOutputVolumeChanged(); |
1192 } | 1192 } |
1193 | 1193 |
1194 void SystemTrayDelegateChromeOS::OnOutputMuteChanged() { | 1194 void SystemTrayDelegateChromeOS::OnOutputMuteChanged() { |
1195 GetSystemTrayNotifier()->NotifyAudioOutputMuteChanged(); | 1195 GetSystemTrayNotifier()->NotifyAudioOutputMuteChanged(); |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1311 accessibility_subscription_.reset(); | 1311 accessibility_subscription_.reset(); |
1312 else | 1312 else |
1313 OnAccessibilityModeChanged(details.notify); | 1313 OnAccessibilityModeChanged(details.notify); |
1314 } | 1314 } |
1315 | 1315 |
1316 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { | 1316 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { |
1317 return new SystemTrayDelegateChromeOS(); | 1317 return new SystemTrayDelegateChromeOS(); |
1318 } | 1318 } |
1319 | 1319 |
1320 } // namespace chromeos | 1320 } // namespace chromeos |
OLD | NEW |