Chromium Code Reviews| 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 OnAcceptMultiprofilesIntro(bool no_show_again) { | 141 void OnAcceptMultiprofilesIntro(bool no_show_again) { |
| 149 PrefService* prefs = ProfileManager::GetActiveUserProfile()->GetPrefs(); | 142 PrefService* prefs = ProfileManager::GetActiveUserProfile()->GetPrefs(); |
| 150 prefs->SetBoolean(prefs::kMultiProfileNeverShowIntro, no_show_again); | 143 prefs->SetBoolean(prefs::kMultiProfileNeverShowIntro, no_show_again); |
| 151 UserAddingScreen::Get()->Start(); | 144 UserAddingScreen::Get()->Start(); |
| 152 } | 145 } |
| 153 | 146 |
| 154 } // namespace | 147 } // namespace |
| 155 | 148 |
| 156 SystemTrayDelegateChromeOS::SystemTrayDelegateChromeOS() | 149 SystemTrayDelegateChromeOS::SystemTrayDelegateChromeOS() |
| 157 : user_profile_(NULL), | 150 : user_profile_(NULL), |
|
achuithb
2016/11/02 19:22:02
If you could move the initialization in the .h, ei
jdufault
2016/11/02 19:37:45
Done.
| |
| 158 search_key_mapped_to_(input_method::kSearchKey), | 151 search_key_mapped_to_(input_method::kSearchKey), |
| 159 have_session_start_time_(false), | 152 have_session_start_time_(false), |
| 160 have_session_length_limit_(false), | 153 have_session_length_limit_(false), |
| 161 should_run_bluetooth_discovery_(false), | 154 should_run_bluetooth_discovery_(false), |
| 162 session_started_(false), | 155 session_started_(false), |
| 163 cast_config_delegate_(nullptr), | 156 cast_config_delegate_(base::MakeUnique<CastConfigDelegateMediaRouter>()), |
| 164 networking_config_delegate_(new NetworkingConfigDelegateChromeos()), | 157 networking_config_delegate_(new NetworkingConfigDelegateChromeos()), |
| 165 vpn_delegate_(new VPNDelegateChromeOS), | 158 vpn_delegate_(new VPNDelegateChromeOS), |
| 166 weak_ptr_factory_(this) { | 159 weak_ptr_factory_(this) { |
| 167 // Register notifications on construction so that events such as | 160 // Register notifications on construction so that events such as |
| 168 // PROFILE_CREATED do not get missed if they happen before Initialize(). | 161 // PROFILE_CREATED do not get missed if they happen before Initialize(). |
| 169 registrar_.reset(new content::NotificationRegistrar); | 162 registrar_.reset(new content::NotificationRegistrar); |
| 170 registrar_->Add(this, | 163 registrar_->Add(this, |
| 171 chrome::NOTIFICATION_UPGRADE_RECOMMENDED, | 164 chrome::NOTIFICATION_UPGRADE_RECOMMENDED, |
| 172 content::NotificationService::AllSources()); | 165 content::NotificationService::AllSources()); |
| 173 registrar_->Add(this, | 166 registrar_->Add(this, |
| (...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 559 bool SystemTrayDelegateChromeOS::GetBluetoothEnabled() { | 552 bool SystemTrayDelegateChromeOS::GetBluetoothEnabled() { |
| 560 return bluetooth_adapter_ && bluetooth_adapter_->IsPowered(); | 553 return bluetooth_adapter_ && bluetooth_adapter_->IsPowered(); |
| 561 } | 554 } |
| 562 | 555 |
| 563 bool SystemTrayDelegateChromeOS::GetBluetoothDiscovering() { | 556 bool SystemTrayDelegateChromeOS::GetBluetoothDiscovering() { |
| 564 return bluetooth_discovery_session_ && | 557 return bluetooth_discovery_session_ && |
| 565 bluetooth_discovery_session_->IsActive(); | 558 bluetooth_discovery_session_->IsActive(); |
| 566 } | 559 } |
| 567 | 560 |
| 568 ash::CastConfigDelegate* SystemTrayDelegateChromeOS::GetCastConfigDelegate() { | 561 ash::CastConfigDelegate* SystemTrayDelegateChromeOS::GetCastConfigDelegate() { |
| 569 if (!cast_config_delegate_) | |
| 570 cast_config_delegate_ = CreateCastConfigDelegate(); | |
| 571 return cast_config_delegate_.get(); | 562 return cast_config_delegate_.get(); |
| 572 } | 563 } |
| 573 | 564 |
| 574 ash::NetworkingConfigDelegate* | 565 ash::NetworkingConfigDelegate* |
| 575 SystemTrayDelegateChromeOS::GetNetworkingConfigDelegate() const { | 566 SystemTrayDelegateChromeOS::GetNetworkingConfigDelegate() const { |
| 576 return networking_config_delegate_.get(); | 567 return networking_config_delegate_.get(); |
| 577 } | 568 } |
| 578 | 569 |
| 579 bool SystemTrayDelegateChromeOS::GetSessionStartTime( | 570 bool SystemTrayDelegateChromeOS::GetSessionStartTime( |
| 580 base::TimeTicks* session_start_time) { | 571 base::TimeTicks* session_start_time) { |
| (...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1076 LOG(WARNING) << "SystemTrayDelegateChromeOS::GetChildUserMessage call while " | 1067 LOG(WARNING) << "SystemTrayDelegateChromeOS::GetChildUserMessage call while " |
| 1077 << "ENABLE_SUPERVISED_USERS undefined."; | 1068 << "ENABLE_SUPERVISED_USERS undefined."; |
| 1078 return base::string16(); | 1069 return base::string16(); |
| 1079 } | 1070 } |
| 1080 | 1071 |
| 1081 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { | 1072 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { |
| 1082 return new SystemTrayDelegateChromeOS(); | 1073 return new SystemTrayDelegateChromeOS(); |
| 1083 } | 1074 } |
| 1084 | 1075 |
| 1085 } // namespace chromeos | 1076 } // namespace chromeos |
| OLD | NEW |