summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorrobertshield@google.com <robertshield@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-13 17:01:35 +0000
committerrobertshield@google.com <robertshield@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-13 17:01:35 +0000
commit6b5f21d8a7f8c0b6b4a689f32afe62fe64d0fa04 (patch)
treebd2101b86b5f3ee1f3f27bd354880de932e668b4 /chrome
parentaff38a3e93fb5a63cd9eda1b2995996f16c713ac (diff)
downloadchromium_src-6b5f21d8a7f8c0b6b4a689f32afe62fe64d0fa04.zip
chromium_src-6b5f21d8a7f8c0b6b4a689f32afe62fe64d0fa04.tar.gz
chromium_src-6b5f21d8a7f8c0b6b4a689f32afe62fe64d0fa04.tar.bz2
Review URL: http://codereview.chromium.org/62160
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@13600 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/browser_main.cc11
-rw-r--r--chrome/browser/metrics/metrics_service.cc1
-rw-r--r--chrome/common/pref_names.cc2
-rw-r--r--chrome/common/pref_names.h1
-rw-r--r--chrome/installer/util/google_chrome_distribution.cc15
-rw-r--r--chrome/installer/util/google_chrome_distribution_unittest.cc10
6 files changed, 20 insertions, 20 deletions
diff --git a/chrome/browser/browser_main.cc b/chrome/browser/browser_main.cc
index 0ef576f..9e9d656 100644
--- a/chrome/browser/browser_main.cc
+++ b/chrome/browser/browser_main.cc
@@ -17,6 +17,7 @@
#include "base/string_piece.h"
#include "base/string_util.h"
#include "base/system_monitor.h"
+#include "base/time.h"
#include "base/tracked_objects.h"
#include "base/values.h"
#include "chrome/browser/browser_main_win.h"
@@ -372,6 +373,16 @@ int BrowserMain(const MainFunctionParams& parameters) {
// services aware of all our preferences.
browser::RegisterAllPrefs(user_prefs, local_state);
+ // Now that all preferences have been registered, set the install date
+ // for the uninstall metrics if this is our first run. This only actually
+ // gets used if the user has metrics reporting enabled at uninstall time.
+ int64 install_date =
+ local_state->GetInt64(prefs::kUninstallMetricsInstallDate);
+ if (install_date == 0) {
+ local_state->SetInt64(prefs::kUninstallMetricsInstallDate,
+ base::Time::Now().ToTimeT());
+ }
+
// Record last shutdown time into a histogram.
browser_shutdown::ReadLastShutdownInfo();
diff --git a/chrome/browser/metrics/metrics_service.cc b/chrome/browser/metrics/metrics_service.cc
index 8e94e98..2d5b502 100644
--- a/chrome/browser/metrics/metrics_service.cc
+++ b/chrome/browser/metrics/metrics_service.cc
@@ -339,6 +339,7 @@ void MetricsService::RegisterPrefs(PrefService* local_state) {
local_state->RegisterInt64Pref(prefs::kUninstallMetricsPageLoadCount, 0);
local_state->RegisterInt64Pref(prefs::kUninstallLaunchCount, 0);
+ local_state->RegisterInt64Pref(prefs::kUninstallMetricsInstallDate, 0);
local_state->RegisterInt64Pref(prefs::kUninstallMetricsUptimeSec, 0);
local_state->RegisterInt64Pref(prefs::kUninstallLastLaunchTimeSec, 0);
local_state->RegisterInt64Pref(prefs::kUninstallLastObservedRunTimeSec, 0);
diff --git a/chrome/common/pref_names.cc b/chrome/common/pref_names.cc
index 300e6ab..5adf211 100644
--- a/chrome/common/pref_names.cc
+++ b/chrome/common/pref_names.cc
@@ -383,6 +383,8 @@ const wchar_t kStabilityPluginCrashes[] = L"crashes";
const wchar_t kUninstallMetricsPageLoadCount[] =
L"uninstall_metrics.page_load_count";
const wchar_t kUninstallLaunchCount[] = L"uninstall_metrics.launch_count";
+const wchar_t kUninstallMetricsInstallDate[] =
+ L"uninstall_metrics.installation_date2";
const wchar_t kUninstallMetricsUptimeSec[] = L"uninstall_metrics.uptime_sec";
const wchar_t kUninstallLastLaunchTimeSec[] =
L"uninstall_metrics.last_launch_time_sec";
diff --git a/chrome/common/pref_names.h b/chrome/common/pref_names.h
index 9ca99fa..79f8e11 100644
--- a/chrome/common/pref_names.h
+++ b/chrome/common/pref_names.h
@@ -131,6 +131,7 @@ extern const wchar_t kStabilityPluginCrashes[];
extern const wchar_t kUninstallMetricsPageLoadCount[];
extern const wchar_t kUninstallLaunchCount[];
+extern const wchar_t kUninstallMetricsInstallDate[];
extern const wchar_t kUninstallMetricsUptimeSec[];
extern const wchar_t kUninstallLastLaunchTimeSec[];
extern const wchar_t kUninstallLastObservedRunTimeSec[];
diff --git a/chrome/installer/util/google_chrome_distribution.cc b/chrome/installer/util/google_chrome_distribution.cc
index 76ea297..920ea47 100644
--- a/chrome/installer/util/google_chrome_distribution.cc
+++ b/chrome/installer/util/google_chrome_distribution.cc
@@ -101,21 +101,6 @@ bool GoogleChromeDistribution::ExtractUninstallMetrics(
return false;
}
- // We use the creation date of the metric's client id as the installation
- // date, as this is fairly close to the first-run date for those who
- // opt-in to metrics from the get-go. Slightly more accurate would be to
- // have setup.exe write something somewhere at installation time.
- // As is, the absence of this field implies that the browser was never
- // run with an opt-in to metrics selection.
- std::wstring installation_date;
- if (root.GetString(prefs::kMetricsClientIDTimestamp, &installation_date)) {
- uninstall_metrics_string->append(L"&");
- uninstall_metrics_string->append(
- installer_util::kUninstallInstallationDate);
- uninstall_metrics_string->append(L"=");
- uninstall_metrics_string->append(installation_date);
- }
-
return true;
}
diff --git a/chrome/installer/util/google_chrome_distribution_unittest.cc b/chrome/installer/util/google_chrome_distribution_unittest.cc
index bd13cdc..cca9e52 100644
--- a/chrome/installer/util/google_chrome_distribution_unittest.cc
+++ b/chrome/installer/util/google_chrome_distribution_unittest.cc
@@ -194,7 +194,8 @@ TEST_F(GoogleChromeDistributionTest, TestExtractUninstallMetrics) {
" \"last_observed_running_time_sec\": \"1235341183\","
" \"launch_count\": \"11\","
" \"page_load_count\": \"68\","
- " \"uptime_sec\": \"809\"\n"
+ " \"uptime_sec\": \"809\","
+ " \"installation_date2\": \"1235341141\"\n"
" },\n"
" \"blah\": {\n"
" \"this_sentence_is_true\": false\n"
@@ -207,11 +208,11 @@ TEST_F(GoogleChromeDistributionTest, TestExtractUninstallMetrics) {
// The URL string we expect to be generated from said make-believe file.
std::wstring expected_url_string(
+ L"&installation_date2=1235341141"
L"&last_launch_time_sec=1235341118"
L"&last_observed_running_time_sec=1235341183"
- L"&launch_count=11&page_load_count=68&uptime_sec=809&");
- expected_url_string += installer_util::kUninstallInstallationDate;
- expected_url_string += L"=1234567890";
+ L"&launch_count=11&page_load_count=68"
+ L"&uptime_sec=809");
JSONStringValueSerializer json_deserializer(pref_string);
std::string error_message;
@@ -294,4 +295,3 @@ TEST(MasterPreferences, ParseDistroParams) {
EXPECT_TRUE(result & installer_util::MASTER_PROFILE_ALT_SHORTCUT_TXT);
EXPECT_TRUE(file_util::Delete(prefs, false));
}
-