| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <set> | 9 #include <set> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 using extensions::ExtensionRegistry; | 159 using extensions::ExtensionRegistry; |
| 160 | 160 |
| 161 namespace { | 161 namespace { |
| 162 | 162 |
| 163 void AppendExtensionData(const std::string& key, | 163 void AppendExtensionData(const std::string& key, |
| 164 const Extension* extension, | 164 const Extension* extension, |
| 165 base::DictionaryValue* dict) { | 165 base::DictionaryValue* dict) { |
| 166 std::unique_ptr<base::DictionaryValue> details(new base::DictionaryValue); | 166 std::unique_ptr<base::DictionaryValue> details(new base::DictionaryValue); |
| 167 details->SetString("id", extension ? extension->id() : std::string()); | 167 details->SetString("id", extension ? extension->id() : std::string()); |
| 168 details->SetString("name", extension ? extension->name() : std::string()); | 168 details->SetString("name", extension ? extension->name() : std::string()); |
| 169 dict->Set(key, details.release()); | 169 dict->Set(key, std::move(details)); |
| 170 } | 170 } |
| 171 | 171 |
| 172 #if !defined(OS_CHROMEOS) | 172 #if !defined(OS_CHROMEOS) |
| 173 bool IsDisabledByPolicy(const BooleanPrefMember& pref) { | 173 bool IsDisabledByPolicy(const BooleanPrefMember& pref) { |
| 174 return pref.IsManaged() && !pref.GetValue(); | 174 return pref.IsManaged() && !pref.GetValue(); |
| 175 } | 175 } |
| 176 #endif // !defined(OS_CHROMEOS) | 176 #endif // !defined(OS_CHROMEOS) |
| 177 | 177 |
| 178 std::string GetSyncErrorAction(sync_ui_util::ActionType action_type) { | 178 std::string GetSyncErrorAction(sync_ui_util::ActionType action_type) { |
| 179 switch (action_type) { | 179 switch (action_type) { |
| (...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 655 chromeos::ProfileHelper::Get()->GetUserByProfile(profile); | 655 chromeos::ProfileHelper::Get()->GetUserByProfile(profile); |
| 656 if (user && (user->GetType() != user_manager::USER_TYPE_GUEST)) | 656 if (user && (user->GetType() != user_manager::USER_TYPE_GUEST)) |
| 657 username = user->GetAccountId().GetUserEmail(); | 657 username = user->GetAccountId().GetUserEmail(); |
| 658 } | 658 } |
| 659 if (!username.empty()) | 659 if (!username.empty()) |
| 660 username = gaia::SanitizeEmail(gaia::CanonicalizeEmail(username)); | 660 username = gaia::SanitizeEmail(gaia::CanonicalizeEmail(username)); |
| 661 | 661 |
| 662 values->SetString("username", username); | 662 values->SetString("username", username); |
| 663 #endif | 663 #endif |
| 664 // Pass along sync status early so it will be available during page init. | 664 // Pass along sync status early so it will be available during page init. |
| 665 values->Set("syncData", GetSyncStateDictionary().release()); | 665 values->Set("syncData", GetSyncStateDictionary()); |
| 666 | 666 |
| 667 values->SetString("privacyLearnMoreURL", chrome::kPrivacyLearnMoreURL); | 667 values->SetString("privacyLearnMoreURL", chrome::kPrivacyLearnMoreURL); |
| 668 | 668 |
| 669 values->SetString("doNotTrackLearnMoreURL", chrome::kDoNotTrackLearnMoreURL); | 669 values->SetString("doNotTrackLearnMoreURL", chrome::kDoNotTrackLearnMoreURL); |
| 670 | 670 |
| 671 values->SetBoolean( | 671 values->SetBoolean( |
| 672 "metricsReportingEnabledAtStart", | 672 "metricsReportingEnabledAtStart", |
| 673 ChromeMetricsServiceAccessor::IsMetricsAndCrashReportingEnabled()); | 673 ChromeMetricsServiceAccessor::IsMetricsAndCrashReportingEnabled()); |
| 674 | 674 |
| 675 #if defined(OS_CHROMEOS) | 675 #if defined(OS_CHROMEOS) |
| 676 // TODO(pastarmovj): replace this with a call to the CrosSettings list | 676 // TODO(pastarmovj): replace this with a call to the CrosSettings list |
| 677 // handling functionality to come. | 677 // handling functionality to come. |
| 678 values->Set("timezoneList", chromeos::system::GetTimezoneList().release()); | 678 values->Set("timezoneList", chromeos::system::GetTimezoneList()); |
| 679 | 679 |
| 680 values->SetString("accessibilityLearnMoreURL", | 680 values->SetString("accessibilityLearnMoreURL", |
| 681 chrome::kChromeAccessibilityHelpURL); | 681 chrome::kChromeAccessibilityHelpURL); |
| 682 | 682 |
| 683 std::string settings_url = std::string("chrome-extension://") + | 683 std::string settings_url = std::string("chrome-extension://") + |
| 684 extension_misc::kChromeVoxExtensionId + | 684 extension_misc::kChromeVoxExtensionId + |
| 685 chrome::kChromeAccessibilitySettingsURL; | 685 chrome::kChromeAccessibilitySettingsURL; |
| 686 | 686 |
| 687 values->SetString("accessibilitySettingsURL", | 687 values->SetString("accessibilitySettingsURL", |
| 688 settings_url); | 688 settings_url); |
| 689 | 689 |
| 690 values->SetString("contentProtectionAttestationLearnMoreURL", | 690 values->SetString("contentProtectionAttestationLearnMoreURL", |
| 691 chrome::kAttestationForContentProtectionLearnMoreURL); | 691 chrome::kAttestationForContentProtectionLearnMoreURL); |
| 692 | 692 |
| 693 // Creates magnifierList. | 693 // Creates magnifierList. |
| 694 std::unique_ptr<base::ListValue> magnifier_list(new base::ListValue); | 694 std::unique_ptr<base::ListValue> magnifier_list(new base::ListValue); |
| 695 | 695 |
| 696 std::unique_ptr<base::ListValue> option_full(new base::ListValue); | 696 std::unique_ptr<base::ListValue> option_full(new base::ListValue); |
| 697 option_full->AppendInteger(ash::MAGNIFIER_FULL); | 697 option_full->AppendInteger(ash::MAGNIFIER_FULL); |
| 698 option_full->AppendString(l10n_util::GetStringUTF16( | 698 option_full->AppendString(l10n_util::GetStringUTF16( |
| 699 IDS_OPTIONS_SETTINGS_ACCESSIBILITY_SCREEN_MAGNIFIER_FULL)); | 699 IDS_OPTIONS_SETTINGS_ACCESSIBILITY_SCREEN_MAGNIFIER_FULL)); |
| 700 magnifier_list->Append(std::move(option_full)); | 700 magnifier_list->Append(std::move(option_full)); |
| 701 | 701 |
| 702 std::unique_ptr<base::ListValue> option_partial(new base::ListValue); | 702 std::unique_ptr<base::ListValue> option_partial(new base::ListValue); |
| 703 option_partial->AppendInteger(ash::MAGNIFIER_PARTIAL); | 703 option_partial->AppendInteger(ash::MAGNIFIER_PARTIAL); |
| 704 option_partial->AppendString(l10n_util::GetStringUTF16( | 704 option_partial->AppendString(l10n_util::GetStringUTF16( |
| 705 IDS_OPTIONS_SETTINGS_ACCESSIBILITY_SCREEN_MAGNIFIER_PARTIAL)); | 705 IDS_OPTIONS_SETTINGS_ACCESSIBILITY_SCREEN_MAGNIFIER_PARTIAL)); |
| 706 magnifier_list->Append(std::move(option_partial)); | 706 magnifier_list->Append(std::move(option_partial)); |
| 707 | 707 |
| 708 values->Set("magnifierList", magnifier_list.release()); | 708 values->Set("magnifierList", std::move(magnifier_list)); |
| 709 values->SetBoolean("enablePolymerPreload", g_enable_polymer_preload); | 709 values->SetBoolean("enablePolymerPreload", g_enable_polymer_preload); |
| 710 #endif // defined(OS_CHROMEOS) | 710 #endif // defined(OS_CHROMEOS) |
| 711 | 711 |
| 712 #if defined(OS_MACOSX) | 712 #if defined(OS_MACOSX) |
| 713 values->SetString("macPasswordsWarning", | 713 values->SetString("macPasswordsWarning", |
| 714 l10n_util::GetStringUTF16(IDS_OPTIONS_PASSWORDS_MAC_WARNING)); | 714 l10n_util::GetStringUTF16(IDS_OPTIONS_PASSWORDS_MAC_WARNING)); |
| 715 values->SetBoolean("multiple_profiles", | 715 values->SetBoolean("multiple_profiles", |
| 716 g_browser_process->profile_manager()->GetNumberOfProfiles() > 1); | 716 g_browser_process->profile_manager()->GetNumberOfProfiles() > 1); |
| 717 #endif | 717 #endif |
| 718 | 718 |
| 719 if (ShouldShowMultiProfilesUserList()) | 719 if (ShouldShowMultiProfilesUserList()) |
| 720 values->Set("profilesInfo", GetProfilesInfoList().release()); | 720 values->Set("profilesInfo", GetProfilesInfoList()); |
| 721 | 721 |
| 722 // Profile deletion is not allowed for any users in ChromeOS. | 722 // Profile deletion is not allowed for any users in ChromeOS. |
| 723 bool allow_deletion = true; | 723 bool allow_deletion = true; |
| 724 #if defined(OS_CHROMEOS) | 724 #if defined(OS_CHROMEOS) |
| 725 allow_deletion = allow_deletion && !ash::Shell::HasInstance(); | 725 allow_deletion = allow_deletion && !ash::Shell::HasInstance(); |
| 726 #endif | 726 #endif |
| 727 values->SetBoolean("allowProfileDeletion", allow_deletion); | 727 values->SetBoolean("allowProfileDeletion", allow_deletion); |
| 728 values->SetBoolean("profileIsGuest", profile->IsOffTheRecord()); | 728 values->SetBoolean("profileIsGuest", profile->IsOffTheRecord()); |
| 729 values->SetBoolean("profileIsSupervised", profile->IsSupervised()); | 729 values->SetBoolean("profileIsSupervised", profile->IsSupervised()); |
| 730 | 730 |
| (...skipping 1614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2345 | 2345 |
| 2346 bool BrowserOptionsHandler::IsDeviceOwnerProfile() { | 2346 bool BrowserOptionsHandler::IsDeviceOwnerProfile() { |
| 2347 #if defined(OS_CHROMEOS) | 2347 #if defined(OS_CHROMEOS) |
| 2348 return chromeos::ProfileHelper::IsOwnerProfile(Profile::FromWebUI(web_ui())); | 2348 return chromeos::ProfileHelper::IsOwnerProfile(Profile::FromWebUI(web_ui())); |
| 2349 #else | 2349 #else |
| 2350 return true; | 2350 return true; |
| 2351 #endif | 2351 #endif |
| 2352 } | 2352 } |
| 2353 | 2353 |
| 2354 } // namespace options | 2354 } // namespace options |
| OLD | NEW |