Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(127)

Side by Side Diff: chrome/browser/ui/ash/system_tray_delegate_chromeos.cc

Issue 2587453002: Chromad: Use different enterprise messaging in tray bubble. (Closed)
Patch Set: Notify when IsActiveDirectoryManaged changed or it stayed false and enterprise domain changed. Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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_OWNED_BY_AD_NOTICE);
264 return l10n_util::GetStringFUTF16(IDS_DEVICE_OWNED_BY_NOTICE, 260 } else if (!GetEnterpriseDomain().empty()) {
stevenjb 2016/12/21 18:18:04 No else
Roman Sorokin (ftl) 2016/12/22 11:18:11 Done.
265 base::UTF8ToUTF16(GetEnterpriseRealm()));
266 }
267 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();
277 return SupervisedUserServiceFactory::GetForProfile(user_profile_)-> 270 return SupervisedUserServiceFactory::GetForProfile(user_profile_)->
(...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after
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_) {
oshima 2016/12/21 22:11:33 Isn't this if ((is_active_directory_managed_ && e
Roman Sorokin (ftl) 2016/12/22 11:18:11 True. But slightly different if ((!is_active_direc
878 enterprise_realm_ = enterprise_realm; 871 if (old_is_active_directory_managed)
879 GetSystemTrayNotifier()->NotifyEnterpriseDomainChanged(); 872 return;
873 } else {
874 if (!old_is_active_directory_managed &&
875 enterprise_domain_ == old_enterprise_domain) {
876 return;
877 }
880 } 878 }
879 GetSystemTrayNotifier()->NotifyEnterpriseDomainChanged();
881 } 880 }
882 881
883 // Overridden from CloudPolicyStore::Observer 882 // Overridden from CloudPolicyStore::Observer
884 void SystemTrayDelegateChromeOS::OnStoreLoaded( 883 void SystemTrayDelegateChromeOS::OnStoreLoaded(
885 policy::CloudPolicyStore* store) { 884 policy::CloudPolicyStore* store) {
886 UpdateEnterpriseDomain(); 885 UpdateEnterpriseDomain();
887 } 886 }
888 887
889 void SystemTrayDelegateChromeOS::OnStoreError(policy::CloudPolicyStore* store) { 888 void SystemTrayDelegateChromeOS::OnStoreError(policy::CloudPolicyStore* store) {
890 UpdateEnterpriseDomain(); 889 UpdateEnterpriseDomain();
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
976 LOG(WARNING) << "SystemTrayDelegateChromeOS::GetChildUserMessage call while " 975 LOG(WARNING) << "SystemTrayDelegateChromeOS::GetChildUserMessage call while "
977 << "ENABLE_SUPERVISED_USERS undefined."; 976 << "ENABLE_SUPERVISED_USERS undefined.";
978 return base::string16(); 977 return base::string16();
979 } 978 }
980 979
981 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { 980 ash::SystemTrayDelegate* CreateSystemTrayDelegate() {
982 return new SystemTrayDelegateChromeOS(); 981 return new SystemTrayDelegateChromeOS();
983 } 982 }
984 983
985 } // namespace chromeos 984 } // namespace chromeos
OLDNEW
« chrome/app/chromeos_strings.grdp ('K') | « chrome/browser/ui/ash/system_tray_delegate_chromeos.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698