| 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" |
| 11 #include "apps/app_window_registry.h" | 11 #include "apps/app_window_registry.h" |
| 12 #include "base/bind.h" | 12 #include "base/bind.h" |
| 13 #include "base/bind_helpers.h" | 13 #include "base/bind_helpers.h" |
| 14 #include "base/command_line.h" | 14 #include "base/command_line.h" |
| 15 #include "base/environment.h" |
| 15 #include "base/memory/singleton.h" | 16 #include "base/memory/singleton.h" |
| 16 #include "base/metrics/field_trial.h" | 17 #include "base/metrics/field_trial.h" |
| 17 #include "base/metrics/histogram.h" | 18 #include "base/metrics/histogram.h" |
| 18 #include "base/path_service.h" | 19 #include "base/path_service.h" |
| 19 #include "base/prefs/pref_service.h" | 20 #include "base/prefs/pref_service.h" |
| 20 #include "base/prefs/scoped_user_pref_update.h" | 21 #include "base/prefs/scoped_user_pref_update.h" |
| 21 #include "base/stl_util.h" | 22 #include "base/stl_util.h" |
| 22 #include "base/strings/string_number_conversions.h" | 23 #include "base/strings/string_number_conversions.h" |
| 23 #include "base/strings/utf_string_conversions.h" | 24 #include "base/strings/utf_string_conversions.h" |
| 24 #include "base/value_conversions.h" | 25 #include "base/value_conversions.h" |
| 25 #include "base/values.h" | 26 #include "base/values.h" |
| 26 #include "chrome/browser/auto_launch_trial.h" | 27 #include "chrome/browser/auto_launch_trial.h" |
| 27 #include "chrome/browser/browser_process.h" | 28 #include "chrome/browser/browser_process.h" |
| 28 #include "chrome/browser/chrome_notification_types.h" | 29 #include "chrome/browser/chrome_notification_types.h" |
| 29 #include "chrome/browser/chrome_page_zoom.h" | 30 #include "chrome/browser/chrome_page_zoom.h" |
| 30 #include "chrome/browser/custom_home_pages_table_model.h" | 31 #include "chrome/browser/custom_home_pages_table_model.h" |
| 31 #include "chrome/browser/download/download_prefs.h" | 32 #include "chrome/browser/download/download_prefs.h" |
| 32 #include "chrome/browser/gpu/gpu_mode_manager.h" | 33 #include "chrome/browser/gpu/gpu_mode_manager.h" |
| 33 #include "chrome/browser/lifetime/application_lifetime.h" | 34 #include "chrome/browser/lifetime/application_lifetime.h" |
| 34 #include "chrome/browser/metrics/metrics_reporting_state.h" | |
| 35 #include "chrome/browser/prefs/session_startup_pref.h" | 35 #include "chrome/browser/prefs/session_startup_pref.h" |
| 36 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service.h" | 36 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service.h" |
| 37 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service_factory.
h" | 37 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service_factory.
h" |
| 38 #include "chrome/browser/profile_resetter/automatic_profile_resetter.h" | 38 #include "chrome/browser/profile_resetter/automatic_profile_resetter.h" |
| 39 #include "chrome/browser/profile_resetter/automatic_profile_resetter_factory.h" | 39 #include "chrome/browser/profile_resetter/automatic_profile_resetter_factory.h" |
| 40 #include "chrome/browser/profiles/profile.h" | 40 #include "chrome/browser/profiles/profile.h" |
| 41 #include "chrome/browser/profiles/profile_avatar_icon_util.h" | 41 #include "chrome/browser/profiles/profile_avatar_icon_util.h" |
| 42 #include "chrome/browser/profiles/profile_info_cache.h" | 42 #include "chrome/browser/profiles/profile_info_cache.h" |
| 43 #include "chrome/browser/profiles/profile_manager.h" | 43 #include "chrome/browser/profiles/profile_manager.h" |
| 44 #include "chrome/browser/profiles/profile_metrics.h" | 44 #include "chrome/browser/profiles/profile_metrics.h" |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 { "doNotTrackConfirmDisable", | 237 { "doNotTrackConfirmDisable", |
| 238 IDS_OPTIONS_ENABLE_DO_NOT_TRACK_BUBBLE_DISABLE }, | 238 IDS_OPTIONS_ENABLE_DO_NOT_TRACK_BUBBLE_DISABLE }, |
| 239 { "downloadLocationAskForSaveLocation", | 239 { "downloadLocationAskForSaveLocation", |
| 240 IDS_OPTIONS_DOWNLOADLOCATION_ASKFORSAVELOCATION }, | 240 IDS_OPTIONS_DOWNLOADLOCATION_ASKFORSAVELOCATION }, |
| 241 { "downloadLocationBrowseTitle", | 241 { "downloadLocationBrowseTitle", |
| 242 IDS_OPTIONS_DOWNLOADLOCATION_BROWSE_TITLE }, | 242 IDS_OPTIONS_DOWNLOADLOCATION_BROWSE_TITLE }, |
| 243 { "downloadLocationChangeButton", | 243 { "downloadLocationChangeButton", |
| 244 IDS_OPTIONS_DOWNLOADLOCATION_CHANGE_BUTTON }, | 244 IDS_OPTIONS_DOWNLOADLOCATION_CHANGE_BUTTON }, |
| 245 { "downloadLocationGroupName", IDS_OPTIONS_DOWNLOADLOCATION_GROUP_NAME }, | 245 { "downloadLocationGroupName", IDS_OPTIONS_DOWNLOADLOCATION_GROUP_NAME }, |
| 246 { "enableLogging", IDS_OPTIONS_ENABLE_LOGGING }, | 246 { "enableLogging", IDS_OPTIONS_ENABLE_LOGGING }, |
| 247 { "metricsReportingResetRestart", IDS_OPTIONS_ENABLE_LOGGING_RESTART }, |
| 247 #if !defined(OS_CHROMEOS) | 248 #if !defined(OS_CHROMEOS) |
| 248 { "easyUnlockCheckboxLabel", IDS_OPTIONS_EASY_UNLOCK_CHECKBOX_LABEL }, | 249 { "easyUnlockCheckboxLabel", IDS_OPTIONS_EASY_UNLOCK_CHECKBOX_LABEL }, |
| 249 #endif | 250 #endif |
| 250 { "easyUnlockSectionTitle", IDS_OPTIONS_EASY_UNLOCK_SECTION_TITLE }, | 251 { "easyUnlockSectionTitle", IDS_OPTIONS_EASY_UNLOCK_SECTION_TITLE }, |
| 251 { "easyUnlockSetupButton", IDS_OPTIONS_EASY_UNLOCK_SETUP_BUTTON }, | 252 { "easyUnlockSetupButton", IDS_OPTIONS_EASY_UNLOCK_SETUP_BUTTON }, |
| 252 { "easyUnlockManagement", IDS_OPTIONS_EASY_UNLOCK_MANAGEMENT }, | 253 { "easyUnlockManagement", IDS_OPTIONS_EASY_UNLOCK_MANAGEMENT }, |
| 253 { "extensionControlled", IDS_OPTIONS_TAB_EXTENSION_CONTROLLED }, | 254 { "extensionControlled", IDS_OPTIONS_TAB_EXTENSION_CONTROLLED }, |
| 254 { "extensionDisable", IDS_OPTIONS_TAB_EXTENSION_CONTROLLED_DISABLE }, | 255 { "extensionDisable", IDS_OPTIONS_TAB_EXTENSION_CONTROLLED_DISABLE }, |
| 255 { "fontSettingsCustomizeFontsButton", | 256 { "fontSettingsCustomizeFontsButton", |
| 256 IDS_OPTIONS_FONTSETTINGS_CUSTOMIZE_FONTS_BUTTON }, | 257 IDS_OPTIONS_FONTSETTINGS_CUSTOMIZE_FONTS_BUTTON }, |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 522 values->Set("syncData", GetSyncStateDictionary().release()); | 523 values->Set("syncData", GetSyncStateDictionary().release()); |
| 523 | 524 |
| 524 // The Reset Profile Settings feature makes no sense for an off-the-record | 525 // The Reset Profile Settings feature makes no sense for an off-the-record |
| 525 // profile (e.g. in Guest mode on Chrome OS), so hide it. | 526 // profile (e.g. in Guest mode on Chrome OS), so hide it. |
| 526 values->SetBoolean("enableResetProfileSettings", | 527 values->SetBoolean("enableResetProfileSettings", |
| 527 !Profile::FromWebUI(web_ui())->IsOffTheRecord()); | 528 !Profile::FromWebUI(web_ui())->IsOffTheRecord()); |
| 528 | 529 |
| 529 values->SetString("privacyLearnMoreURL", chrome::kPrivacyLearnMoreURL); | 530 values->SetString("privacyLearnMoreURL", chrome::kPrivacyLearnMoreURL); |
| 530 values->SetString("doNotTrackLearnMoreURL", chrome::kDoNotTrackLearnMoreURL); | 531 values->SetString("doNotTrackLearnMoreURL", chrome::kDoNotTrackLearnMoreURL); |
| 531 | 532 |
| 533 #if !defined(OS_CHROMEOS) |
| 534 PrefService* pref_service = g_browser_process->local_state(); |
| 535 values->SetBoolean("metricsReportingEnabledAtStart", pref_service->GetBoolean( |
| 536 prefs::kMetricsReportingEnabled)); |
| 537 #endif |
| 538 |
| 532 #if defined(OS_CHROMEOS) | 539 #if defined(OS_CHROMEOS) |
| 533 // TODO(pastarmovj): replace this with a call to the CrosSettings list | 540 // TODO(pastarmovj): replace this with a call to the CrosSettings list |
| 534 // handling functionality to come. | 541 // handling functionality to come. |
| 535 values->Set("timezoneList", chromeos::system::GetTimezoneList().release()); | 542 values->Set("timezoneList", chromeos::system::GetTimezoneList().release()); |
| 536 | 543 |
| 537 values->SetString("accessibilityLearnMoreURL", | 544 values->SetString("accessibilityLearnMoreURL", |
| 538 chrome::kChromeAccessibilityHelpURL); | 545 chrome::kChromeAccessibilityHelpURL); |
| 539 | 546 |
| 540 std::string settings_url = std::string("chrome-extension://") + | 547 std::string settings_url = std::string("chrome-extension://") + |
| 541 extension_misc::kChromeVoxExtensionId + | 548 extension_misc::kChromeVoxExtensionId + |
| (...skipping 956 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1498 // at startup. | 1505 // at startup. |
| 1499 if (chrome::GetActiveDesktop() == chrome::HOST_DESKTOP_TYPE_ASH) { | 1506 if (chrome::GetActiveDesktop() == chrome::HOST_DESKTOP_TYPE_ASH) { |
| 1500 PrefService* pref_service = g_browser_process->local_state(); | 1507 PrefService* pref_service = g_browser_process->local_state(); |
| 1501 if (!pref_service->GetBoolean(prefs::kHardwareAccelerationModeEnabled)) { | 1508 if (!pref_service->GetBoolean(prefs::kHardwareAccelerationModeEnabled)) { |
| 1502 chrome::AttemptRestartToDesktopMode(); | 1509 chrome::AttemptRestartToDesktopMode(); |
| 1503 return; | 1510 return; |
| 1504 } | 1511 } |
| 1505 } | 1512 } |
| 1506 #endif | 1513 #endif |
| 1507 | 1514 |
| 1515 #if defined(OS_WIN) |
| 1516 // On Windows Breakpad will upload crash reports if the breakpad pipe name |
| 1517 // environment variable is defined. So we undefine this environment variable |
| 1518 // before restarting, as the restarted processes will inherit their |
| 1519 // environment variables from ours, thus suppressing crash uploads. |
| 1520 PrefService* pref_service = g_browser_process->local_state(); |
| 1521 if (!pref_service->GetBoolean(prefs::kMetricsReportingEnabled)) { |
| 1522 HMODULE exe_module = GetModuleHandle(chrome::kBrowserProcessExecutableName); |
| 1523 if (exe_module) { |
| 1524 typedef void (__cdecl *ClearBreakpadPipeEnvVar)(); |
| 1525 ClearBreakpadPipeEnvVar clear = reinterpret_cast<ClearBreakpadPipeEnvVar>( |
| 1526 GetProcAddress(exe_module, "ClearBreakpadPipeEnvironmentVariable")); |
| 1527 if (clear) |
| 1528 clear(); |
| 1529 } |
| 1530 } |
| 1531 #endif |
| 1532 |
| 1508 chrome::AttemptRestart(); | 1533 chrome::AttemptRestart(); |
| 1509 } | 1534 } |
| 1510 | 1535 |
| 1511 void BrowserOptionsHandler::HandleRequestProfilesInfo( | 1536 void BrowserOptionsHandler::HandleRequestProfilesInfo( |
| 1512 const base::ListValue* args) { | 1537 const base::ListValue* args) { |
| 1513 SendProfilesInfo(); | 1538 SendProfilesInfo(); |
| 1514 } | 1539 } |
| 1515 | 1540 |
| 1516 #if !defined(OS_CHROMEOS) | 1541 #if !defined(OS_CHROMEOS) |
| 1517 void BrowserOptionsHandler::ShowNetworkProxySettings( | 1542 void BrowserOptionsHandler::ShowNetworkProxySettings( |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1814 extension = extensions::GetExtensionOverridingProxy( | 1839 extension = extensions::GetExtensionOverridingProxy( |
| 1815 Profile::FromWebUI(web_ui())); | 1840 Profile::FromWebUI(web_ui())); |
| 1816 AppendExtensionData("proxy", extension, &extension_controlled); | 1841 AppendExtensionData("proxy", extension, &extension_controlled); |
| 1817 | 1842 |
| 1818 web_ui()->CallJavascriptFunction("BrowserOptions.toggleExtensionIndicators", | 1843 web_ui()->CallJavascriptFunction("BrowserOptions.toggleExtensionIndicators", |
| 1819 extension_controlled); | 1844 extension_controlled); |
| 1820 #endif // defined(OS_WIN) | 1845 #endif // defined(OS_WIN) |
| 1821 } | 1846 } |
| 1822 | 1847 |
| 1823 } // namespace options | 1848 } // namespace options |
| OLD | NEW |