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 958 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1500 // at startup. | 1507 // at startup. |
1501 if (chrome::GetActiveDesktop() == chrome::HOST_DESKTOP_TYPE_ASH) { | 1508 if (chrome::GetActiveDesktop() == chrome::HOST_DESKTOP_TYPE_ASH) { |
1502 PrefService* pref_service = g_browser_process->local_state(); | 1509 PrefService* pref_service = g_browser_process->local_state(); |
1503 if (!pref_service->GetBoolean(prefs::kHardwareAccelerationModeEnabled)) { | 1510 if (!pref_service->GetBoolean(prefs::kHardwareAccelerationModeEnabled)) { |
1504 chrome::AttemptRestartToDesktopMode(); | 1511 chrome::AttemptRestartToDesktopMode(); |
1505 return; | 1512 return; |
1506 } | 1513 } |
1507 } | 1514 } |
1508 #endif | 1515 #endif |
1509 | 1516 |
| 1517 #if defined(OS_WIN) |
| 1518 // On Windows Breakpad will upload crash reports if the breakpad pipe name |
| 1519 // environment variable is defined. So we undefine this environment variable |
| 1520 // before restarting, as the restarted processes will inherit their |
| 1521 // environment variables from ours, thus suppressing crash uploads. |
| 1522 PrefService* pref_service = g_browser_process->local_state(); |
| 1523 if (!pref_service->GetBoolean(prefs::kMetricsReportingEnabled)) { |
| 1524 HMODULE exe_module = GetModuleHandle(chrome::kBrowserProcessExecutableName); |
| 1525 if (exe_module) { |
| 1526 typedef void (__cdecl *ClearBreakpadPipeEnvVar)(); |
| 1527 ClearBreakpadPipeEnvVar clear = reinterpret_cast<ClearBreakpadPipeEnvVar>( |
| 1528 GetProcAddress(exe_module, "ClearBreakpadPipeEnvironmentVariable")); |
| 1529 if (clear) |
| 1530 clear(); |
| 1531 } |
| 1532 } |
| 1533 #endif |
| 1534 |
1510 chrome::AttemptRestart(); | 1535 chrome::AttemptRestart(); |
1511 } | 1536 } |
1512 | 1537 |
1513 void BrowserOptionsHandler::HandleRequestProfilesInfo( | 1538 void BrowserOptionsHandler::HandleRequestProfilesInfo( |
1514 const base::ListValue* args) { | 1539 const base::ListValue* args) { |
1515 SendProfilesInfo(); | 1540 SendProfilesInfo(); |
1516 } | 1541 } |
1517 | 1542 |
1518 #if !defined(OS_CHROMEOS) | 1543 #if !defined(OS_CHROMEOS) |
1519 void BrowserOptionsHandler::ShowNetworkProxySettings( | 1544 void BrowserOptionsHandler::ShowNetworkProxySettings( |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1816 extension = extensions::GetExtensionOverridingProxy( | 1841 extension = extensions::GetExtensionOverridingProxy( |
1817 Profile::FromWebUI(web_ui())); | 1842 Profile::FromWebUI(web_ui())); |
1818 AppendExtensionData("proxy", extension, &extension_controlled); | 1843 AppendExtensionData("proxy", extension, &extension_controlled); |
1819 | 1844 |
1820 web_ui()->CallJavascriptFunction("BrowserOptions.toggleExtensionIndicators", | 1845 web_ui()->CallJavascriptFunction("BrowserOptions.toggleExtensionIndicators", |
1821 extension_controlled); | 1846 extension_controlled); |
1822 #endif // defined(OS_WIN) | 1847 #endif // defined(OS_WIN) |
1823 } | 1848 } |
1824 | 1849 |
1825 } // namespace options | 1850 } // namespace options |
OLD | NEW |