Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4262)

Unified Diff: chrome/installer/gcapi/gcapi.cc

Issue 9704022: This patch modifies some aspects of GCAPI in support of the new Chrome reactivation functions. (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/installer/gcapi/gcapi.cc
===================================================================
--- chrome/installer/gcapi/gcapi.cc (revision 125017)
+++ chrome/installer/gcapi/gcapi.cc (working copy)
@@ -569,15 +569,6 @@
return FALSE;
}
- bool has_system_install = IsChromeInstalled(HKEY_LOCAL_MACHINE);
- bool has_user_install = IsChromeInstalled(HKEY_CURRENT_USER);
-
- if (!has_system_install && !has_user_install) {
- if (error_code)
- *error_code = REACTIVATE_ERROR_NOTINSTALLED;
- return FALSE;
- }
-
int days_since_last_run = GoogleChromeDaysSinceLastRun();
if (days_since_last_run >= 0 &&
days_since_last_run < kReactivationMinDaysDormant) {
@@ -586,13 +577,20 @@
return FALSE;
}
- // Make sure we haven't previously been reactivated by this brand code
- // or any of the previous brand codes from this partner.
- // Since this function is invoked by ReactivateChrome, and since
- // ReactivateChrome is called first in non-elevated shell and
- // second in UAC-elevated shell, we only want to execute this block
- // of code the first time, in non-elevated mode.
+ // Only run the code below when this function is invoked from a standard,
+ // non-elevated cmd shell. This is because this section of code looks at
+ // values in HKEY_CURRENT_USER, and we only want to look at the logged-in
+ // user's HKCU, not the admin user's HKCU.
if (shell_mode == GCAPI_INVOKED_STANDARD_SHELL) {
+ bool has_system_install = IsChromeInstalled(HKEY_LOCAL_MACHINE);
+ bool has_user_install = IsChromeInstalled(HKEY_CURRENT_USER);
robertshield 2012/03/23 17:52:16 for brevity, consider deleting these temp variable
mgraboski 2012/03/23 21:40:35 Done.
+
+ if (!has_system_install && !has_user_install) {
+ if (error_code)
+ *error_code = REACTIVATE_ERROR_NOTINSTALLED;
+ return FALSE;
+ }
+
std::vector<std::wstring> reactivation_brands;
reactivation_brands.push_back(brand_code);
if (previous_brand_codes_length > 0 && previous_brand_codes != NULL) {
@@ -600,7 +598,7 @@
previous_brand_codes + previous_brand_codes_length,
std::back_inserter(reactivation_brands));
}
robertshield 2012/03/23 17:52:16 you can delete the above 7 lines if reactivation_b
mgraboski 2012/03/23 21:40:35 Done.
- if (HasBeenReactivatedByBrandCodes(reactivation_brands)) {
+ if (HasBeenReactivated()) {
if (error_code)
*error_code = REACTIVATE_ERROR_ALREADY_REACTIVATED;
return FALSE;

Powered by Google App Engine
This is Rietveld 408576698