OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_INSTALLER_GCAPI_GCAPI_H_ | 5 #ifndef CHROME_INSTALLER_GCAPI_GCAPI_H_ |
6 #define CHROME_INSTALLER_GCAPI_GCAPI_H_ | 6 #define CHROME_INSTALLER_GCAPI_GCAPI_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <windows.h> | 9 #include <windows.h> |
10 | 10 |
11 extern "C" { | 11 extern "C" { |
12 // Error conditions for GoogleChromeCompatibilityCheck(). | 12 // Error conditions for GoogleChromeCompatibilityCheck(). |
13 #define GCCC_ERROR_USERLEVELALREADYPRESENT 0x01 | 13 #define GCCC_ERROR_USERLEVELALREADYPRESENT 0x01 |
14 #define GCCC_ERROR_SYSTEMLEVELALREADYPRESENT 0x02 | 14 #define GCCC_ERROR_SYSTEMLEVELALREADYPRESENT 0x02 |
15 #define GCCC_ERROR_ACCESSDENIED 0x04 | 15 #define GCCC_ERROR_ACCESSDENIED 0x04 |
16 #define GCCC_ERROR_OSNOTSUPPORTED 0x08 | 16 #define GCCC_ERROR_OSNOTSUPPORTED 0x08 |
17 #define GCCC_ERROR_ALREADYOFFERED 0x10 | 17 #define GCCC_ERROR_ALREADYOFFERED 0x10 |
18 #define GCCC_ERROR_INTEGRITYLEVEL 0x20 | 18 #define GCCC_ERROR_INTEGRITYLEVEL 0x20 |
19 | 19 |
| 20 // Error conditions for CanReactivateChrome(). |
| 21 #define REACTIVATE_ERROR_NOTINSTALLED 0x01 |
| 22 #define REACTIVATE_ERROR_NOTDORMANT 0x02 |
| 23 #define REACTIVATE_ERROR_ALREADY_REACTIVATED 0x04 |
| 24 #define REACTIVATE_ERROR_INVALID_INPUT 0x08 |
| 25 #define REACTIVATE_ERROR_REACTIVATION_FAILED 0x10 |
| 26 |
| 27 // The minimum number of days an installation can be dormant before reactivation |
| 28 // may be offered. |
| 29 const int kReactivationMinDaysDormant = 50; |
| 30 |
20 // This function returns TRUE if Google Chrome should be offered. | 31 // This function returns TRUE if Google Chrome should be offered. |
21 // If the return is FALSE, the reasons DWORD explains why. If you don't care | 32 // If the return is FALSE, the reasons DWORD explains why. If you don't care |
22 // for the reason, you can pass NULL for reasons. | 33 // for the reason, you can pass NULL for reasons. |
23 // set_flag indicates whether a flag should be set indicating that Chrome was | 34 // set_flag indicates whether a flag should be set indicating that Chrome was |
24 // offered within the last six months; if passed FALSE, this method will not | 35 // offered within the last six months; if passed FALSE, this method will not |
25 // set the flag even if Chrome can be offered. If passed TRUE, this method | 36 // set the flag even if Chrome can be offered. If passed TRUE, this method |
26 // will set the flag only if Chrome can be offered. | 37 // will set the flag only if Chrome can be offered. |
27 BOOL __stdcall GoogleChromeCompatibilityCheck(BOOL set_flag, DWORD* reasons); | 38 BOOL __stdcall GoogleChromeCompatibilityCheck(BOOL set_flag, DWORD* reasons); |
28 | 39 |
29 // This function launches Google Chrome after a successful install. Make | 40 // This function launches Google Chrome after a successful install. Make |
(...skipping 17 matching lines...) Expand all Loading... |
47 | 58 |
48 // This function returns the number of days since Google Chrome was last run by | 59 // This function returns the number of days since Google Chrome was last run by |
49 // the current user. If both user-level and machine-wide installations are | 60 // the current user. If both user-level and machine-wide installations are |
50 // present on the system, it will return the lowest last-run-days count of | 61 // present on the system, it will return the lowest last-run-days count of |
51 // the two. | 62 // the two. |
52 // Returns -1 if Chrome is not installed, the last run date is in the future, | 63 // Returns -1 if Chrome is not installed, the last run date is in the future, |
53 // or we are otherwise unable to determine how long since Chrome was last | 64 // or we are otherwise unable to determine how long since Chrome was last |
54 // launched. | 65 // launched. |
55 int __stdcall GoogleChromeDaysSinceLastRun(); | 66 int __stdcall GoogleChromeDaysSinceLastRun(); |
56 | 67 |
57 // Funtion pointer type declarations to use with GetProcAddress. | 68 // Returns true if a vendor with the specified |brand_code| may offer |
| 69 // reactivation at this time. If the vendor has previously used other brand |
| 70 // codes, they must pass them in an array of size |previous_brand_codes_length| |
| 71 // as |previous_brand_codes|. Returns false if the vendor may not offer |
| 72 // reactivation at this time, and places one of the REACTIVATE_ERROR_XXX values |
| 73 // in |error_code| if |error_code| is non-null. |
| 74 BOOL __stdcall CanOfferReactivation(const wchar_t* brand_code, |
| 75 int previous_brand_codes_length, |
| 76 const wchar_t** previous_brand_codes, |
| 77 DWORD* error_code); |
| 78 |
| 79 // Attempts to reactivate Chrome for the specified |brand_code|. If the vendor |
| 80 // has previously used other brand codes, they must pass them in an array of |
| 81 // size |previous_brand_codes_length| as |previous_brand_codes|. Returns false |
| 82 // if reactivation fails, and places one of the REACTIVATE_ERROR_XXX values |
| 83 // in |error_code| if |error_code| is non-null. |
| 84 BOOL __stdcall ReactivateChrome(wchar_t* brand_code, |
| 85 int previous_brand_codes_length, |
| 86 const wchar_t** previous_brand_codes, |
| 87 DWORD* error_code); |
| 88 |
| 89 // Function pointer type declarations to use with GetProcAddress. |
58 typedef BOOL (__stdcall *GCCC_CompatibilityCheck)(BOOL, DWORD *); | 90 typedef BOOL (__stdcall *GCCC_CompatibilityCheck)(BOOL, DWORD *); |
59 typedef BOOL (__stdcall *GCCC_LaunchGC)(HANDLE *); | 91 typedef BOOL (__stdcall *GCCC_LaunchGC)(HANDLE *); |
60 typedef BOOL (__stdcall *GCCC_LaunchGCWithDimensions)(int, int, int, int); | 92 typedef BOOL (__stdcall *GCCC_LaunchGCWithDimensions)(int, int, int, int); |
61 typedef int (__stdcall *GCCC_GoogleChromeDaysSinceLastRun)(); | 93 typedef int (__stdcall *GCCC_GoogleChromeDaysSinceLastRun)(); |
| 94 typedef BOOL (__stdcall *GCCC_CanOfferReactivation)(const wchar_t*, |
| 95 int, |
| 96 const wchar_t**, |
| 97 DWORD*); |
| 98 typedef BOOL (__stdcall *GCCC_ReactivateChrome)(const wchar_t*, |
| 99 int, |
| 100 const wchar_t**, |
| 101 DWORD*); |
| 102 |
62 } // extern "C" | 103 } // extern "C" |
63 | 104 |
64 #endif // CHROME_INSTALLER_GCAPI_GCAPI_H_ | 105 #endif // CHROME_INSTALLER_GCAPI_GCAPI_H_ |
OLD | NEW |