| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/webui/help/help_handler.h" | 5 #include "chrome/browser/ui/webui/help/help_handler.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 // On a managed machine we delegate this setting to the users of the same | 122 // On a managed machine we delegate this setting to the users of the same |
| 123 // domain only if the policy value is "domain". | 123 // domain only if the policy value is "domain". |
| 124 if (IsEnterpriseManaged()) { | 124 if (IsEnterpriseManaged()) { |
| 125 if (!value) | 125 if (!value) |
| 126 return false; | 126 return false; |
| 127 // Get the currently logged in user and strip the domain part only. | 127 // Get the currently logged in user and strip the domain part only. |
| 128 std::string domain = ""; | 128 std::string domain = ""; |
| 129 const user_manager::User* user = | 129 const user_manager::User* user = |
| 130 profile ? chromeos::ProfileHelper::Get()->GetUserByProfile(profile) | 130 profile ? chromeos::ProfileHelper::Get()->GetUserByProfile(profile) |
| 131 : nullptr; | 131 : nullptr; |
| 132 std::string email = user ? user->email() : std::string(); | 132 std::string email = |
| 133 user ? user->GetAccountId().GetUserEmail() : std::string(); |
| 133 size_t at_pos = email.find('@'); | 134 size_t at_pos = email.find('@'); |
| 134 if (at_pos != std::string::npos && at_pos + 1 < email.length()) | 135 if (at_pos != std::string::npos && at_pos + 1 < email.length()) |
| 135 domain = email.substr(email.find('@') + 1); | 136 domain = email.substr(email.find('@') + 1); |
| 136 policy::BrowserPolicyConnectorChromeOS* connector = | 137 policy::BrowserPolicyConnectorChromeOS* connector = |
| 137 g_browser_process->platform_part()->browser_policy_connector_chromeos(); | 138 g_browser_process->platform_part()->browser_policy_connector_chromeos(); |
| 138 return domain == connector->GetEnterpriseDomain(); | 139 return domain == connector->GetEnterpriseDomain(); |
| 139 } else { | 140 } else { |
| 140 chromeos::OwnerSettingsServiceChromeOS* service = | 141 chromeos::OwnerSettingsServiceChromeOS* service = |
| 141 chromeos::OwnerSettingsServiceChromeOSFactory::GetInstance() | 142 chromeos::OwnerSettingsServiceChromeOSFactory::GetInstance() |
| 142 ->GetForBrowserContext(profile); | 143 ->GetForBrowserContext(profile); |
| (...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 770 base::StringValue("")); | 771 base::StringValue("")); |
| 771 } else { | 772 } else { |
| 772 base::string16 message = GetEolMessage(status); | 773 base::string16 message = GetEolMessage(status); |
| 773 web_ui()->CallJavascriptFunctionUnsafe( | 774 web_ui()->CallJavascriptFunctionUnsafe( |
| 774 "help.HelpPage.updateEolMessage", base::StringValue("device_endoflife"), | 775 "help.HelpPage.updateEolMessage", base::StringValue("device_endoflife"), |
| 775 base::StringValue(message)); | 776 base::StringValue(message)); |
| 776 } | 777 } |
| 777 } | 778 } |
| 778 | 779 |
| 779 #endif // defined(OS_CHROMEOS) | 780 #endif // defined(OS_CHROMEOS) |
| OLD | NEW |