| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/settings/about_handler.h" | 5 #include "chrome/browser/ui/webui/settings/about_handler.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 // On a managed machine we delegate this setting to the users of the same | 120 // On a managed machine we delegate this setting to the users of the same |
| 121 // domain only if the policy value is "domain". | 121 // domain only if the policy value is "domain". |
| 122 if (IsEnterpriseManaged()) { | 122 if (IsEnterpriseManaged()) { |
| 123 if (!value) | 123 if (!value) |
| 124 return false; | 124 return false; |
| 125 // Get the currently logged in user and strip the domain part only. | 125 // Get the currently logged in user and strip the domain part only. |
| 126 std::string domain = ""; | 126 std::string domain = ""; |
| 127 const user_manager::User* user = | 127 const user_manager::User* user = |
| 128 profile ? chromeos::ProfileHelper::Get()->GetUserByProfile(profile) | 128 profile ? chromeos::ProfileHelper::Get()->GetUserByProfile(profile) |
| 129 : nullptr; | 129 : nullptr; |
| 130 std::string email = user ? user->email() : std::string(); | 130 std::string email = |
| 131 user ? user->GetAccountId().GetUserEmail() : std::string(); |
| 131 size_t at_pos = email.find('@'); | 132 size_t at_pos = email.find('@'); |
| 132 if (at_pos != std::string::npos && at_pos + 1 < email.length()) | 133 if (at_pos != std::string::npos && at_pos + 1 < email.length()) |
| 133 domain = email.substr(email.find('@') + 1); | 134 domain = email.substr(email.find('@') + 1); |
| 134 policy::BrowserPolicyConnectorChromeOS* connector = | 135 policy::BrowserPolicyConnectorChromeOS* connector = |
| 135 g_browser_process->platform_part()->browser_policy_connector_chromeos(); | 136 g_browser_process->platform_part()->browser_policy_connector_chromeos(); |
| 136 return domain == connector->GetEnterpriseDomain(); | 137 return domain == connector->GetEnterpriseDomain(); |
| 137 } else { | 138 } else { |
| 138 chromeos::OwnerSettingsServiceChromeOS* service = | 139 chromeos::OwnerSettingsServiceChromeOS* service = |
| 139 chromeos::OwnerSettingsServiceChromeOSFactory::GetInstance() | 140 chromeos::OwnerSettingsServiceChromeOSFactory::GetInstance() |
| 140 ->GetForBrowserContext(profile); | 141 ->GetForBrowserContext(profile); |
| (...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 647 std::string url = | 648 std::string url = |
| 648 std::string("chrome://") + chrome::kChromeOSAssetHost + "/" + image_path; | 649 std::string("chrome://") + chrome::kChromeOSAssetHost + "/" + image_path; |
| 649 regulatory_info->SetString("url", url); | 650 regulatory_info->SetString("url", url); |
| 650 | 651 |
| 651 ResolveJavascriptCallback(base::StringValue(callback_id), *regulatory_info); | 652 ResolveJavascriptCallback(base::StringValue(callback_id), *regulatory_info); |
| 652 } | 653 } |
| 653 | 654 |
| 654 #endif // defined(OS_CHROMEOS) | 655 #endif // defined(OS_CHROMEOS) |
| 655 | 656 |
| 656 } // namespace settings | 657 } // namespace settings |
| OLD | NEW |