diff options
author | mnissler@chromium.org <mnissler@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-03 07:58:19 +0000 |
---|---|---|
committer | mnissler@chromium.org <mnissler@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-03 07:58:19 +0000 |
commit | 1b084b5e0489af11d34e24286712668a5e61edfd (patch) | |
tree | 4473665981fd335fc0adde36f898ce4623aa1dcf /chrome/browser/browser_main.cc | |
parent | 91e9253e23325eaee915ab6fcd8ecae718b9108b (diff) | |
download | chromium_src-1b084b5e0489af11d34e24286712668a5e61edfd.zip chromium_src-1b084b5e0489af11d34e24286712668a5e61edfd.tar.gz chromium_src-1b084b5e0489af11d34e24286712668a5e61edfd.tar.bz2 |
[linux] Hook up crash reporter initialization with configuration management.
BUG=49662
TEST=Enable/Disable metrics reporting through policy and check whether the crash reporter respects that.
Review URL: http://codereview.chromium.org/3084008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@54716 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/browser_main.cc')
-rw-r--r-- | chrome/browser/browser_main.cc | 32 |
1 files changed, 24 insertions, 8 deletions
diff --git a/chrome/browser/browser_main.cc b/chrome/browser/browser_main.cc index 81e78a7..dd9e817 100644 --- a/chrome/browser/browser_main.cc +++ b/chrome/browser/browser_main.cc @@ -62,6 +62,7 @@ #include "chrome/common/chrome_constants.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_switches.h" +#include "chrome/common/env_vars.h" #include "chrome/common/json_pref_store.h" #include "chrome/common/jstemplate_builder.h" #include "chrome/common/main_function_params.h" @@ -801,14 +802,6 @@ int BrowserMain(const MainFunctionParams& parameters) { // tabs. g_browser_process->tab_closeable_state_watcher(); -#if defined(USE_LINUX_BREAKPAD) - // Needs to be called after we have chrome::DIR_USER_DATA and - // g_browser_process. - g_browser_process->file_thread()->message_loop()->PostTask(FROM_HERE, - new GetLinuxDistroTask()); - InitCrashReporter(); -#endif - // The broker service initialization needs to run early because it will // initialize the sandbox broker, which requires the process to swap its // window station. During this time all the UI will be broken. This has to @@ -818,6 +811,29 @@ int BrowserMain(const MainFunctionParams& parameters) { PrefService* local_state = InitializeLocalState(parsed_command_line, is_first_run); +#if defined(USE_LINUX_BREAKPAD) + // Needs to be called after we have chrome::DIR_USER_DATA and + // g_browser_process. + g_browser_process->file_thread()->message_loop()->PostTask(FROM_HERE, + new GetLinuxDistroTask()); + + // Check whether we should initialize the crash reporter. It may be disabled + // through configuration policy or user preference. The kHeadless environment + // variable overrides the decision, but only if the crash service is under + // control of the user. + const PrefService::Preference* metrics_reporting_enabled = + local_state->FindPreference(prefs::kMetricsReportingEnabled); + CHECK(metrics_reporting_enabled); + bool breakpad_enabled = + local_state->GetBoolean(prefs::kMetricsReportingEnabled); + if (!breakpad_enabled && metrics_reporting_enabled->IsUserModifiable()) { + breakpad_enabled = (getenv(env_vars::kHeadless) != NULL) || + parsed_command_line.HasSwitch(switches::kEnableCrashReporter); + } + if (breakpad_enabled) + InitCrashReporter(); +#endif + InitializeToolkit(); // Must happen before we try to display any UI. // If we're running tests (ui_task is non-null), then the ResourceBundle |