| 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> |
| (...skipping 10 matching lines...) Expand all Loading... |
| 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" | 25 #include "ash/common/system/tray/system_tray.h" |
| 26 #include "ash/common/system/tray/system_tray_delegate.h" | 26 #include "ash/common/system/tray/system_tray_delegate.h" |
| 27 #include "ash/common/system/tray/system_tray_notifier.h" | 27 #include "ash/common/system/tray/system_tray_notifier.h" |
| 28 #include "ash/common/system/tray_accessibility.h" | 28 #include "ash/common/system/tray_accessibility.h" |
| 29 #include "ash/common/system/update/update_observer.h" | 29 #include "ash/common/system/update/update_observer.h" |
| 30 #include "ash/common/system/user/user_observer.h" | 30 #include "ash/common/system/user/user_observer.h" |
| 31 #include "ash/common/system/volume_control_delegate.h" | |
| 32 #include "ash/common/wm_shell.h" | 31 #include "ash/common/wm_shell.h" |
| 33 #include "ash/shell.h" | 32 #include "ash/shell.h" |
| 34 #include "ash/system/chromeos/rotation/tray_rotation_lock.h" | 33 #include "ash/system/chromeos/rotation/tray_rotation_lock.h" |
| 35 #include "ash/wm/lock_state_controller.h" | 34 #include "ash/wm/lock_state_controller.h" |
| 36 #include "base/bind_helpers.h" | 35 #include "base/bind_helpers.h" |
| 37 #include "base/callback.h" | 36 #include "base/callback.h" |
| 38 #include "base/logging.h" | 37 #include "base/logging.h" |
| 39 #include "base/memory/ptr_util.h" | 38 #include "base/memory/ptr_util.h" |
| 40 #include "base/memory/weak_ptr.h" | 39 #include "base/memory/weak_ptr.h" |
| 41 #include "base/strings/stringprintf.h" | 40 #include "base/strings/stringprintf.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 66 #include "chrome/browser/lifetime/application_lifetime.h" | 65 #include "chrome/browser/lifetime/application_lifetime.h" |
| 67 #include "chrome/browser/profiles/profile_manager.h" | 66 #include "chrome/browser/profiles/profile_manager.h" |
| 68 #include "chrome/browser/supervised_user/supervised_user_service.h" | 67 #include "chrome/browser/supervised_user/supervised_user_service.h" |
| 69 #include "chrome/browser/supervised_user/supervised_user_service_factory.h" | 68 #include "chrome/browser/supervised_user/supervised_user_service_factory.h" |
| 70 #include "chrome/browser/ui/ash/cast_config_delegate_chromeos.h" | 69 #include "chrome/browser/ui/ash/cast_config_delegate_chromeos.h" |
| 71 #include "chrome/browser/ui/ash/cast_config_delegate_media_router.h" | 70 #include "chrome/browser/ui/ash/cast_config_delegate_media_router.h" |
| 72 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" | 71 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" |
| 73 #include "chrome/browser/ui/ash/networking_config_delegate_chromeos.h" | 72 #include "chrome/browser/ui/ash/networking_config_delegate_chromeos.h" |
| 74 #include "chrome/browser/ui/ash/system_tray_client.h" | 73 #include "chrome/browser/ui/ash/system_tray_client.h" |
| 75 #include "chrome/browser/ui/ash/system_tray_delegate_utils.h" | 74 #include "chrome/browser/ui/ash/system_tray_delegate_utils.h" |
| 76 #include "chrome/browser/ui/ash/volume_controller_chromeos.h" | |
| 77 #include "chrome/browser/ui/ash/vpn_delegate_chromeos.h" | 75 #include "chrome/browser/ui/ash/vpn_delegate_chromeos.h" |
| 78 #include "chrome/browser/ui/browser.h" | 76 #include "chrome/browser/ui/browser.h" |
| 79 #include "chrome/browser/ui/browser_list.h" | 77 #include "chrome/browser/ui/browser_list.h" |
| 80 #include "chrome/browser/ui/chrome_pages.h" | 78 #include "chrome/browser/ui/chrome_pages.h" |
| 81 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" | 79 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" |
| 82 #include "chrome/browser/ui/singleton_tabs.h" | 80 #include "chrome/browser/ui/singleton_tabs.h" |
| 83 #include "chrome/browser/upgrade_detector.h" | 81 #include "chrome/browser/upgrade_detector.h" |
| 84 #include "chrome/common/chrome_switches.h" | 82 #include "chrome/common/chrome_switches.h" |
| 85 #include "chrome/common/pref_names.h" | 83 #include "chrome/common/pref_names.h" |
| 86 #include "chrome/common/url_constants.h" | 84 #include "chrome/common/url_constants.h" |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 | 163 |
| 166 SystemTrayDelegateChromeOS::SystemTrayDelegateChromeOS() | 164 SystemTrayDelegateChromeOS::SystemTrayDelegateChromeOS() |
| 167 : user_profile_(NULL), | 165 : user_profile_(NULL), |
| 168 search_key_mapped_to_(input_method::kSearchKey), | 166 search_key_mapped_to_(input_method::kSearchKey), |
| 169 have_session_start_time_(false), | 167 have_session_start_time_(false), |
| 170 have_session_length_limit_(false), | 168 have_session_length_limit_(false), |
| 171 should_run_bluetooth_discovery_(false), | 169 should_run_bluetooth_discovery_(false), |
| 172 session_started_(false), | 170 session_started_(false), |
| 173 cast_config_delegate_(nullptr), | 171 cast_config_delegate_(nullptr), |
| 174 networking_config_delegate_(new NetworkingConfigDelegateChromeos()), | 172 networking_config_delegate_(new NetworkingConfigDelegateChromeos()), |
| 175 volume_control_delegate_(new VolumeController()), | |
| 176 vpn_delegate_(new VPNDelegateChromeOS), | 173 vpn_delegate_(new VPNDelegateChromeOS), |
| 177 weak_ptr_factory_(this) { | 174 weak_ptr_factory_(this) { |
| 178 // Register notifications on construction so that events such as | 175 // Register notifications on construction so that events such as |
| 179 // PROFILE_CREATED do not get missed if they happen before Initialize(). | 176 // PROFILE_CREATED do not get missed if they happen before Initialize(). |
| 180 registrar_.reset(new content::NotificationRegistrar); | 177 registrar_.reset(new content::NotificationRegistrar); |
| 181 registrar_->Add(this, | 178 registrar_->Add(this, |
| 182 chrome::NOTIFICATION_UPGRADE_RECOMMENDED, | 179 chrome::NOTIFICATION_UPGRADE_RECOMMENDED, |
| 183 content::NotificationService::AllSources()); | 180 content::NotificationService::AllSources()); |
| 184 registrar_->Add(this, | 181 registrar_->Add(this, |
| 185 chrome::NOTIFICATION_LOGIN_USER_IMAGE_CHANGED, | 182 chrome::NOTIFICATION_LOGIN_USER_IMAGE_CHANGED, |
| (...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 596 if (!cast_config_delegate_) | 593 if (!cast_config_delegate_) |
| 597 cast_config_delegate_ = CreateCastConfigDelegate(); | 594 cast_config_delegate_ = CreateCastConfigDelegate(); |
| 598 return cast_config_delegate_.get(); | 595 return cast_config_delegate_.get(); |
| 599 } | 596 } |
| 600 | 597 |
| 601 ash::NetworkingConfigDelegate* | 598 ash::NetworkingConfigDelegate* |
| 602 SystemTrayDelegateChromeOS::GetNetworkingConfigDelegate() const { | 599 SystemTrayDelegateChromeOS::GetNetworkingConfigDelegate() const { |
| 603 return networking_config_delegate_.get(); | 600 return networking_config_delegate_.get(); |
| 604 } | 601 } |
| 605 | 602 |
| 606 ash::VolumeControlDelegate* | |
| 607 SystemTrayDelegateChromeOS::GetVolumeControlDelegate() const { | |
| 608 return volume_control_delegate_.get(); | |
| 609 } | |
| 610 | |
| 611 void SystemTrayDelegateChromeOS::SetVolumeControlDelegate( | |
| 612 std::unique_ptr<ash::VolumeControlDelegate> delegate) { | |
| 613 volume_control_delegate_.swap(delegate); | |
| 614 } | |
| 615 | |
| 616 bool SystemTrayDelegateChromeOS::GetSessionStartTime( | 603 bool SystemTrayDelegateChromeOS::GetSessionStartTime( |
| 617 base::TimeTicks* session_start_time) { | 604 base::TimeTicks* session_start_time) { |
| 618 *session_start_time = session_start_time_; | 605 *session_start_time = session_start_time_; |
| 619 return have_session_start_time_; | 606 return have_session_start_time_; |
| 620 } | 607 } |
| 621 | 608 |
| 622 bool SystemTrayDelegateChromeOS::GetSessionLengthLimit( | 609 bool SystemTrayDelegateChromeOS::GetSessionLengthLimit( |
| 623 base::TimeDelta* session_length_limit) { | 610 base::TimeDelta* session_length_limit) { |
| 624 *session_length_limit = session_length_limit_; | 611 *session_length_limit = session_length_limit_; |
| 625 return have_session_length_limit_; | 612 return have_session_length_limit_; |
| (...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1124 LOG(WARNING) << "SystemTrayDelegateChromeOS::GetChildUserMessage call while " | 1111 LOG(WARNING) << "SystemTrayDelegateChromeOS::GetChildUserMessage call while " |
| 1125 << "ENABLE_SUPERVISED_USERS undefined."; | 1112 << "ENABLE_SUPERVISED_USERS undefined."; |
| 1126 return base::string16(); | 1113 return base::string16(); |
| 1127 } | 1114 } |
| 1128 | 1115 |
| 1129 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { | 1116 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { |
| 1130 return new SystemTrayDelegateChromeOS(); | 1117 return new SystemTrayDelegateChromeOS(); |
| 1131 } | 1118 } |
| 1132 | 1119 |
| 1133 } // namespace chromeos | 1120 } // namespace chromeos |
| OLD | NEW |