summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/metrics/metrics_service.cc14
-rw-r--r--chrome/browser/metrics/metrics_service.h3
-rw-r--r--chrome/browser/views/options/advanced_contents_view.cc7
-rw-r--r--chrome/installer/util/browser_distribution.cc13
-rw-r--r--chrome/installer/util/browser_distribution.h6
-rw-r--r--chrome/installer/util/google_chrome_distribution.cc13
-rw-r--r--chrome/installer/util/google_chrome_distribution.h6
-rw-r--r--chrome/installer/util/google_update_settings.cc29
8 files changed, 63 insertions, 28 deletions
diff --git a/chrome/browser/metrics/metrics_service.cc b/chrome/browser/metrics/metrics_service.cc
index 1e447ea..0a21a2c 100644
--- a/chrome/browser/metrics/metrics_service.cc
+++ b/chrome/browser/metrics/metrics_service.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2006-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.
@@ -186,6 +186,7 @@
#include "chrome/common/pref_names.h"
#include "chrome/common/pref_service.h"
#include "chrome/common/render_messages.h"
+#include "chrome/installer/util/browser_distribution.h"
#include "googleurl/src/gurl.h"
#include "net/base/load_flags.h"
#include "third_party/bzip2/bzlib.h"
@@ -203,9 +204,6 @@ using base::TimeDelta;
// Check to see that we're being called on only one thread.
static bool IsSingleThreaded();
-static const char kMetricsURL[] =
- "https://clients4.google.com/firefox/metrics/collect";
-
static const char kMetricsType[] = "application/vnd.mozilla.metrics.bz2";
// The delay, in seconds, after startup before sending the first log message.
@@ -595,6 +593,9 @@ void MetricsService::RecordBreakpadHasDebugger(bool has_debugger) {
// Initialization methods
void MetricsService::InitializeMetricsState() {
+ BrowserDistribution* dist = BrowserDistribution::GetDistribution();
+ server_url_ = dist->GetStatsServerURL();
+
PrefService* pref = g_browser_process->local_state();
DCHECK(pref);
@@ -1150,7 +1151,8 @@ void MetricsService::PrepareFetchWithPendingLog() {
return;
}
- current_fetch_.reset(new URLFetcher(GURL(kMetricsURL), URLFetcher::POST,
+ current_fetch_.reset(new URLFetcher(GURL(server_url_),
+ URLFetcher::POST,
this));
current_fetch_->set_request_context(Profile::GetDefaultRequestContext());
current_fetch_->set_upload_data(kMetricsType, compressed_log);
@@ -1313,7 +1315,7 @@ void MetricsService::OnURLFetchComplete(const URLFetcher* source,
void MetricsService::HandleBadResponseCode() {
LOG(INFO) << "Verify your metrics logs are formatted correctly. "
- "Verify server is active at " << kMetricsURL;
+ "Verify server is active at " << server_url_;
if (!pending_log()) {
LOG(INFO) << "METRICS: Recorder shutdown during log transmission.";
} else {
diff --git a/chrome/browser/metrics/metrics_service.h b/chrome/browser/metrics/metrics_service.h
index d5fa3c1..426c66e 100644
--- a/chrome/browser/metrics/metrics_service.h
+++ b/chrome/browser/metrics/metrics_service.h
@@ -411,6 +411,9 @@ class MetricsService : public NotificationObserver,
// The log that we are still appending to.
MetricsLog* current_log_;
+ // The URL for the metrics server.
+ std::wstring server_url_;
+
// The identifier that's sent to the server with the log reports.
std::string client_id_;
diff --git a/chrome/browser/views/options/advanced_contents_view.cc b/chrome/browser/views/options/advanced_contents_view.cc
index 1f73219..3063339 100644
--- a/chrome/browser/views/options/advanced_contents_view.cc
+++ b/chrome/browser/views/options/advanced_contents_view.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2006-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.
@@ -501,6 +501,11 @@ void PrivacySection::InitControlLayout() {
l10n_util::GetString(IDS_OPTIONS_ENABLE_LOGGING));
reporting_enabled_checkbox_->SetMultiLine(true);
reporting_enabled_checkbox_->set_listener(this);
+#if defined(GOOGLE_CHROME_BUILD)
+ reporting_enabled_checkbox_->SetVisible(true);
+#else
+ reporting_enabled_checkbox_->SetVisible(false);
+#endif
learn_more_link_ = new views::Link(l10n_util::GetString(IDS_LEARN_MORE));
learn_more_link_->SetController(this);
cookie_behavior_label_ = new views::Label(
diff --git a/chrome/installer/util/browser_distribution.cc b/chrome/installer/util/browser_distribution.cc
index 8cf587f..529d8ca 100644
--- a/chrome/installer/util/browser_distribution.cc
+++ b/chrome/installer/util/browser_distribution.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2006-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.
//
@@ -7,8 +7,9 @@
// specific branding, we will need to extend this class with a custom
// implementation.
-#include "base/registry.h"
#include "chrome/installer/util/browser_distribution.h"
+
+#include "base/registry.h"
#include "chrome/installer/util/google_chrome_distribution.h"
BrowserDistribution* BrowserDistribution::GetDistribution() {
@@ -57,6 +58,14 @@ std::wstring BrowserDistribution::GetStateKey() {
return L"Software\\Chromium";
}
+std::wstring BrowserDistribution::GetStateMediumKey() {
+ return L"Software\\Chromium";
+}
+
+std::wstring BrowserDistribution::GetStatsServerURL() {
+ return L"";
+}
+
std::wstring BrowserDistribution::GetDistributionData(RegKey* key) {
return L"";
}
diff --git a/chrome/installer/util/browser_distribution.h b/chrome/installer/util/browser_distribution.h
index 1ac8ada..a525f61 100644
--- a/chrome/installer/util/browser_distribution.h
+++ b/chrome/installer/util/browser_distribution.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2006-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.
//
@@ -38,6 +38,10 @@ class BrowserDistribution {
virtual std::wstring GetStateKey();
+ virtual std::wstring GetStateMediumKey();
+
+ virtual std::wstring GetStatsServerURL();
+
virtual std::wstring GetDistributionData(RegKey* key);
virtual std::wstring GetUninstallLinkName();
diff --git a/chrome/installer/util/google_chrome_distribution.cc b/chrome/installer/util/google_chrome_distribution.cc
index 4cc7858..f1b31b4 100644
--- a/chrome/installer/util/google_chrome_distribution.cc
+++ b/chrome/installer/util/google_chrome_distribution.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2006-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.
//
@@ -227,6 +227,17 @@ std::wstring GoogleChromeDistribution::GetStateKey() {
return key;
}
+std::wstring GoogleChromeDistribution::GetStateMediumKey() {
+ std::wstring key(google_update::kRegPathClientStateMedium);
+ key.append(L"\\");
+ key.append(google_update::kChromeGuid);
+ return key;
+}
+
+std::wstring GoogleChromeDistribution::GetStatsServerURL() {
+ return L"https://clients4.google.com/firefox/metrics/collect";
+}
+
std::wstring GoogleChromeDistribution::GetDistributionData(RegKey* key) {
DCHECK(NULL != key);
std::wstring sub_key(google_update::kRegPathClientState);
diff --git a/chrome/installer/util/google_chrome_distribution.h b/chrome/installer/util/google_chrome_distribution.h
index 24b6930..4677e94 100644
--- a/chrome/installer/util/google_chrome_distribution.h
+++ b/chrome/installer/util/google_chrome_distribution.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2006-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.
//
@@ -60,6 +60,10 @@ class GoogleChromeDistribution : public BrowserDistribution {
virtual std::wstring GetStateKey();
+ virtual std::wstring GetStateMediumKey();
+
+ virtual std::wstring GetStatsServerURL();
+
// This method reads data from the Google Update ClientState key for
// potential use in the uninstall survey. It must be called before the
// key returned by GetVersionKey() is deleted.
diff --git a/chrome/installer/util/google_update_settings.cc b/chrome/installer/util/google_update_settings.cc
index 326a595..cbd887d 100644
--- a/chrome/installer/util/google_update_settings.cc
+++ b/chrome/installer/util/google_update_settings.cc
@@ -1,25 +1,18 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2006-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/registry.h"
+#include "chrome/installer/util/browser_distribution.h"
#include "chrome/installer/util/google_update_constants.h"
namespace {
-std::wstring GetClientStateKeyPath(const bool use_medium_key) {
- std::wstring reg_path(use_medium_key ?
- google_update::kRegPathClientStateMedium :
- google_update::kRegPathClientState);
- reg_path.append(L"\\");
- reg_path.append(google_update::kChromeGuid);
- return reg_path;
-}
-
bool ReadGoogleUpdateStrKey(const wchar_t* const name, std::wstring* value) {
- std::wstring reg_path = GetClientStateKeyPath(false);
+ BrowserDistribution* dist = BrowserDistribution::GetDistribution();
+ std::wstring reg_path = dist->GetStateKey();
RegKey key(HKEY_CURRENT_USER, reg_path.c_str(), KEY_READ);
if (!key.ReadValue(name, value)) {
RegKey hklm_key(HKEY_LOCAL_MACHINE, reg_path.c_str(), KEY_READ);
@@ -29,7 +22,8 @@ bool ReadGoogleUpdateStrKey(const wchar_t* const name, std::wstring* value) {
}
bool ClearGoogleUpdateStrKey(const wchar_t* const name) {
- std::wstring reg_path = GetClientStateKeyPath(false);
+ BrowserDistribution* dist = BrowserDistribution::GetDistribution();
+ std::wstring reg_path = dist->GetStateKey();
RegKey key(HKEY_CURRENT_USER, reg_path.c_str(), KEY_READ | KEY_WRITE);
std::wstring value;
if (!key.ReadValue(name, &value))
@@ -40,7 +34,8 @@ bool ClearGoogleUpdateStrKey(const wchar_t* const name) {
} // namespace.
bool GoogleUpdateSettings::GetCollectStatsConsent() {
- std::wstring reg_path = GetClientStateKeyPath(false);
+ BrowserDistribution* dist = BrowserDistribution::GetDistribution();
+ std::wstring reg_path = dist->GetStateKey();
RegKey key(HKEY_CURRENT_USER, reg_path.c_str(), KEY_READ);
DWORD value;
if (!key.ReadValueDW(google_update::kRegUsageStatsField, &value)) {
@@ -54,17 +49,19 @@ bool GoogleUpdateSettings::GetCollectStatsConsent() {
bool GoogleUpdateSettings::SetCollectStatsConsent(bool consented) {
DWORD value = consented? 1 : 0;
// Writing to HKLM is only a best effort deal.
- std::wstring reg_path = GetClientStateKeyPath(true);
+ BrowserDistribution* dist = BrowserDistribution::GetDistribution();
+ std::wstring reg_path = dist->GetStateMediumKey();
RegKey key_hklm(HKEY_LOCAL_MACHINE, reg_path.c_str(), KEY_READ | KEY_WRITE);
key_hklm.WriteValue(google_update::kRegUsageStatsField, value);
// Writing to HKCU is used both by chrome and by the crash reporter.
- reg_path = GetClientStateKeyPath(false);
+ reg_path = dist->GetStateKey();
RegKey key_hkcu(HKEY_CURRENT_USER, reg_path.c_str(), KEY_READ | KEY_WRITE);
return key_hkcu.WriteValue(google_update::kRegUsageStatsField, value);
}
bool GoogleUpdateSettings::SetEULAConsent(bool consented) {
- std::wstring reg_path = GetClientStateKeyPath(true);
+ BrowserDistribution* dist = BrowserDistribution::GetDistribution();
+ std::wstring reg_path = dist->GetStateMediumKey();
RegKey key(HKEY_LOCAL_MACHINE, reg_path.c_str(), KEY_READ | KEY_SET_VALUE);
return key.WriteValue(google_update::kRegEULAAceptedField, consented? 1 : 0);
}