| 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/common/login_status.h" | 15 #include "ash/common/login_status.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_delegate.h" | 18 #include "ash/common/shell_delegate.h" |
| 19 #include "ash/common/system/chromeos/bluetooth/bluetooth_observer.h" | 19 #include "ash/common/system/chromeos/bluetooth/bluetooth_observer.h" |
| 20 #include "ash/common/system/chromeos/power/power_status.h" | 20 #include "ash/common/system/chromeos/power/power_status.h" |
| 21 #include "ash/common/system/chromeos/session/logout_button_observer.h" | 21 #include "ash/common/system/chromeos/session/logout_button_observer.h" |
| 22 #include "ash/common/system/chromeos/shutdown_policy_observer.h" | 22 #include "ash/common/system/chromeos/shutdown_policy_observer.h" |
| 23 #include "ash/common/system/date/clock_observer.h" | 23 #include "ash/common/system/date/clock_observer.h" |
| 24 #include "ash/common/system/ime/ime_observer.h" | 24 #include "ash/common/system/ime/ime_observer.h" |
| 25 #include "ash/common/system/tray/system_tray.h" | |
| 26 #include "ash/common/system/tray/system_tray_delegate.h" | |
| 27 #include "ash/common/system/tray/system_tray_notifier.h" | 25 #include "ash/common/system/tray/system_tray_notifier.h" |
| 28 #include "ash/common/system/tray_accessibility.h" | 26 #include "ash/common/system/tray_accessibility.h" |
| 29 #include "ash/common/system/update/update_observer.h" | 27 #include "ash/common/system/update/update_observer.h" |
| 30 #include "ash/common/system/user/user_observer.h" | 28 #include "ash/common/system/user/user_observer.h" |
| 31 #include "ash/common/wm_shell.h" | 29 #include "ash/common/wm_shell.h" |
| 32 #include "ash/shell.h" | |
| 33 #include "ash/system/chromeos/rotation/tray_rotation_lock.h" | 30 #include "ash/system/chromeos/rotation/tray_rotation_lock.h" |
| 34 #include "ash/wm/lock_state_controller.h" | |
| 35 #include "base/bind_helpers.h" | 31 #include "base/bind_helpers.h" |
| 36 #include "base/callback.h" | 32 #include "base/callback.h" |
| 37 #include "base/logging.h" | 33 #include "base/logging.h" |
| 38 #include "base/memory/ptr_util.h" | 34 #include "base/memory/ptr_util.h" |
| 39 #include "base/memory/weak_ptr.h" | 35 #include "base/memory/weak_ptr.h" |
| 40 #include "base/metrics/user_metrics.h" | 36 #include "base/metrics/user_metrics.h" |
| 41 #include "base/strings/stringprintf.h" | 37 #include "base/strings/stringprintf.h" |
| 42 #include "base/strings/utf_string_conversions.h" | 38 #include "base/strings/utf_string_conversions.h" |
| 43 #include "base/sys_info.h" | 39 #include "base/sys_info.h" |
| 44 #include "base/time/time.h" | 40 #include "base/time/time.h" |
| (...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 | 389 |
| 394 void SystemTrayDelegateChromeOS::SignOut() { | 390 void SystemTrayDelegateChromeOS::SignOut() { |
| 395 chrome::AttemptUserExit(); | 391 chrome::AttemptUserExit(); |
| 396 } | 392 } |
| 397 | 393 |
| 398 void SystemTrayDelegateChromeOS::RequestRestartForUpdate() { | 394 void SystemTrayDelegateChromeOS::RequestRestartForUpdate() { |
| 399 // We expect that UpdateEngine is in "Reboot for update" state now. | 395 // We expect that UpdateEngine is in "Reboot for update" state now. |
| 400 chrome::NotifyAndTerminate(true /* fast path */); | 396 chrome::NotifyAndTerminate(true /* fast path */); |
| 401 } | 397 } |
| 402 | 398 |
| 403 void SystemTrayDelegateChromeOS::RequestShutdown() { | |
| 404 ash::Shell::GetInstance()->lock_state_controller()->RequestShutdown(); | |
| 405 } | |
| 406 | |
| 407 void SystemTrayDelegateChromeOS::GetAvailableBluetoothDevices( | 399 void SystemTrayDelegateChromeOS::GetAvailableBluetoothDevices( |
| 408 ash::BluetoothDeviceList* list) { | 400 ash::BluetoothDeviceList* list) { |
| 409 device::BluetoothAdapter::DeviceList devices = | 401 device::BluetoothAdapter::DeviceList devices = |
| 410 bluetooth_adapter_->GetDevices(); | 402 bluetooth_adapter_->GetDevices(); |
| 411 for (size_t i = 0; i < devices.size(); ++i) { | 403 for (size_t i = 0; i < devices.size(); ++i) { |
| 412 device::BluetoothDevice* device = devices[i]; | 404 device::BluetoothDevice* device = devices[i]; |
| 413 ash::BluetoothDeviceInfo info; | 405 ash::BluetoothDeviceInfo info; |
| 414 info.address = device->GetAddress(); | 406 info.address = device->GetAddress(); |
| 415 info.display_name = device->GetNameForDisplay(); | 407 info.display_name = device->GetNameForDisplay(); |
| 416 info.connected = device->IsConnected(); | 408 info.connected = device->IsConnected(); |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 632 void SystemTrayDelegateChromeOS::UserChangedChildStatus( | 624 void SystemTrayDelegateChromeOS::UserChangedChildStatus( |
| 633 user_manager::User* user) { | 625 user_manager::User* user) { |
| 634 Profile* user_profile = ProfileHelper::Get()->GetProfileByUser(user); | 626 Profile* user_profile = ProfileHelper::Get()->GetProfileByUser(user); |
| 635 | 627 |
| 636 // Returned user_profile might be NULL on restoring Users on browser start. | 628 // Returned user_profile might be NULL on restoring Users on browser start. |
| 637 // At some point profile is not yet fully initiated. | 629 // At some point profile is not yet fully initiated. |
| 638 if (session_started_ && user_profile && user_profile_ == user_profile) | 630 if (session_started_ && user_profile && user_profile_ == user_profile) |
| 639 ash::WmShell::Get()->UpdateAfterLoginStatusChange(GetUserLoginStatus()); | 631 ash::WmShell::Get()->UpdateAfterLoginStatusChange(GetUserLoginStatus()); |
| 640 } | 632 } |
| 641 | 633 |
| 642 ash::SystemTray* SystemTrayDelegateChromeOS::GetPrimarySystemTray() { | |
| 643 return ash::Shell::GetInstance()->GetPrimarySystemTray(); | |
| 644 } | |
| 645 | |
| 646 ash::SystemTrayNotifier* SystemTrayDelegateChromeOS::GetSystemTrayNotifier() { | 634 ash::SystemTrayNotifier* SystemTrayDelegateChromeOS::GetSystemTrayNotifier() { |
| 647 return ash::WmShell::Get()->system_tray_notifier(); | 635 return ash::WmShell::Get()->system_tray_notifier(); |
| 648 } | 636 } |
| 649 | 637 |
| 650 void SystemTrayDelegateChromeOS::SetProfile(Profile* profile) { | 638 void SystemTrayDelegateChromeOS::SetProfile(Profile* profile) { |
| 651 // Stop observing the AppWindowRegistry of the current |user_profile_|. | 639 // Stop observing the AppWindowRegistry of the current |user_profile_|. |
| 652 StopObservingAppWindowRegistry(); | 640 StopObservingAppWindowRegistry(); |
| 653 | 641 |
| 654 // Stop observing custodian info changes of the current |user_profile_|. | 642 // Stop observing custodian info changes of the current |user_profile_|. |
| 655 StopObservingCustodianInfoChanges(); | 643 StopObservingCustodianInfoChanges(); |
| (...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1066 LOG(WARNING) << "SystemTrayDelegateChromeOS::GetChildUserMessage call while " | 1054 LOG(WARNING) << "SystemTrayDelegateChromeOS::GetChildUserMessage call while " |
| 1067 << "ENABLE_SUPERVISED_USERS undefined."; | 1055 << "ENABLE_SUPERVISED_USERS undefined."; |
| 1068 return base::string16(); | 1056 return base::string16(); |
| 1069 } | 1057 } |
| 1070 | 1058 |
| 1071 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { | 1059 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { |
| 1072 return new SystemTrayDelegateChromeOS(); | 1060 return new SystemTrayDelegateChromeOS(); |
| 1073 } | 1061 } |
| 1074 | 1062 |
| 1075 } // namespace chromeos | 1063 } // namespace chromeos |
| OLD | NEW |