| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <set> | 10 #include <set> |
| 11 #include <string> | 11 #include <string> |
| 12 #include <utility> | 12 #include <utility> |
| 13 #include <vector> | 13 #include <vector> |
| 14 | 14 |
| 15 #include "ash/ash_switches.h" | 15 #include "ash/ash_switches.h" |
| 16 #include "ash/common/session/session_state_delegate.h" | 16 #include "ash/common/session/session_state_delegate.h" |
| 17 #include "ash/common/session/session_state_observer.h" | 17 #include "ash/common/session/session_state_observer.h" |
| 18 #include "ash/common/shell_window_ids.h" | 18 #include "ash/common/shell_window_ids.h" |
| 19 #include "ash/common/system/date/clock_observer.h" |
| 19 #include "ash/common/system/tray/system_tray_delegate.h" | 20 #include "ash/common/system/tray/system_tray_delegate.h" |
| 20 #include "ash/common/system/tray/wm_system_tray_notifier.h" | 21 #include "ash/common/system/tray/wm_system_tray_notifier.h" |
| 21 #include "ash/common/system/update/update_observer.h" | 22 #include "ash/common/system/update/update_observer.h" |
| 22 #include "ash/common/system/volume_control_delegate.h" | 23 #include "ash/common/system/volume_control_delegate.h" |
| 23 #include "ash/common/wm_shell.h" | 24 #include "ash/common/wm_shell.h" |
| 24 #include "ash/desktop_background/desktop_background_controller.h" | 25 #include "ash/desktop_background/desktop_background_controller.h" |
| 25 #include "ash/metrics/user_metrics_recorder.h" | 26 #include "ash/metrics/user_metrics_recorder.h" |
| 26 #include "ash/shell.h" | 27 #include "ash/shell.h" |
| 27 #include "ash/shell_delegate.h" | 28 #include "ash/shell_delegate.h" |
| 28 #include "ash/system/chromeos/bluetooth/bluetooth_observer.h" | 29 #include "ash/system/chromeos/bluetooth/bluetooth_observer.h" |
| 29 #include "ash/system/chromeos/power/power_status.h" | 30 #include "ash/system/chromeos/power/power_status.h" |
| 30 #include "ash/system/chromeos/session/logout_button_observer.h" | 31 #include "ash/system/chromeos/session/logout_button_observer.h" |
| 31 #include "ash/system/chromeos/shutdown_policy_observer.h" | 32 #include "ash/system/chromeos/shutdown_policy_observer.h" |
| 32 #include "ash/system/date/clock_observer.h" | |
| 33 #include "ash/system/ime/ime_observer.h" | 33 #include "ash/system/ime/ime_observer.h" |
| 34 #include "ash/system/tray/system_tray.h" | 34 #include "ash/system/tray/system_tray.h" |
| 35 #include "ash/system/tray/system_tray_notifier.h" | 35 #include "ash/system/tray/system_tray_notifier.h" |
| 36 #include "ash/system/tray_accessibility.h" | 36 #include "ash/system/tray_accessibility.h" |
| 37 #include "ash/system/user/login_status.h" | 37 #include "ash/system/user/login_status.h" |
| 38 #include "ash/system/user/user_observer.h" | 38 #include "ash/system/user/user_observer.h" |
| 39 #include "ash/wm/lock_state_controller.h" | 39 #include "ash/wm/lock_state_controller.h" |
| 40 #include "base/bind_helpers.h" | 40 #include "base/bind_helpers.h" |
| 41 #include "base/callback.h" | 41 #include "base/callback.h" |
| 42 #include "base/logging.h" | 42 #include "base/logging.h" |
| (...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 611 // TODO(antrim) : additional logging for crbug/173178 | 611 // TODO(antrim) : additional logging for crbug/173178 |
| 612 LOG(WARNING) << "Requesting screen lock from AshSystemTrayDelegate"; | 612 LOG(WARNING) << "Requesting screen lock from AshSystemTrayDelegate"; |
| 613 DBusThreadManager::Get()->GetSessionManagerClient()->RequestLockScreen(); | 613 DBusThreadManager::Get()->GetSessionManagerClient()->RequestLockScreen(); |
| 614 } | 614 } |
| 615 | 615 |
| 616 void SystemTrayDelegateChromeOS::RequestRestartForUpdate() { | 616 void SystemTrayDelegateChromeOS::RequestRestartForUpdate() { |
| 617 // We expect that UpdateEngine is in "Reboot for update" state now. | 617 // We expect that UpdateEngine is in "Reboot for update" state now. |
| 618 chrome::NotifyAndTerminate(true /* fast path */); | 618 chrome::NotifyAndTerminate(true /* fast path */); |
| 619 } | 619 } |
| 620 | 620 |
| 621 void SystemTrayDelegateChromeOS::RequestShutdown() { |
| 622 ash::Shell::GetInstance()->lock_state_controller()->RequestShutdown(); |
| 623 } |
| 624 |
| 621 void SystemTrayDelegateChromeOS::GetAvailableBluetoothDevices( | 625 void SystemTrayDelegateChromeOS::GetAvailableBluetoothDevices( |
| 622 ash::BluetoothDeviceList* list) { | 626 ash::BluetoothDeviceList* list) { |
| 623 device::BluetoothAdapter::DeviceList devices = | 627 device::BluetoothAdapter::DeviceList devices = |
| 624 bluetooth_adapter_->GetDevices(); | 628 bluetooth_adapter_->GetDevices(); |
| 625 for (size_t i = 0; i < devices.size(); ++i) { | 629 for (size_t i = 0; i < devices.size(); ++i) { |
| 626 device::BluetoothDevice* device = devices[i]; | 630 device::BluetoothDevice* device = devices[i]; |
| 627 ash::BluetoothDeviceInfo info; | 631 ash::BluetoothDeviceInfo info; |
| 628 info.address = device->GetAddress(); | 632 info.address = device->GetAddress(); |
| 629 info.display_name = device->GetNameForDisplay(); | 633 info.display_name = device->GetNameForDisplay(); |
| 630 info.connected = device->IsConnected(); | 634 info.connected = device->IsConnected(); |
| (...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 961 bool SystemTrayDelegateChromeOS::GetShouldUse24HourClockForTesting() const { | 965 bool SystemTrayDelegateChromeOS::GetShouldUse24HourClockForTesting() const { |
| 962 return g_browser_process->platform_part() | 966 return g_browser_process->platform_part() |
| 963 ->GetSystemClock() | 967 ->GetSystemClock() |
| 964 ->ShouldUse24HourClock(); | 968 ->ShouldUse24HourClock(); |
| 965 } | 969 } |
| 966 | 970 |
| 967 void SystemTrayDelegateChromeOS::OnSystemClockChanged( | 971 void SystemTrayDelegateChromeOS::OnSystemClockChanged( |
| 968 system::SystemClock* system_clock) { | 972 system::SystemClock* system_clock) { |
| 969 const bool use_24_hour_clock = system_clock->ShouldUse24HourClock(); | 973 const bool use_24_hour_clock = system_clock->ShouldUse24HourClock(); |
| 970 clock_type_ = use_24_hour_clock ? base::k24HourClock : base::k12HourClock; | 974 clock_type_ = use_24_hour_clock ? base::k24HourClock : base::k12HourClock; |
| 971 GetSystemTrayNotifier()->NotifyDateFormatChanged(); | 975 GetWmSystemTrayNotifier()->NotifyDateFormatChanged(); |
| 972 } | 976 } |
| 973 | 977 |
| 974 void SystemTrayDelegateChromeOS::UpdateShowLogoutButtonInTray() { | 978 void SystemTrayDelegateChromeOS::UpdateShowLogoutButtonInTray() { |
| 975 GetSystemTrayNotifier()->NotifyShowLoginButtonChanged( | 979 GetSystemTrayNotifier()->NotifyShowLoginButtonChanged( |
| 976 user_pref_registrar_->prefs()->GetBoolean( | 980 user_pref_registrar_->prefs()->GetBoolean( |
| 977 prefs::kShowLogoutButtonInTray)); | 981 prefs::kShowLogoutButtonInTray)); |
| 978 } | 982 } |
| 979 | 983 |
| 980 void SystemTrayDelegateChromeOS::UpdateLogoutDialogDuration() { | 984 void SystemTrayDelegateChromeOS::UpdateLogoutDialogDuration() { |
| 981 const int duration_ms = | 985 const int duration_ms = |
| (...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1336 LOG(WARNING) << "SystemTrayDelegateChromeOS::GetChildUserMessage call while " | 1340 LOG(WARNING) << "SystemTrayDelegateChromeOS::GetChildUserMessage call while " |
| 1337 << "ENABLE_SUPERVISED_USERS undefined."; | 1341 << "ENABLE_SUPERVISED_USERS undefined."; |
| 1338 return base::string16(); | 1342 return base::string16(); |
| 1339 } | 1343 } |
| 1340 | 1344 |
| 1341 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { | 1345 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { |
| 1342 return new SystemTrayDelegateChromeOS(); | 1346 return new SystemTrayDelegateChromeOS(); |
| 1343 } | 1347 } |
| 1344 | 1348 |
| 1345 } // namespace chromeos | 1349 } // namespace chromeos |
| OLD | NEW |