| 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 } | |
| 267 if (!GetEnterpriseDomain().empty()) { | 260 if (!GetEnterpriseDomain().empty()) { |
| 268 return l10n_util::GetStringFUTF16(IDS_DEVICE_OWNED_BY_NOTICE, | 261 return l10n_util::GetStringFUTF16(IDS_DEVICE_OWNED_BY_NOTICE, |
| 269 base::UTF8ToUTF16(GetEnterpriseDomain())); | 262 base::UTF8ToUTF16(GetEnterpriseDomain())); |
| 270 } | 263 } |
| 271 return base::string16(); | 264 return base::string16(); |
| 272 } | 265 } |
| 273 | 266 |
| 274 std::string SystemTrayDelegateChromeOS::GetSupervisedUserManager() const { | 267 std::string SystemTrayDelegateChromeOS::GetSupervisedUserManager() const { |
| 275 if (!IsUserSupervised()) | 268 if (!IsUserSupervised()) |
| 276 return std::string(); | 269 return std::string(); |
| (...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 863 if (!should_run_bluetooth_discovery_) | 856 if (!should_run_bluetooth_discovery_) |
| 864 return; | 857 return; |
| 865 VLOG(1) << "Claiming new Bluetooth device discovery session."; | 858 VLOG(1) << "Claiming new Bluetooth device discovery session."; |
| 866 bluetooth_discovery_session_ = std::move(discovery_session); | 859 bluetooth_discovery_session_ = std::move(discovery_session); |
| 867 GetSystemTrayNotifier()->NotifyBluetoothDiscoveringChanged(); | 860 GetSystemTrayNotifier()->NotifyBluetoothDiscoveringChanged(); |
| 868 } | 861 } |
| 869 | 862 |
| 870 void SystemTrayDelegateChromeOS::UpdateEnterpriseDomain() { | 863 void SystemTrayDelegateChromeOS::UpdateEnterpriseDomain() { |
| 871 policy::BrowserPolicyConnectorChromeOS* connector = | 864 policy::BrowserPolicyConnectorChromeOS* connector = |
| 872 g_browser_process->platform_part()->browser_policy_connector_chromeos(); | 865 g_browser_process->platform_part()->browser_policy_connector_chromeos(); |
| 873 std::string enterprise_domain = connector->GetEnterpriseDomain(); | 866 std::string old_enterprise_domain(std::move(enterprise_domain_)); |
| 874 std::string enterprise_realm = connector->GetRealm(); | 867 enterprise_domain_ = connector->GetEnterpriseDomain(); |
| 875 if (enterprise_domain_ != enterprise_domain || | 868 bool old_is_active_directory_managed = is_active_directory_managed_; |
| 876 enterprise_realm_ != enterprise_realm) { | 869 is_active_directory_managed_ = connector->IsActiveDirectoryManaged(); |
| 877 enterprise_domain_ = enterprise_domain; | 870 if ((!is_active_directory_managed_ && |
| 878 enterprise_realm_ = enterprise_realm; | 871 enterprise_domain_ != old_enterprise_domain) || |
| 872 (is_active_directory_managed_ != old_is_active_directory_managed)) { |
| 879 GetSystemTrayNotifier()->NotifyEnterpriseDomainChanged(); | 873 GetSystemTrayNotifier()->NotifyEnterpriseDomainChanged(); |
| 880 } | 874 } |
| 881 } | 875 } |
| 882 | 876 |
| 883 // Overridden from CloudPolicyStore::Observer | 877 // Overridden from CloudPolicyStore::Observer |
| 884 void SystemTrayDelegateChromeOS::OnStoreLoaded( | 878 void SystemTrayDelegateChromeOS::OnStoreLoaded( |
| 885 policy::CloudPolicyStore* store) { | 879 policy::CloudPolicyStore* store) { |
| 886 UpdateEnterpriseDomain(); | 880 UpdateEnterpriseDomain(); |
| 887 } | 881 } |
| 888 | 882 |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 976 LOG(WARNING) << "SystemTrayDelegateChromeOS::GetChildUserMessage call while " | 970 LOG(WARNING) << "SystemTrayDelegateChromeOS::GetChildUserMessage call while " |
| 977 << "ENABLE_SUPERVISED_USERS undefined."; | 971 << "ENABLE_SUPERVISED_USERS undefined."; |
| 978 return base::string16(); | 972 return base::string16(); |
| 979 } | 973 } |
| 980 | 974 |
| 981 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { | 975 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { |
| 982 return new SystemTrayDelegateChromeOS(); | 976 return new SystemTrayDelegateChromeOS(); |
| 983 } | 977 } |
| 984 | 978 |
| 985 } // namespace chromeos | 979 } // namespace chromeos |
| OLD | NEW |