summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrogerta@chromium.org <rogerta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-29 21:59:27 +0000
committerrogerta@chromium.org <rogerta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-29 21:59:27 +0000
commitbbd15f67499da499cab76c084c1b04a3d248a2c3 (patch)
tree40c57345945c9fad14602068c69b54f964803af3
parenta9cf9e79c9ffc3c3fe9c87f7c0bd64a8fcdf65dc (diff)
downloadchromium_src-bbd15f67499da499cab76c084c1b04a3d248a2c3.zip
chromium_src-bbd15f67499da499cab76c084c1b04a3d248a2c3.tar.gz
chromium_src-bbd15f67499da499cab76c084c1b04a3d248a2c3.tar.bz2
Fix two problems found while testing chrome reactivation:
- C1S events were not being sent out for reactivated brand code. In the reactivation brand, the code was getting a cached copy of the RLZ string for the main brand code and thinking it had already set the C1S event - on uninstall, reactivation values remained in registry. Fixed the uninstaller to call RlZTracker::ClearProductState() so that the reactivation brand code case is handled as well BUG=90886 TEST=See RLZ test plan Review URL: http://codereview.chromium.org/7532005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@94767 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--DEPS2
-rw-r--r--chrome/browser/rlz/rlz.cc27
-rw-r--r--chrome/browser/rlz/rlz.h6
-rw-r--r--chrome/browser/rlz/rlz_unittest.cc16
-rw-r--r--chrome/installer/setup/uninstall.cc24
5 files changed, 28 insertions, 47 deletions
diff --git a/DEPS b/DEPS
index 92ce1cc..31f7468 100644
--- a/DEPS
+++ b/DEPS
@@ -305,7 +305,7 @@ deps_os = {
Var("nacl_tools_revision")),
"src/rlz":
- (Var("googlecode_url") % "rlz") + "/trunk@43",
+ (Var("googlecode_url") % "rlz") + "/trunk@44",
# Dependencies used by libjpeg-turbo
"src/third_party/yasm/binaries":
diff --git a/chrome/browser/rlz/rlz.cc b/chrome/browser/rlz/rlz.cc
index 4b75bd4..acdaf7f 100644
--- a/chrome/browser/rlz/rlz.cc
+++ b/chrome/browser/rlz/rlz.cc
@@ -36,9 +36,6 @@
namespace {
-// The maximum length of an access points RLZ in wide chars.
-const DWORD kMaxRlzLength = 64;
-
enum {
ACCESS_VALUES_STALE, // Possibly new values available.
ACCESS_VALUES_FRESH // The cached values are current.
@@ -226,11 +223,14 @@ class DelayedInitTask : public Task {
// Do the initial event recording if is the first run or if we have an
// empty rlz which means we haven't got a chance to do it.
- std::wstring omnibox_rlz;
- RLZTracker::GetAccessPointRlz(rlz_lib::CHROME_OMNIBOX, &omnibox_rlz);
+ char omnibox_rlz[rlz_lib::kMaxRlzLength + 1];
+ if (!rlz_lib::GetAccessPointRlz(rlz_lib::CHROME_OMNIBOX, omnibox_rlz,
+ rlz_lib::kMaxRlzLength, NULL)) {
+ omnibox_rlz[0] = 0;
+ }
// Record if google is the initial search provider.
- if ((first_run || omnibox_rlz.empty()) && google_default_search &&
+ if ((first_run || omnibox_rlz[0] == 0) && google_default_search &&
!already_ran) {
rlz_lib::RecordProductEvent(rlz_lib::CHROME,
rlz_lib::CHROME_OMNIBOX,
@@ -333,19 +333,6 @@ bool RLZTracker::RecordProductEvent(rlz_lib::Product product,
return ret;
}
-bool RLZTracker::ClearAllProductEvents(rlz_lib::Product product) {
- bool ret = rlz_lib::ClearAllProductEvents(product);
-
- // If chrome has been reactivated, clear all events for this brand as well.
- std::wstring reactivation_brand;
- if (GoogleUpdateSettings::GetReactivationBrand(&reactivation_brand)) {
- rlz_lib::SupplementaryBranding branding(reactivation_brand.c_str());
- ret &= rlz_lib::ClearAllProductEvents(product);
- }
-
- return ret;
-}
-
// We implement caching of the answer of get_access_point() if the request
// is for CHROME_OMNIBOX. If we had a successful ping, then we update the
// cached value.
@@ -379,7 +366,7 @@ bool RLZTracker::GetAccessPointRlz(rlz_lib::AccessPoint point,
return false;
}
- char str_rlz[kMaxRlzLength + 1];
+ char str_rlz[rlz_lib::kMaxRlzLength + 1];
if (!rlz_lib::GetAccessPointRlz(point, str_rlz, rlz_lib::kMaxRlzLength, NULL))
return false;
*rlz = ASCIIToWide(std::string(str_rlz));
diff --git a/chrome/browser/rlz/rlz.h b/chrome/browser/rlz/rlz.h
index feddc5c..ca2658d 100644
--- a/chrome/browser/rlz/rlz.h
+++ b/chrome/browser/rlz/rlz.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
@@ -50,10 +50,6 @@ class RLZTracker {
// an empty string can be returned which is not an error.
static bool GetAccessPointRlz(rlz_lib::AccessPoint point, std::wstring* rlz);
- // Clear all events reported by this product. In Chrome this will be called
- // when it is un-installed.
- static bool ClearAllProductEvents(rlz_lib::Product product);
-
// Invoked during shutdown to clean up any state created by RLZTracker.
static void CleanupRlz();
diff --git a/chrome/browser/rlz/rlz_unittest.cc b/chrome/browser/rlz/rlz_unittest.cc
index 1b53bf6e4..6a5e85d 100644
--- a/chrome/browser/rlz/rlz_unittest.cc
+++ b/chrome/browser/rlz/rlz_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
@@ -49,17 +49,3 @@ TEST(RlzLibTest, RecordProductEvent) {
EXPECT_EQ(1, recorded_value);
EXPECT_TRUE(CleanValue(kKeyName, kEvent2));
}
-
-TEST(RlzLibTest, CleanProductEvents) {
- DWORD recorded_value = 0;
- EXPECT_TRUE(RLZTracker::RecordProductEvent(rlz_lib::CHROME,
- rlz_lib::CHROME_OMNIBOX, rlz_lib::FIRST_SEARCH));
- const wchar_t kEvent1[] = L"C1F";
- RegKey key1;
- EXPECT_EQ(ERROR_SUCCESS, key1.Open(HKEY_CURRENT_USER, kKeyName, KEY_READ));
- EXPECT_EQ(ERROR_SUCCESS, key1.ReadValueDW(kEvent1, &recorded_value));
- EXPECT_EQ(1, recorded_value);
-
- EXPECT_TRUE(RLZTracker::ClearAllProductEvents(rlz_lib::CHROME));
- EXPECT_FALSE(CleanValue(kKeyName, kEvent1));
-}
diff --git a/chrome/installer/setup/uninstall.cc b/chrome/installer/setup/uninstall.cc
index c812e79..f0d7a58 100644
--- a/chrome/installer/setup/uninstall.cc
+++ b/chrome/installer/setup/uninstall.cc
@@ -25,6 +25,7 @@
#include "chrome/installer/util/channel_info.h"
#include "chrome/installer/util/delete_after_reboot_helper.h"
#include "chrome/installer/util/google_update_constants.h"
+#include "chrome/installer/util/google_update_settings.h"
#include "chrome/installer/util/helper.h"
#include "chrome/installer/util/install_util.h"
#include "chrome/installer/util/installation_state.h"
@@ -118,6 +119,21 @@ void ProcessQuickEnableWorkItems(
LOG(ERROR) << "Failed to update quick-enable-cf command.";
}
+void ClearRlzProductState() {
+ const rlz_lib::AccessPoint points[] = {rlz_lib::CHROME_OMNIBOX,
+ rlz_lib::CHROME_HOME_PAGE,
+ rlz_lib::NO_ACCESS_POINT};
+
+ rlz_lib::ClearProductState(rlz_lib::CHROME, points);
+
+ // If chrome has been reactivated, clear all events for this brand as well.
+ std::wstring reactivation_brand;
+ if (GoogleUpdateSettings::GetReactivationBrand(&reactivation_brand)) {
+ rlz_lib::SupplementaryBranding branding(reactivation_brand.c_str());
+ rlz_lib::ClearProductState(rlz_lib::CHROME, points);
+ }
+}
+
} // namespace
namespace installer {
@@ -689,12 +705,8 @@ InstallStatus UninstallProduct(const InstallationState& original_state,
// Chrome is not in use so lets uninstall Chrome by deleting various files
// and registry entries. Here we will just make best effort and keep going
// in case of errors.
- if (is_chrome) {
- const rlz_lib::AccessPoint access_points[] = {rlz_lib::CHROME_OMNIBOX,
- rlz_lib::CHROME_HOME_PAGE,
- rlz_lib::NO_ACCESS_POINT};
- rlz_lib::ClearProductState(rlz_lib::CHROME, access_points);
- }
+ if (is_chrome)
+ ClearRlzProductState();
// First delete shortcuts from Start->Programs, Desktop & Quick Launch.
DeleteChromeShortcuts(installer_state, product);