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

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

Issue 9302035: Re-add source files to gyp config for gcapi_dll. Removing them seems to make VS2005 unhappy. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 11 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
« no previous file with comments | « chrome/installer/gcapi/gcapi.h ('k') | chrome/installer/gcapi/gcapi.def » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/installer/gcapi/gcapi.cc
diff --git a/chrome/installer/gcapi/gcapi.cc b/chrome/installer/gcapi/gcapi.cc
index bac517991fde61333e1ab1e14dd492c16d6d0f16..79d3a3c1aa7bc5d4fe3bd550399bd1a613a8d96a 100644
--- a/chrome/installer/gcapi/gcapi.cc
+++ b/chrome/installer/gcapi/gcapi.cc
@@ -29,6 +29,7 @@
#include "base/win/scoped_com_initializer.h"
#include "base/win/scoped_comptr.h"
#include "base/win/scoped_handle.h"
+#include "chrome/installer/gcapi/gcapi_reactivation.h"
#include "chrome/installer/util/google_update_constants.h"
#include "chrome/installer/util/util_constants.h"
@@ -539,3 +540,74 @@ int __stdcall GoogleChromeDaysSinceLastRun() {
return days_since_last_run;
}
+
+BOOL __stdcall CanOfferReactivation(const wchar_t* brand_code,
+ int previous_brand_codes_length,
+ const wchar_t** previous_brand_codes,
+ DWORD* error_code) {
+ DCHECK(error_code);
+
+ if (!brand_code ||
+ (previous_brand_codes_length > 0 && previous_brand_codes == NULL)) {
+ if (error_code)
+ *error_code = REACTIVATE_ERROR_INVALID_INPUT;
+ 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) {
+ if (error_code)
+ *error_code = REACTIVATE_ERROR_NOTDORMANT;
+ return FALSE;
+ }
+
+ // Make sure we haven't previously been reactivated by this brand code
+ // or any of the previous brand codes from this partner.
+ std::vector<std::wstring> reactivation_brands;
+ reactivation_brands.push_back(brand_code);
+ if (previous_brand_codes_length > 0 && previous_brand_codes != NULL) {
+ std::copy(previous_brand_codes,
+ previous_brand_codes + previous_brand_codes_length,
+ std::back_inserter(reactivation_brands));
+ }
+ if (HasBeenReactivatedByBrandCodes(reactivation_brands)) {
+ if (error_code)
+ *error_code = REACTIVATE_ERROR_ALREADY_REACTIVATED;
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+BOOL __stdcall ReactivateChrome(wchar_t* brand_code,
+ int previous_brand_codes_length,
+ const wchar_t** previous_brand_codes,
+ DWORD* error_code) {
+ BOOL result = FALSE;
+ if (CanOfferReactivation(brand_code,
+ previous_brand_codes_length,
+ previous_brand_codes,
+ error_code)) {
+ if (SetReactivationBrandCode(brand_code)) {
+ // TODO(robertshield): Set Omaha reg key to add experiment label for
+ // tracking 7DA.
+ result = TRUE;
+ } else {
+ if (error_code)
+ *error_code = REACTIVATE_ERROR_REACTIVATION_FAILED;
+ }
+ }
+
+ return result;
+}
+
« no previous file with comments | « chrome/installer/gcapi/gcapi.h ('k') | chrome/installer/gcapi/gcapi.def » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698