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 <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "apps/app_window.h" | 10 #include "apps/app_window.h" |
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
533 } | 533 } |
534 if (!username.empty()) | 534 if (!username.empty()) |
535 username = gaia::SanitizeEmail(gaia::CanonicalizeEmail(username)); | 535 username = gaia::SanitizeEmail(gaia::CanonicalizeEmail(username)); |
536 | 536 |
537 values->SetString("username", username); | 537 values->SetString("username", username); |
538 #endif | 538 #endif |
539 | 539 |
540 // Pass along sync status early so it will be available during page init. | 540 // Pass along sync status early so it will be available during page init. |
541 values->Set("syncData", GetSyncStateDictionary().release()); | 541 values->Set("syncData", GetSyncStateDictionary().release()); |
542 | 542 |
543 // The Reset Profile Settings feature makes no sense for an off-the-record | |
544 // profile (e.g. in Guest mode on Chrome OS), so hide it. | |
545 values->SetBoolean("enableResetProfileSettings", | |
546 !Profile::FromWebUI(web_ui())->IsOffTheRecord()); | |
547 | |
548 values->SetString("privacyLearnMoreURL", chrome::kPrivacyLearnMoreURL); | 543 values->SetString("privacyLearnMoreURL", chrome::kPrivacyLearnMoreURL); |
549 values->SetString("doNotTrackLearnMoreURL", chrome::kDoNotTrackLearnMoreURL); | 544 values->SetString("doNotTrackLearnMoreURL", chrome::kDoNotTrackLearnMoreURL); |
550 | 545 |
551 #if !defined(OS_CHROMEOS) | 546 #if !defined(OS_CHROMEOS) |
552 PrefService* pref_service = g_browser_process->local_state(); | 547 PrefService* pref_service = g_browser_process->local_state(); |
553 values->SetBoolean("metricsReportingEnabledAtStart", pref_service->GetBoolean( | 548 values->SetBoolean("metricsReportingEnabledAtStart", pref_service->GetBoolean( |
554 prefs::kMetricsReportingEnabled)); | 549 prefs::kMetricsReportingEnabled)); |
555 #endif | 550 #endif |
556 | 551 |
557 #if defined(OS_CHROMEOS) | 552 #if defined(OS_CHROMEOS) |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
593 #if defined(OS_MACOSX) | 588 #if defined(OS_MACOSX) |
594 values->SetString("macPasswordsWarning", | 589 values->SetString("macPasswordsWarning", |
595 l10n_util::GetStringUTF16(IDS_OPTIONS_PASSWORDS_MAC_WARNING)); | 590 l10n_util::GetStringUTF16(IDS_OPTIONS_PASSWORDS_MAC_WARNING)); |
596 values->SetBoolean("multiple_profiles", | 591 values->SetBoolean("multiple_profiles", |
597 g_browser_process->profile_manager()->GetNumberOfProfiles() > 1); | 592 g_browser_process->profile_manager()->GetNumberOfProfiles() > 1); |
598 #endif | 593 #endif |
599 | 594 |
600 if (ShouldShowMultiProfilesUserList()) | 595 if (ShouldShowMultiProfilesUserList()) |
601 values->Set("profilesInfo", GetProfilesInfoList().release()); | 596 values->Set("profilesInfo", GetProfilesInfoList().release()); |
602 | 597 |
| 598 values->SetBoolean("profileIsGuest", |
| 599 Profile::FromWebUI(web_ui())->IsOffTheRecord()); |
| 600 |
603 values->SetBoolean("profileIsSupervised", | 601 values->SetBoolean("profileIsSupervised", |
604 Profile::FromWebUI(web_ui())->IsSupervised()); | 602 Profile::FromWebUI(web_ui())->IsSupervised()); |
605 | 603 |
606 #if !defined(OS_CHROMEOS) | 604 #if !defined(OS_CHROMEOS) |
607 values->SetBoolean( | 605 values->SetBoolean( |
608 "gpuEnabledAtStart", | 606 "gpuEnabledAtStart", |
609 g_browser_process->gpu_mode_manager()->initial_gpu_mode_pref()); | 607 g_browser_process->gpu_mode_manager()->initial_gpu_mode_pref()); |
610 #endif | 608 #endif |
611 | 609 |
612 #if defined(ENABLE_SERVICE_DISCOVERY) | 610 #if defined(ENABLE_SERVICE_DISCOVERY) |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
837 | 835 |
838 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 836 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
839 if (!command_line.HasSwitch(switches::kUserDataDir)) { | 837 if (!command_line.HasSwitch(switches::kUserDataDir)) { |
840 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, | 838 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, |
841 base::Bind(&BrowserOptionsHandler::CheckAutoLaunch, | 839 base::Bind(&BrowserOptionsHandler::CheckAutoLaunch, |
842 weak_ptr_factory_.GetWeakPtr(), | 840 weak_ptr_factory_.GetWeakPtr(), |
843 profile->GetPath())); | 841 profile->GetPath())); |
844 } | 842 } |
845 #endif | 843 #endif |
846 | 844 |
| 845 // No preferences below this point may be modified by guest profiles. |
| 846 if (Profile::FromWebUI(web_ui())->IsGuestSession()) |
| 847 return; |
| 848 |
847 auto_open_files_.Init( | 849 auto_open_files_.Init( |
848 prefs::kDownloadExtensionsToOpen, prefs, | 850 prefs::kDownloadExtensionsToOpen, prefs, |
849 base::Bind(&BrowserOptionsHandler::SetupAutoOpenFileTypes, | 851 base::Bind(&BrowserOptionsHandler::SetupAutoOpenFileTypes, |
850 base::Unretained(this))); | 852 base::Unretained(this))); |
851 default_zoom_level_.Init( | 853 default_zoom_level_.Init( |
852 prefs::kDefaultZoomLevel, prefs, | 854 prefs::kDefaultZoomLevel, prefs, |
853 base::Bind(&BrowserOptionsHandler::SetupPageZoomSelector, | 855 base::Bind(&BrowserOptionsHandler::SetupPageZoomSelector, |
854 base::Unretained(this))); | 856 base::Unretained(this))); |
855 profile_pref_registrar_.Init(prefs); | 857 profile_pref_registrar_.Init(prefs); |
856 profile_pref_registrar_.Add( | 858 profile_pref_registrar_.Add( |
(...skipping 1026 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1883 extension = extensions::GetExtensionOverridingProxy( | 1885 extension = extensions::GetExtensionOverridingProxy( |
1884 Profile::FromWebUI(web_ui())); | 1886 Profile::FromWebUI(web_ui())); |
1885 AppendExtensionData("proxy", extension, &extension_controlled); | 1887 AppendExtensionData("proxy", extension, &extension_controlled); |
1886 | 1888 |
1887 web_ui()->CallJavascriptFunction("BrowserOptions.toggleExtensionIndicators", | 1889 web_ui()->CallJavascriptFunction("BrowserOptions.toggleExtensionIndicators", |
1888 extension_controlled); | 1890 extension_controlled); |
1889 #endif // defined(OS_WIN) | 1891 #endif // defined(OS_WIN) |
1890 } | 1892 } |
1891 | 1893 |
1892 } // namespace options | 1894 } // namespace options |
OLD | NEW |