diff options
author | thestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-28 20:23:06 +0000 |
---|---|---|
committer | thestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-28 20:23:06 +0000 |
commit | 1e7377df1449c4e543a50c8a8a1425599c8425f7 (patch) | |
tree | 6e8ee3adcba66e4a043e91e91e0217467682a7fd /chrome/browser/google_update_settings_linux.cc | |
parent | 34cf340da15aceffd59c3d05e0de2a3bc5174a2d (diff) | |
download | chromium_src-1e7377df1449c4e543a50c8a8a1425599c8425f7.zip chromium_src-1e7377df1449c4e543a50c8a8a1425599c8425f7.tar.gz chromium_src-1e7377df1449c4e543a50c8a8a1425599c8425f7.tar.bz2 |
Respect Linux user prefs with regards to crash reporting.
This involves implementing GoogleUpdateSettings::[GS]etCollectStatsConsent, and a whole lot of refactoring.
BUG=none
TEST=delete config dir, run official Linux build, don't enable crash reporting, crash browser -> no crash reporting.
Review URL: http://codereview.chromium.org/115808
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@17104 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/google_update_settings_linux.cc')
-rw-r--r-- | chrome/browser/google_update_settings_linux.cc | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/chrome/browser/google_update_settings_linux.cc b/chrome/browser/google_update_settings_linux.cc new file mode 100644 index 0000000..f7ae4b5 --- /dev/null +++ b/chrome/browser/google_update_settings_linux.cc @@ -0,0 +1,41 @@ +// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/installer/util/google_update_settings.h" + +#include "base/file_util.h" +#include "base/logging.h" +#include "base/path_service.h" +#include "chrome/common/chrome_paths.h" + +// File name used in the user data dir to indicate consent. +static const char kConsentToSendStats[] = "Consent To Send Stats"; + +// static +bool GoogleUpdateSettings::GetCollectStatsConsent() { + FilePath consent_file; + PathService::Get(chrome::DIR_USER_DATA, &consent_file); + consent_file = consent_file.Append(kConsentToSendStats); + return file_util::PathExists(consent_file); +} + +// static +bool GoogleUpdateSettings::SetCollectStatsConsent(bool consented) { + FilePath consent_dir; + PathService::Get(chrome::DIR_USER_DATA, &consent_dir); + if (!file_util::DirectoryExists(consent_dir)) + return false; + + FilePath consent_file = consent_dir.AppendASCII(kConsentToSendStats); + if (consented) + return file_util::WriteFile(consent_file, "", 0) == 0; + else + return file_util::Delete(consent_file, false); +} + +// static +bool GoogleUpdateSettings::GetLanguage(std::wstring* language) { + NOTIMPLEMENTED(); + return false; +} |