Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(775)

Side by Side Diff: chrome/browser/ui/webui/options/browser_options_handler.cc

Issue 467363003: Guest mode causes certain settings to be hidden. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 514 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 } 525 }
526 if (!username.empty()) 526 if (!username.empty())
527 username = gaia::SanitizeEmail(gaia::CanonicalizeEmail(username)); 527 username = gaia::SanitizeEmail(gaia::CanonicalizeEmail(username));
528 528
529 values->SetString("username", username); 529 values->SetString("username", username);
530 #endif 530 #endif
531 531
532 // Pass along sync status early so it will be available during page init. 532 // Pass along sync status early so it will be available during page init.
533 values->Set("syncData", GetSyncStateDictionary().release()); 533 values->Set("syncData", GetSyncStateDictionary().release());
534 534
535 // The Reset Profile Settings feature makes no sense for an off-the-record
536 // profile (e.g. in Guest mode on Chrome OS), so hide it.
537 values->SetBoolean("enableResetProfileSettings",
538 !Profile::FromWebUI(web_ui())->IsOffTheRecord());
539
540 values->SetString("privacyLearnMoreURL", chrome::kPrivacyLearnMoreURL); 535 values->SetString("privacyLearnMoreURL", chrome::kPrivacyLearnMoreURL);
541 values->SetString("doNotTrackLearnMoreURL", chrome::kDoNotTrackLearnMoreURL); 536 values->SetString("doNotTrackLearnMoreURL", chrome::kDoNotTrackLearnMoreURL);
542 537
543 #if !defined(OS_CHROMEOS) 538 #if !defined(OS_CHROMEOS)
544 PrefService* pref_service = g_browser_process->local_state(); 539 PrefService* pref_service = g_browser_process->local_state();
545 values->SetBoolean("metricsReportingEnabledAtStart", pref_service->GetBoolean( 540 values->SetBoolean("metricsReportingEnabledAtStart", pref_service->GetBoolean(
546 prefs::kMetricsReportingEnabled)); 541 prefs::kMetricsReportingEnabled));
547 #endif 542 #endif
548 543
549 #if defined(OS_CHROMEOS) 544 #if defined(OS_CHROMEOS)
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
585 #if defined(OS_MACOSX) 580 #if defined(OS_MACOSX)
586 values->SetString("macPasswordsWarning", 581 values->SetString("macPasswordsWarning",
587 l10n_util::GetStringUTF16(IDS_OPTIONS_PASSWORDS_MAC_WARNING)); 582 l10n_util::GetStringUTF16(IDS_OPTIONS_PASSWORDS_MAC_WARNING));
588 values->SetBoolean("multiple_profiles", 583 values->SetBoolean("multiple_profiles",
589 g_browser_process->profile_manager()->GetNumberOfProfiles() > 1); 584 g_browser_process->profile_manager()->GetNumberOfProfiles() > 1);
590 #endif 585 #endif
591 586
592 if (ShouldShowMultiProfilesUserList()) 587 if (ShouldShowMultiProfilesUserList())
593 values->Set("profilesInfo", GetProfilesInfoList().release()); 588 values->Set("profilesInfo", GetProfilesInfoList().release());
594 589
590 values->SetBoolean("profileIsGuest",
591 Profile::FromWebUI(web_ui())->IsOffTheRecord());
592
595 values->SetBoolean("profileIsSupervised", 593 values->SetBoolean("profileIsSupervised",
596 Profile::FromWebUI(web_ui())->IsSupervised()); 594 Profile::FromWebUI(web_ui())->IsSupervised());
597 595
598 #if !defined(OS_CHROMEOS) 596 #if !defined(OS_CHROMEOS)
599 values->SetBoolean( 597 values->SetBoolean(
600 "gpuEnabledAtStart", 598 "gpuEnabledAtStart",
601 g_browser_process->gpu_mode_manager()->initial_gpu_mode_pref()); 599 g_browser_process->gpu_mode_manager()->initial_gpu_mode_pref());
602 #endif 600 #endif
603 601
604 #if defined(ENABLE_SERVICE_DISCOVERY) 602 #if defined(ENABLE_SERVICE_DISCOVERY)
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
827 825
828 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); 826 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
829 if (!command_line.HasSwitch(switches::kUserDataDir)) { 827 if (!command_line.HasSwitch(switches::kUserDataDir)) {
830 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, 828 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE,
831 base::Bind(&BrowserOptionsHandler::CheckAutoLaunch, 829 base::Bind(&BrowserOptionsHandler::CheckAutoLaunch,
832 weak_ptr_factory_.GetWeakPtr(), 830 weak_ptr_factory_.GetWeakPtr(),
833 profile->GetPath())); 831 profile->GetPath()));
834 } 832 }
835 #endif 833 #endif
836 834
835 // No preferences below this point may be modified by guest profiles.
836 if (Profile::FromWebUI(web_ui())->IsGuestSession())
837 return;
838
837 auto_open_files_.Init( 839 auto_open_files_.Init(
838 prefs::kDownloadExtensionsToOpen, prefs, 840 prefs::kDownloadExtensionsToOpen, prefs,
839 base::Bind(&BrowserOptionsHandler::SetupAutoOpenFileTypes, 841 base::Bind(&BrowserOptionsHandler::SetupAutoOpenFileTypes,
840 base::Unretained(this))); 842 base::Unretained(this)));
841 default_zoom_level_.Init( 843 default_zoom_level_.Init(
842 prefs::kDefaultZoomLevel, prefs, 844 prefs::kDefaultZoomLevel, prefs,
843 base::Bind(&BrowserOptionsHandler::SetupPageZoomSelector, 845 base::Bind(&BrowserOptionsHandler::SetupPageZoomSelector,
844 base::Unretained(this))); 846 base::Unretained(this)));
845 profile_pref_registrar_.Init(prefs); 847 profile_pref_registrar_.Init(prefs);
846 profile_pref_registrar_.Add( 848 profile_pref_registrar_.Add(
(...skipping 1018 matching lines...) Expand 10 before | Expand all | Expand 10 after
1865 extension = extensions::GetExtensionOverridingProxy( 1867 extension = extensions::GetExtensionOverridingProxy(
1866 Profile::FromWebUI(web_ui())); 1868 Profile::FromWebUI(web_ui()));
1867 AppendExtensionData("proxy", extension, &extension_controlled); 1869 AppendExtensionData("proxy", extension, &extension_controlled);
1868 1870
1869 web_ui()->CallJavascriptFunction("BrowserOptions.toggleExtensionIndicators", 1871 web_ui()->CallJavascriptFunction("BrowserOptions.toggleExtensionIndicators",
1870 extension_controlled); 1872 extension_controlled);
1871 #endif // defined(OS_WIN) 1873 #endif // defined(OS_WIN)
1872 } 1874 }
1873 1875
1874 } // namespace options 1876 } // namespace options
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698