| 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 #include "chrome/browser/chromeos/login/users/supervised_user_manager.h" | 57 #include "chrome/browser/chromeos/login/users/supervised_user_manager.h" |
| 58 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | 58 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
| 59 #include "chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.h" | 59 #include "chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.h" |
| 60 #include "chrome/browser/chromeos/profiles/multiprofiles_intro_dialog.h" | 60 #include "chrome/browser/chromeos/profiles/multiprofiles_intro_dialog.h" |
| 61 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 61 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| 62 #include "chrome/browser/chromeos/settings/cros_settings.h" | 62 #include "chrome/browser/chromeos/settings/cros_settings.h" |
| 63 #include "chrome/browser/lifetime/application_lifetime.h" | 63 #include "chrome/browser/lifetime/application_lifetime.h" |
| 64 #include "chrome/browser/profiles/profile_manager.h" | 64 #include "chrome/browser/profiles/profile_manager.h" |
| 65 #include "chrome/browser/supervised_user/supervised_user_service.h" | 65 #include "chrome/browser/supervised_user/supervised_user_service.h" |
| 66 #include "chrome/browser/supervised_user/supervised_user_service_factory.h" | 66 #include "chrome/browser/supervised_user/supervised_user_service_factory.h" |
| 67 #include "chrome/browser/ui/ash/cast_config_delegate_chromeos.h" | |
| 68 #include "chrome/browser/ui/ash/cast_config_delegate_media_router.h" | 67 #include "chrome/browser/ui/ash/cast_config_delegate_media_router.h" |
| 69 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" | 68 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" |
| 70 #include "chrome/browser/ui/ash/networking_config_delegate_chromeos.h" | 69 #include "chrome/browser/ui/ash/networking_config_delegate_chromeos.h" |
| 71 #include "chrome/browser/ui/ash/system_tray_client.h" | 70 #include "chrome/browser/ui/ash/system_tray_client.h" |
| 72 #include "chrome/browser/ui/ash/system_tray_delegate_utils.h" | 71 #include "chrome/browser/ui/ash/system_tray_delegate_utils.h" |
| 73 #include "chrome/browser/ui/ash/vpn_delegate_chromeos.h" | 72 #include "chrome/browser/ui/ash/vpn_delegate_chromeos.h" |
| 74 #include "chrome/browser/ui/browser.h" | 73 #include "chrome/browser/ui/browser.h" |
| 75 #include "chrome/browser/ui/browser_list.h" | 74 #include "chrome/browser/ui/browser_list.h" |
| 76 #include "chrome/browser/ui/chrome_pages.h" | 75 #include "chrome/browser/ui/chrome_pages.h" |
| 77 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" | 76 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 } | 131 } |
| 133 | 132 |
| 134 void BluetoothSetDiscoveringError() { | 133 void BluetoothSetDiscoveringError() { |
| 135 LOG(ERROR) << "BluetoothSetDiscovering failed."; | 134 LOG(ERROR) << "BluetoothSetDiscovering failed."; |
| 136 } | 135 } |
| 137 | 136 |
| 138 void BluetoothDeviceConnectError( | 137 void BluetoothDeviceConnectError( |
| 139 device::BluetoothDevice::ConnectErrorCode error_code) { | 138 device::BluetoothDevice::ConnectErrorCode error_code) { |
| 140 } | 139 } |
| 141 | 140 |
| 142 std::unique_ptr<ash::CastConfigDelegate> CreateCastConfigDelegate() { | |
| 143 if (CastConfigDelegateMediaRouter::IsEnabled()) | |
| 144 return base::MakeUnique<CastConfigDelegateMediaRouter>(); | |
| 145 return base::MakeUnique<CastConfigDelegateChromeos>(); | |
| 146 } | |
| 147 | |
| 148 void ShowSettingsSubPageForActiveUser(const std::string& sub_page) { | 141 void ShowSettingsSubPageForActiveUser(const std::string& sub_page) { |
| 149 chrome::ShowSettingsSubPageForProfile( | 142 chrome::ShowSettingsSubPageForProfile( |
| 150 ProfileManager::GetActiveUserProfile(), sub_page); | 143 ProfileManager::GetActiveUserProfile(), sub_page); |
| 151 } | 144 } |
| 152 | 145 |
| 153 void OnAcceptMultiprofilesIntro(bool no_show_again) { | 146 void OnAcceptMultiprofilesIntro(bool no_show_again) { |
| 154 PrefService* prefs = ProfileManager::GetActiveUserProfile()->GetPrefs(); | 147 PrefService* prefs = ProfileManager::GetActiveUserProfile()->GetPrefs(); |
| 155 prefs->SetBoolean(prefs::kMultiProfileNeverShowIntro, no_show_again); | 148 prefs->SetBoolean(prefs::kMultiProfileNeverShowIntro, no_show_again); |
| 156 UserAddingScreen::Get()->Start(); | 149 UserAddingScreen::Get()->Start(); |
| 157 } | 150 } |
| 158 | 151 |
| 159 } // namespace | 152 } // namespace |
| 160 | 153 |
| 161 SystemTrayDelegateChromeOS::SystemTrayDelegateChromeOS() | 154 SystemTrayDelegateChromeOS::SystemTrayDelegateChromeOS() |
| 162 : user_profile_(NULL), | 155 : user_profile_(NULL), |
| 163 search_key_mapped_to_(input_method::kSearchKey), | 156 search_key_mapped_to_(input_method::kSearchKey), |
| 164 have_session_start_time_(false), | 157 have_session_start_time_(false), |
| 165 have_session_length_limit_(false), | 158 have_session_length_limit_(false), |
| 166 should_run_bluetooth_discovery_(false), | 159 should_run_bluetooth_discovery_(false), |
| 167 session_started_(false), | 160 session_started_(false), |
| 168 cast_config_delegate_(nullptr), | 161 cast_config_delegate_(base::MakeUnique<CastConfigDelegateMediaRouter>()), |
| 169 networking_config_delegate_(new NetworkingConfigDelegateChromeos()), | 162 networking_config_delegate_(new NetworkingConfigDelegateChromeos()), |
| 170 vpn_delegate_(new VPNDelegateChromeOS), | 163 vpn_delegate_(new VPNDelegateChromeOS), |
| 171 weak_ptr_factory_(this) { | 164 weak_ptr_factory_(this) { |
| 172 // Register notifications on construction so that events such as | 165 // Register notifications on construction so that events such as |
| 173 // PROFILE_CREATED do not get missed if they happen before Initialize(). | 166 // PROFILE_CREATED do not get missed if they happen before Initialize(). |
| 174 registrar_.reset(new content::NotificationRegistrar); | 167 registrar_.reset(new content::NotificationRegistrar); |
| 175 registrar_->Add(this, | 168 registrar_->Add(this, |
| 176 chrome::NOTIFICATION_UPGRADE_RECOMMENDED, | 169 chrome::NOTIFICATION_UPGRADE_RECOMMENDED, |
| 177 content::NotificationService::AllSources()); | 170 content::NotificationService::AllSources()); |
| 178 registrar_->Add(this, | 171 registrar_->Add(this, |
| (...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 566 bool SystemTrayDelegateChromeOS::GetBluetoothEnabled() { | 559 bool SystemTrayDelegateChromeOS::GetBluetoothEnabled() { |
| 567 return bluetooth_adapter_ && bluetooth_adapter_->IsPowered(); | 560 return bluetooth_adapter_ && bluetooth_adapter_->IsPowered(); |
| 568 } | 561 } |
| 569 | 562 |
| 570 bool SystemTrayDelegateChromeOS::GetBluetoothDiscovering() { | 563 bool SystemTrayDelegateChromeOS::GetBluetoothDiscovering() { |
| 571 return bluetooth_discovery_session_ && | 564 return bluetooth_discovery_session_ && |
| 572 bluetooth_discovery_session_->IsActive(); | 565 bluetooth_discovery_session_->IsActive(); |
| 573 } | 566 } |
| 574 | 567 |
| 575 ash::CastConfigDelegate* SystemTrayDelegateChromeOS::GetCastConfigDelegate() { | 568 ash::CastConfigDelegate* SystemTrayDelegateChromeOS::GetCastConfigDelegate() { |
| 576 if (!cast_config_delegate_) | |
| 577 cast_config_delegate_ = CreateCastConfigDelegate(); | |
| 578 return cast_config_delegate_.get(); | 569 return cast_config_delegate_.get(); |
| 579 } | 570 } |
| 580 | 571 |
| 581 ash::NetworkingConfigDelegate* | 572 ash::NetworkingConfigDelegate* |
| 582 SystemTrayDelegateChromeOS::GetNetworkingConfigDelegate() const { | 573 SystemTrayDelegateChromeOS::GetNetworkingConfigDelegate() const { |
| 583 return networking_config_delegate_.get(); | 574 return networking_config_delegate_.get(); |
| 584 } | 575 } |
| 585 | 576 |
| 586 bool SystemTrayDelegateChromeOS::GetSessionStartTime( | 577 bool SystemTrayDelegateChromeOS::GetSessionStartTime( |
| 587 base::TimeTicks* session_start_time) { | 578 base::TimeTicks* session_start_time) { |
| (...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1089 LOG(WARNING) << "SystemTrayDelegateChromeOS::GetChildUserMessage call while " | 1080 LOG(WARNING) << "SystemTrayDelegateChromeOS::GetChildUserMessage call while " |
| 1090 << "ENABLE_SUPERVISED_USERS undefined."; | 1081 << "ENABLE_SUPERVISED_USERS undefined."; |
| 1091 return base::string16(); | 1082 return base::string16(); |
| 1092 } | 1083 } |
| 1093 | 1084 |
| 1094 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { | 1085 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { |
| 1095 return new SystemTrayDelegateChromeOS(); | 1086 return new SystemTrayDelegateChromeOS(); |
| 1096 } | 1087 } |
| 1097 | 1088 |
| 1098 } // namespace chromeos | 1089 } // namespace chromeos |
| OLD | NEW |