Chromium Code Reviews| 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 "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 23 #include "base/value_conversions.h" | 23 #include "base/value_conversions.h" |
| 24 #include "base/values.h" | 24 #include "base/values.h" |
| 25 #include "chrome/browser/auto_launch_trial.h" | 25 #include "chrome/browser/auto_launch_trial.h" |
| 26 #include "chrome/browser/browser_process.h" | 26 #include "chrome/browser/browser_process.h" |
| 27 #include "chrome/browser/chrome_notification_types.h" | 27 #include "chrome/browser/chrome_notification_types.h" |
| 28 #include "chrome/browser/chrome_page_zoom.h" | 28 #include "chrome/browser/chrome_page_zoom.h" |
| 29 #include "chrome/browser/custom_home_pages_table_model.h" | 29 #include "chrome/browser/custom_home_pages_table_model.h" |
| 30 #include "chrome/browser/download/download_prefs.h" | 30 #include "chrome/browser/download/download_prefs.h" |
| 31 #include "chrome/browser/gpu/gpu_mode_manager.h" | 31 #include "chrome/browser/gpu/gpu_mode_manager.h" |
| 32 #include "chrome/browser/lifetime/application_lifetime.h" | 32 #include "chrome/browser/lifetime/application_lifetime.h" |
| 33 #include "chrome/browser/metrics/chrome_metrics_service_accessor.h" | |
| 34 #include "chrome/browser/metrics/metrics_reporting_state.h" | |
| 33 #include "chrome/browser/net/prediction_options.h" | 35 #include "chrome/browser/net/prediction_options.h" |
| 34 #include "chrome/browser/prefs/session_startup_pref.h" | 36 #include "chrome/browser/prefs/session_startup_pref.h" |
| 35 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service.h" | 37 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service.h" |
| 36 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service_factory. h" | 38 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service_factory. h" |
| 37 #include "chrome/browser/profiles/profile.h" | 39 #include "chrome/browser/profiles/profile.h" |
| 38 #include "chrome/browser/profiles/profile_avatar_icon_util.h" | 40 #include "chrome/browser/profiles/profile_avatar_icon_util.h" |
| 39 #include "chrome/browser/profiles/profile_info_cache.h" | 41 #include "chrome/browser/profiles/profile_info_cache.h" |
| 40 #include "chrome/browser/profiles/profile_manager.h" | 42 #include "chrome/browser/profiles/profile_manager.h" |
| 41 #include "chrome/browser/profiles/profile_metrics.h" | 43 #include "chrome/browser/profiles/profile_metrics.h" |
| 42 #include "chrome/browser/profiles/profile_shortcut_manager.h" | 44 #include "chrome/browser/profiles/profile_shortcut_manager.h" |
| (...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 531 values->SetString("username", username); | 533 values->SetString("username", username); |
| 532 #endif | 534 #endif |
| 533 | 535 |
| 534 // Pass along sync status early so it will be available during page init. | 536 // Pass along sync status early so it will be available during page init. |
| 535 values->Set("syncData", GetSyncStateDictionary().release()); | 537 values->Set("syncData", GetSyncStateDictionary().release()); |
| 536 | 538 |
| 537 values->SetString("privacyLearnMoreURL", chrome::kPrivacyLearnMoreURL); | 539 values->SetString("privacyLearnMoreURL", chrome::kPrivacyLearnMoreURL); |
| 538 values->SetString("doNotTrackLearnMoreURL", chrome::kDoNotTrackLearnMoreURL); | 540 values->SetString("doNotTrackLearnMoreURL", chrome::kDoNotTrackLearnMoreURL); |
| 539 | 541 |
| 540 #if !defined(OS_CHROMEOS) | 542 #if !defined(OS_CHROMEOS) |
| 541 PrefService* pref_service = g_browser_process->local_state(); | 543 values->SetBoolean("metricsReportingEnabledAtStart", |
| 542 values->SetBoolean("metricsReportingEnabledAtStart", pref_service->GetBoolean( | 544 ChromeMetricsServiceAccessor::IsMetricsReportingEnabled()); |
| 543 prefs::kMetricsReportingEnabled)); | |
| 544 #endif | 545 #endif |
| 545 | 546 |
| 546 #if defined(OS_CHROMEOS) | 547 #if defined(OS_CHROMEOS) |
| 547 // TODO(pastarmovj): replace this with a call to the CrosSettings list | 548 // TODO(pastarmovj): replace this with a call to the CrosSettings list |
| 548 // handling functionality to come. | 549 // handling functionality to come. |
| 549 values->Set("timezoneList", chromeos::system::GetTimezoneList().release()); | 550 values->Set("timezoneList", chromeos::system::GetTimezoneList().release()); |
| 550 | 551 |
| 551 values->SetString("accessibilityLearnMoreURL", | 552 values->SetString("accessibilityLearnMoreURL", |
| 552 chrome::kChromeAccessibilityHelpURL); | 553 chrome::kChromeAccessibilityHelpURL); |
| 553 | 554 |
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 868 base::Bind(&BrowserOptionsHandler::SetupManagingSupervisedUsers, | 869 base::Bind(&BrowserOptionsHandler::SetupManagingSupervisedUsers, |
| 869 base::Unretained(this))); | 870 base::Unretained(this))); |
| 870 profile_pref_registrar_.Add( | 871 profile_pref_registrar_.Add( |
| 871 prefs::kSigninAllowed, | 872 prefs::kSigninAllowed, |
| 872 base::Bind(&BrowserOptionsHandler::OnSigninAllowedPrefChange, | 873 base::Bind(&BrowserOptionsHandler::OnSigninAllowedPrefChange, |
| 873 base::Unretained(this))); | 874 base::Unretained(this))); |
| 874 profile_pref_registrar_.Add( | 875 profile_pref_registrar_.Add( |
| 875 prefs::kEasyUnlockPairing, | 876 prefs::kEasyUnlockPairing, |
| 876 base::Bind(&BrowserOptionsHandler::SetupEasyUnlock, | 877 base::Bind(&BrowserOptionsHandler::SetupEasyUnlock, |
| 877 base::Unretained(this))); | 878 base::Unretained(this))); |
| 878 | |
|
Alexei Svitkine (slow)
2014/09/05 15:22:48
Nit: Put this blank line back to avoid the extra d
gayane -on leave until 09-2017
2014/09/05 18:30:20
Done.
| |
| 879 #if defined(OS_WIN) | 879 #if defined(OS_WIN) |
| 880 profile_pref_registrar_.Add( | 880 profile_pref_registrar_.Add( |
| 881 prefs::kURLsToRestoreOnStartup, | 881 prefs::kURLsToRestoreOnStartup, |
| 882 base::Bind(&BrowserOptionsHandler::SetupExtensionControlledIndicators, | 882 base::Bind(&BrowserOptionsHandler::SetupExtensionControlledIndicators, |
| 883 base::Unretained(this))); | 883 base::Unretained(this))); |
| 884 profile_pref_registrar_.Add( | 884 profile_pref_registrar_.Add( |
| 885 prefs::kHomePage, | 885 prefs::kHomePage, |
| 886 base::Bind(&BrowserOptionsHandler::SetupExtensionControlledIndicators, | 886 base::Bind(&BrowserOptionsHandler::SetupExtensionControlledIndicators, |
| 887 base::Unretained(this))); | 887 base::Unretained(this))); |
| 888 #endif // defined(OS_WIN) | 888 #endif // defined(OS_WIN) |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 922 SetupMetricsReportingSettingVisibility(); | 922 SetupMetricsReportingSettingVisibility(); |
| 923 SetupNetworkPredictionControl(); | 923 SetupNetworkPredictionControl(); |
| 924 SetupFontSizeSelector(); | 924 SetupFontSizeSelector(); |
| 925 SetupPageZoomSelector(); | 925 SetupPageZoomSelector(); |
| 926 SetupAutoOpenFileTypes(); | 926 SetupAutoOpenFileTypes(); |
| 927 SetupProxySettingsSection(); | 927 SetupProxySettingsSection(); |
| 928 SetupManageCertificatesSection(); | 928 SetupManageCertificatesSection(); |
| 929 SetupManagingSupervisedUsers(); | 929 SetupManagingSupervisedUsers(); |
| 930 SetupEasyUnlock(); | 930 SetupEasyUnlock(); |
| 931 SetupExtensionControlledIndicators(); | 931 SetupExtensionControlledIndicators(); |
| 932 SetupMetricsReportingCheckbox(); | |
| 932 | 933 |
| 933 #if defined(OS_CHROMEOS) | 934 #if defined(OS_CHROMEOS) |
| 934 SetupAccessibilityFeatures(); | 935 SetupAccessibilityFeatures(); |
| 935 policy::BrowserPolicyConnectorChromeOS* connector = | 936 policy::BrowserPolicyConnectorChromeOS* connector = |
| 936 g_browser_process->platform_part()->browser_policy_connector_chromeos(); | 937 g_browser_process->platform_part()->browser_policy_connector_chromeos(); |
| 937 if (!connector->IsEnterpriseManaged() && | 938 if (!connector->IsEnterpriseManaged() && |
| 938 !user_manager::UserManager::Get()->IsLoggedInAsGuest() && | 939 !user_manager::UserManager::Get()->IsLoggedInAsGuest() && |
| 939 !user_manager::UserManager::Get()->IsLoggedInAsSupervisedUser()) { | 940 !user_manager::UserManager::Get()->IsLoggedInAsSupervisedUser()) { |
| 940 web_ui()->CallJavascriptFunction( | 941 web_ui()->CallJavascriptFunction( |
| 941 "BrowserOptions.enableFactoryResetSection"); | 942 "BrowserOptions.enableFactoryResetSection"); |
| (...skipping 918 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1860 // Check if an extension is overwriting the proxy setting. | 1861 // Check if an extension is overwriting the proxy setting. |
| 1861 extension = extensions::GetExtensionOverridingProxy( | 1862 extension = extensions::GetExtensionOverridingProxy( |
| 1862 Profile::FromWebUI(web_ui())); | 1863 Profile::FromWebUI(web_ui())); |
| 1863 AppendExtensionData("proxy", extension, &extension_controlled); | 1864 AppendExtensionData("proxy", extension, &extension_controlled); |
| 1864 | 1865 |
| 1865 web_ui()->CallJavascriptFunction("BrowserOptions.toggleExtensionIndicators", | 1866 web_ui()->CallJavascriptFunction("BrowserOptions.toggleExtensionIndicators", |
| 1866 extension_controlled); | 1867 extension_controlled); |
| 1867 #endif // defined(OS_WIN) | 1868 #endif // defined(OS_WIN) |
| 1868 } | 1869 } |
| 1869 | 1870 |
| 1871 void BrowserOptionsHandler::SetupMetricsReportingCheckbox() { | |
| 1872 base::FundamentalValue checked( | |
| 1873 ChromeMetricsServiceAccessor::IsMetricsReportingEnabled()); | |
| 1874 base::FundamentalValue disabled(!IsMetricsReportingUserChangable()); | |
| 1875 | |
| 1876 web_ui()->CallJavascriptFunction( | |
| 1877 "BrowserOptions.setMetricsReportingCheckboxState", checked, disabled); | |
| 1878 } | |
| 1879 | |
| 1870 } // namespace options | 1880 } // namespace options |
| OLD | NEW |