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 <memory> | 10 #include <memory> |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 247 } | 247 } |
| 248 | 248 |
| 249 ash::LoginStatus SystemTrayDelegateChromeOS::GetUserLoginStatus() const { | 249 ash::LoginStatus SystemTrayDelegateChromeOS::GetUserLoginStatus() const { |
| 250 return SystemTrayClient::GetUserLoginStatus(); | 250 return SystemTrayClient::GetUserLoginStatus(); |
| 251 } | 251 } |
| 252 | 252 |
| 253 std::string SystemTrayDelegateChromeOS::GetEnterpriseDomain() const { | 253 std::string SystemTrayDelegateChromeOS::GetEnterpriseDomain() const { |
| 254 return enterprise_domain_; | 254 return enterprise_domain_; |
| 255 } | 255 } |
| 256 | 256 |
| 257 std::string SystemTrayDelegateChromeOS::GetEnterpriseRealm() const { | |
| 258 return enterprise_realm_; | |
| 259 } | |
| 260 | |
| 261 base::string16 SystemTrayDelegateChromeOS::GetEnterpriseMessage() const { | 257 base::string16 SystemTrayDelegateChromeOS::GetEnterpriseMessage() const { |
| 262 if (!GetEnterpriseRealm().empty()) { | 258 if (is_active_directory_managed_) { |
| 263 // TODO(rsorokin): Maybe change a message for the Active Directory devices. | 259 return l10n_util::GetStringUTF16(IDS_DEVICE_ENTERPRISE_MANAGED_NOTICE); |
| 264 return l10n_util::GetStringFUTF16(IDS_DEVICE_OWNED_BY_NOTICE, | |
| 265 base::UTF8ToUTF16(GetEnterpriseRealm())); | |
| 266 } | 260 } |
|
stevenjb
2016/12/22 19:09:29
nit: {} not needed here
Roman Sorokin (ftl)
2016/12/23 09:12:05
Done.
| |
| 267 if (!GetEnterpriseDomain().empty()) { | 261 if (!GetEnterpriseDomain().empty()) { |
| 268 return l10n_util::GetStringFUTF16(IDS_DEVICE_OWNED_BY_NOTICE, | 262 return l10n_util::GetStringFUTF16(IDS_DEVICE_OWNED_BY_NOTICE, |
| 269 base::UTF8ToUTF16(GetEnterpriseDomain())); | 263 base::UTF8ToUTF16(GetEnterpriseDomain())); |
| 270 } | 264 } |
| 271 return base::string16(); | 265 return base::string16(); |
| 272 } | 266 } |
| 273 | 267 |
| 274 std::string SystemTrayDelegateChromeOS::GetSupervisedUserManager() const { | 268 std::string SystemTrayDelegateChromeOS::GetSupervisedUserManager() const { |
| 275 if (!IsUserSupervised()) | 269 if (!IsUserSupervised()) |
| 276 return std::string(); | 270 return std::string(); |
| (...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 863 if (!should_run_bluetooth_discovery_) | 857 if (!should_run_bluetooth_discovery_) |
| 864 return; | 858 return; |
| 865 VLOG(1) << "Claiming new Bluetooth device discovery session."; | 859 VLOG(1) << "Claiming new Bluetooth device discovery session."; |
| 866 bluetooth_discovery_session_ = std::move(discovery_session); | 860 bluetooth_discovery_session_ = std::move(discovery_session); |
| 867 GetSystemTrayNotifier()->NotifyBluetoothDiscoveringChanged(); | 861 GetSystemTrayNotifier()->NotifyBluetoothDiscoveringChanged(); |
| 868 } | 862 } |
| 869 | 863 |
| 870 void SystemTrayDelegateChromeOS::UpdateEnterpriseDomain() { | 864 void SystemTrayDelegateChromeOS::UpdateEnterpriseDomain() { |
| 871 policy::BrowserPolicyConnectorChromeOS* connector = | 865 policy::BrowserPolicyConnectorChromeOS* connector = |
| 872 g_browser_process->platform_part()->browser_policy_connector_chromeos(); | 866 g_browser_process->platform_part()->browser_policy_connector_chromeos(); |
| 873 std::string enterprise_domain = connector->GetEnterpriseDomain(); | 867 std::string old_enterprise_domain(std::move(enterprise_domain_)); |
| 874 std::string enterprise_realm = connector->GetRealm(); | 868 enterprise_domain_ = connector->GetEnterpriseDomain(); |
| 875 if (enterprise_domain_ != enterprise_domain || | 869 bool old_is_active_directory_managed = is_active_directory_managed_; |
| 876 enterprise_realm_ != enterprise_realm) { | 870 is_active_directory_managed_ = connector->IsActiveDirectoryManaged(); |
| 877 enterprise_domain_ = enterprise_domain; | 871 if ((!is_active_directory_managed_ && |
| 878 enterprise_realm_ = enterprise_realm; | 872 enterprise_domain_ != old_enterprise_domain) || |
| 873 (is_active_directory_managed_ != old_is_active_directory_managed)) { | |
| 879 GetSystemTrayNotifier()->NotifyEnterpriseDomainChanged(); | 874 GetSystemTrayNotifier()->NotifyEnterpriseDomainChanged(); |
| 880 } | 875 } |
| 881 } | 876 } |
| 882 | 877 |
| 883 // Overridden from CloudPolicyStore::Observer | 878 // Overridden from CloudPolicyStore::Observer |
| 884 void SystemTrayDelegateChromeOS::OnStoreLoaded( | 879 void SystemTrayDelegateChromeOS::OnStoreLoaded( |
| 885 policy::CloudPolicyStore* store) { | 880 policy::CloudPolicyStore* store) { |
| 886 UpdateEnterpriseDomain(); | 881 UpdateEnterpriseDomain(); |
| 887 } | 882 } |
| 888 | 883 |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 976 LOG(WARNING) << "SystemTrayDelegateChromeOS::GetChildUserMessage call while " | 971 LOG(WARNING) << "SystemTrayDelegateChromeOS::GetChildUserMessage call while " |
| 977 << "ENABLE_SUPERVISED_USERS undefined."; | 972 << "ENABLE_SUPERVISED_USERS undefined."; |
| 978 return base::string16(); | 973 return base::string16(); |
| 979 } | 974 } |
| 980 | 975 |
| 981 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { | 976 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { |
| 982 return new SystemTrayDelegateChromeOS(); | 977 return new SystemTrayDelegateChromeOS(); |
| 983 } | 978 } |
| 984 | 979 |
| 985 } // namespace chromeos | 980 } // namespace chromeos |
| OLD | NEW |