| 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/options/browser_options_handler.h" | 5 #include "chrome/browser/ui/webui/options/browser_options_handler.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 540 values->SetString("hotwordManageAudioHistoryURL", | 540 values->SetString("hotwordManageAudioHistoryURL", |
| 541 chrome::kManageAudioHistoryURL); | 541 chrome::kManageAudioHistoryURL); |
| 542 | 542 |
| 543 #if defined(OS_CHROMEOS) | 543 #if defined(OS_CHROMEOS) |
| 544 Profile* profile = Profile::FromWebUI(web_ui()); | 544 Profile* profile = Profile::FromWebUI(web_ui()); |
| 545 std::string username = profile->GetProfileUserName(); | 545 std::string username = profile->GetProfileUserName(); |
| 546 if (username.empty()) { | 546 if (username.empty()) { |
| 547 const user_manager::User* user = | 547 const user_manager::User* user = |
| 548 chromeos::ProfileHelper::Get()->GetUserByProfile(profile); | 548 chromeos::ProfileHelper::Get()->GetUserByProfile(profile); |
| 549 if (user && (user->GetType() != user_manager::USER_TYPE_GUEST)) | 549 if (user && (user->GetType() != user_manager::USER_TYPE_GUEST)) |
| 550 username = user->email(); | 550 username = user->GetUserID().GetUserEmail(); |
| 551 } | 551 } |
| 552 if (!username.empty()) | 552 if (!username.empty()) |
| 553 username = gaia::SanitizeEmail(gaia::CanonicalizeEmail(username)); | 553 username = gaia::SanitizeEmail(gaia::CanonicalizeEmail(username)); |
| 554 | 554 |
| 555 values->SetString("username", username); | 555 values->SetString("username", username); |
| 556 #endif | 556 #endif |
| 557 // Pass along sync status early so it will be available during page init. | 557 // Pass along sync status early so it will be available during page init. |
| 558 values->Set("syncData", GetSyncStateDictionary().release()); | 558 values->Set("syncData", GetSyncStateDictionary().release()); |
| 559 | 559 |
| 560 values->SetString("privacyLearnMoreURL", chrome::kPrivacyLearnMoreURL); | 560 values->SetString("privacyLearnMoreURL", chrome::kPrivacyLearnMoreURL); |
| (...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1024 Profile* profile = Profile::FromWebUI(web_ui()); | 1024 Profile* profile = Profile::FromWebUI(web_ui()); |
| 1025 OnAccountPictureManagedChanged( | 1025 OnAccountPictureManagedChanged( |
| 1026 policy::ProfilePolicyConnectorFactory::GetForBrowserContext(profile) | 1026 policy::ProfilePolicyConnectorFactory::GetForBrowserContext(profile) |
| 1027 ->policy_service() | 1027 ->policy_service() |
| 1028 ->GetPolicies(policy::PolicyNamespace(policy::POLICY_DOMAIN_CHROME, | 1028 ->GetPolicies(policy::PolicyNamespace(policy::POLICY_DOMAIN_CHROME, |
| 1029 std::string())) | 1029 std::string())) |
| 1030 .Get(policy::key::kUserAvatarImage)); | 1030 .Get(policy::key::kUserAvatarImage)); |
| 1031 | 1031 |
| 1032 OnWallpaperManagedChanged( | 1032 OnWallpaperManagedChanged( |
| 1033 chromeos::WallpaperManager::Get()->IsPolicyControlled( | 1033 chromeos::WallpaperManager::Get()->IsPolicyControlled( |
| 1034 user_manager::UserManager::Get()->GetActiveUser()->email())); | 1034 user_manager::UserManager::Get()->GetActiveUser()->GetUserID())); |
| 1035 | 1035 |
| 1036 policy::ConsumerManagementService* consumer_management = | 1036 policy::ConsumerManagementService* consumer_management = |
| 1037 g_browser_process->platform_part()->browser_policy_connector_chromeos()-> | 1037 g_browser_process->platform_part()->browser_policy_connector_chromeos()-> |
| 1038 GetConsumerManagementService(); | 1038 GetConsumerManagementService(); |
| 1039 if (consumer_management) { | 1039 if (consumer_management) { |
| 1040 OnConsumerManagementStatusChanged(); | 1040 OnConsumerManagementStatusChanged(); |
| 1041 consumer_management->AddObserver(this); | 1041 consumer_management->AddObserver(this); |
| 1042 } | 1042 } |
| 1043 #endif | 1043 #endif |
| 1044 } | 1044 } |
| (...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1436 void BrowserOptionsHandler::ThemesSetNative(const base::ListValue* args) { | 1436 void BrowserOptionsHandler::ThemesSetNative(const base::ListValue* args) { |
| 1437 content::RecordAction(UserMetricsAction("Options_GtkThemeSet")); | 1437 content::RecordAction(UserMetricsAction("Options_GtkThemeSet")); |
| 1438 Profile* profile = Profile::FromWebUI(web_ui()); | 1438 Profile* profile = Profile::FromWebUI(web_ui()); |
| 1439 ThemeServiceFactory::GetForProfile(profile)->UseSystemTheme(); | 1439 ThemeServiceFactory::GetForProfile(profile)->UseSystemTheme(); |
| 1440 } | 1440 } |
| 1441 #endif | 1441 #endif |
| 1442 | 1442 |
| 1443 #if defined(OS_CHROMEOS) | 1443 #if defined(OS_CHROMEOS) |
| 1444 void BrowserOptionsHandler::UpdateAccountPicture() { | 1444 void BrowserOptionsHandler::UpdateAccountPicture() { |
| 1445 std::string email = | 1445 std::string email = |
| 1446 user_manager::UserManager::Get()->GetLoggedInUser()->email(); | 1446 user_manager::UserManager::Get()->GetLoggedInUser()->GetUserID().GetUserEm
ail(); |
| 1447 if (!email.empty()) { | 1447 if (!email.empty()) { |
| 1448 web_ui()->CallJavascriptFunction("BrowserOptions.updateAccountPicture"); | 1448 web_ui()->CallJavascriptFunction("BrowserOptions.updateAccountPicture"); |
| 1449 base::StringValue email_value(email); | 1449 base::StringValue email_value(email); |
| 1450 web_ui()->CallJavascriptFunction("BrowserOptions.updateAccountPicture", | 1450 web_ui()->CallJavascriptFunction("BrowserOptions.updateAccountPicture", |
| 1451 email_value); | 1451 email_value); |
| 1452 } | 1452 } |
| 1453 } | 1453 } |
| 1454 | 1454 |
| 1455 void BrowserOptionsHandler::OnAccountPictureManagedChanged(bool managed) { | 1455 void BrowserOptionsHandler::OnAccountPictureManagedChanged(bool managed) { |
| 1456 web_ui()->CallJavascriptFunction("BrowserOptions.setAccountPictureManaged", | 1456 web_ui()->CallJavascriptFunction("BrowserOptions.setAccountPictureManaged", |
| (...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2173 void BrowserOptionsHandler::OnPolicyUpdated(const policy::PolicyNamespace& ns, | 2173 void BrowserOptionsHandler::OnPolicyUpdated(const policy::PolicyNamespace& ns, |
| 2174 const policy::PolicyMap& previous, | 2174 const policy::PolicyMap& previous, |
| 2175 const policy::PolicyMap& current) { | 2175 const policy::PolicyMap& current) { |
| 2176 std::set<std::string> different_keys; | 2176 std::set<std::string> different_keys; |
| 2177 current.GetDifferingKeys(previous, &different_keys); | 2177 current.GetDifferingKeys(previous, &different_keys); |
| 2178 if (ContainsKey(different_keys, policy::key::kMetricsReportingEnabled)) | 2178 if (ContainsKey(different_keys, policy::key::kMetricsReportingEnabled)) |
| 2179 SetupMetricsReportingCheckbox(); | 2179 SetupMetricsReportingCheckbox(); |
| 2180 } | 2180 } |
| 2181 | 2181 |
| 2182 } // namespace options | 2182 } // namespace options |
| OLD | NEW |