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

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

Issue 424833008: adds restart message and link to crash reporting setting (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: removing html from grd 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
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"
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
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
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 955 matching lines...) Expand 10 before | Expand all | Expand 10 after
1497 // at startup. 1504 // at startup.
1498 if (chrome::GetActiveDesktop() == chrome::HOST_DESKTOP_TYPE_ASH) { 1505 if (chrome::GetActiveDesktop() == chrome::HOST_DESKTOP_TYPE_ASH) {
1499 PrefService* pref_service = g_browser_process->local_state(); 1506 PrefService* pref_service = g_browser_process->local_state();
1500 if (!pref_service->GetBoolean(prefs::kHardwareAccelerationModeEnabled)) { 1507 if (!pref_service->GetBoolean(prefs::kHardwareAccelerationModeEnabled)) {
1501 chrome::AttemptRestartToDesktopMode(); 1508 chrome::AttemptRestartToDesktopMode();
1502 return; 1509 return;
1503 } 1510 }
1504 } 1511 }
1505 #endif 1512 #endif
1506 1513
1514 #if defined(OS_WIN)
1515 // On Windows Breakpad will upload crash reports if the breakpad pipe name
1516 // environment variable is defined. So we undefine this environment variable
1517 // before restarting, as the restarted processes will inherit their
1518 // environment variables from ours, thus suppressing crash uploads.
1519 PrefService* pref_service = g_browser_process->local_state();
1520 if (!pref_service->GetBoolean(prefs::kMetricsReportingEnabled)) {
1521 HMODULE exe_module = GetModuleHandle(chrome::kBrowserProcessExecutableName);
1522 if (exe_module) {
1523 typedef void (__cdecl *ClearBreakpadPipeEnvVar)();
1524 ClearBreakpadPipeEnvVar clear = reinterpret_cast<ClearBreakpadPipeEnvVar>(
1525 GetProcAddress(exe_module, "ClearBreakpadPipeEnvironmentVariable"));
1526 if (clear) {
1527 (clear)();
Sigurður Ásgeirsson 2014/07/30 09:46:22 nit: wonky formatting and indent.
luken 2014/07/30 17:57:09 Done.
1528 }
1529 }
1530 }
1531 #endif
1532
1507 chrome::AttemptRestart(); 1533 chrome::AttemptRestart();
1508 } 1534 }
1509 1535
1510 void BrowserOptionsHandler::HandleRequestProfilesInfo( 1536 void BrowserOptionsHandler::HandleRequestProfilesInfo(
1511 const base::ListValue* args) { 1537 const base::ListValue* args) {
1512 SendProfilesInfo(); 1538 SendProfilesInfo();
1513 } 1539 }
1514 1540
1515 #if !defined(OS_CHROMEOS) 1541 #if !defined(OS_CHROMEOS)
1516 void BrowserOptionsHandler::ShowNetworkProxySettings( 1542 void BrowserOptionsHandler::ShowNetworkProxySettings(
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
1813 extension = extensions::GetExtensionOverridingProxy( 1839 extension = extensions::GetExtensionOverridingProxy(
1814 Profile::FromWebUI(web_ui())); 1840 Profile::FromWebUI(web_ui()));
1815 AppendExtensionData("proxy", extension, &extension_controlled); 1841 AppendExtensionData("proxy", extension, &extension_controlled);
1816 1842
1817 web_ui()->CallJavascriptFunction("BrowserOptions.toggleExtensionIndicators", 1843 web_ui()->CallJavascriptFunction("BrowserOptions.toggleExtensionIndicators",
1818 extension_controlled); 1844 extension_controlled);
1819 #endif // defined(OS_WIN) 1845 #endif // defined(OS_WIN)
1820 } 1846 }
1821 1847
1822 } // namespace options 1848 } // namespace options
OLDNEW
« no previous file with comments | « chrome/browser/resources/options/browser_options.js ('k') | components/breakpad/app/breakpad_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698