| OLD | NEW |
| 1 // Copyright (c) 2012 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(). | 20 // Error conditions for CanReactivateChrome(). |
| 21 #define REACTIVATE_ERROR_NOTINSTALLED 0x01 | 21 #define REACTIVATE_ERROR_NOTINSTALLED 0x01 |
| 22 #define REACTIVATE_ERROR_NOTDORMANT 0x02 | 22 #define REACTIVATE_ERROR_NOTDORMANT 0x02 |
| 23 #define REACTIVATE_ERROR_ALREADY_REACTIVATED 0x04 | 23 #define REACTIVATE_ERROR_ALREADY_REACTIVATED 0x04 |
| 24 #define REACTIVATE_ERROR_INVALID_INPUT 0x08 | 24 #define REACTIVATE_ERROR_INVALID_INPUT 0x08 |
| 25 #define REACTIVATE_ERROR_REACTIVATION_FAILED 0x10 | 25 #define REACTIVATE_ERROR_REACTIVATION_FAILED 0x10 |
| 26 | 26 |
| 27 // Flags to indicate how GCAPI is invoked |
| 28 #define GCAPI_INVOKED_STANDARD_SHELL 0x01 |
| 29 #define GCAPI_INVOKED_UAC_ELEVATION 0x02 |
| 30 |
| 27 // The minimum number of days an installation can be dormant before reactivation | 31 // The minimum number of days an installation can be dormant before reactivation |
| 28 // may be offered. | 32 // may be offered. |
| 29 const int kReactivationMinDaysDormant = 50; | 33 const int kReactivationMinDaysDormant = 50; |
| 30 | 34 |
| 31 // This function returns TRUE if Google Chrome should be offered. | 35 // This function returns TRUE if Google Chrome should be offered. |
| 32 // If the return is FALSE, the reasons DWORD explains why. If you don't care | 36 // If the return is FALSE, the |reasons| DWORD explains why. If you don't care |
| 33 // for the reason, you can pass NULL for reasons. | 37 // for the reason, you can pass NULL for |reasons|. |
| 34 // set_flag indicates whether a flag should be set indicating that Chrome was | 38 // |set_flag| indicates whether a flag should be set indicating that Chrome was |
| 35 // offered within the last six months; if passed FALSE, this method will not | 39 // offered within the last six months; if passed FALSE, this method will not |
| 36 // set the flag even if Chrome can be offered. If passed TRUE, this method | 40 // set the flag even if Chrome can be offered. If passed TRUE, this method |
| 37 // will set the flag only if Chrome can be offered. | 41 // will set the flag only if Chrome can be offered. |
| 38 BOOL __stdcall GoogleChromeCompatibilityCheck(BOOL set_flag, DWORD* reasons); | 42 // |shell_mode| should be set to one of GCAPI_INVOKED_STANDARD_SHELL or |
| 43 // GCAPI_INVOKED_UAC_ELEVATION depending on whether this method is invoked |
| 44 // from an elevated or non-elevated process. |
| 45 BOOL __stdcall GoogleChromeCompatibilityCheck(BOOL set_flag, |
| 46 int shell_mode, |
| 47 DWORD* reasons); |
| 39 | 48 |
| 40 // This function launches Google Chrome after a successful install. Make | 49 // This function launches Google Chrome after a successful install. Make |
| 41 // sure COM library is NOT initialized before you call this function (so if | 50 // sure COM library is NOT initialized before you call this function (so if |
| 42 // you called CoInitialize, call CoUninitialize before calling this function). | 51 // you called CoInitialize, call CoUninitialize before calling this function). |
| 43 BOOL __stdcall LaunchGoogleChrome(); | 52 BOOL __stdcall LaunchGoogleChrome(); |
| 44 | 53 |
| 45 // This function launches Google Chrome after a successful install at the | 54 // This function launches Google Chrome after a successful install at the |
| 46 // given x,y coordinates with size height,length. Set in_background to true | 55 // given x,y coordinates with size height,length. Set in_background to true |
| 47 // to move Google Chrome behind all other windows or false to have it appear | 56 // to move Google Chrome behind all other windows or false to have it appear |
| 48 // at the default z-order. Make sure that COM is NOT initialized before you call | 57 // at the default z-order. Make sure that COM is NOT initialized before you call |
| (...skipping 15 matching lines...) Expand all Loading... |
| 64 // or we are otherwise unable to determine how long since Chrome was last | 73 // or we are otherwise unable to determine how long since Chrome was last |
| 65 // launched. | 74 // launched. |
| 66 int __stdcall GoogleChromeDaysSinceLastRun(); | 75 int __stdcall GoogleChromeDaysSinceLastRun(); |
| 67 | 76 |
| 68 // Returns true if a vendor with the specified |brand_code| may offer | 77 // 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 | 78 // 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| | 79 // 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 | 80 // 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 | 81 // reactivation at this time, and places one of the REACTIVATE_ERROR_XXX values |
| 73 // in |error_code| if |error_code| is non-null. | 82 // in |error_code| if |error_code| is non-null. |
| 83 // |shell_mode| should be set to one of GCAPI_INVOKED_STANDARD_SHELL or |
| 84 // GCAPI_INVOKED_UAC_ELEVATION depending on whether this method is invoked |
| 85 // from an elevated or non-elevated process. |
| 74 BOOL __stdcall CanOfferReactivation(const wchar_t* brand_code, | 86 BOOL __stdcall CanOfferReactivation(const wchar_t* brand_code, |
| 75 int previous_brand_codes_length, | 87 int previous_brand_codes_length, |
| 76 const wchar_t** previous_brand_codes, | 88 const wchar_t** previous_brand_codes, |
| 89 int shell_mode, |
| 77 DWORD* error_code); | 90 DWORD* error_code); |
| 78 | 91 |
| 79 // Attempts to reactivate Chrome for the specified |brand_code|. If the vendor | 92 // 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 | 93 // 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 | 94 // size |previous_brand_codes_length| as |previous_brand_codes|. Returns false |
| 82 // if reactivation fails, and places one of the REACTIVATE_ERROR_XXX values | 95 // if reactivation fails, and places one of the REACTIVATE_ERROR_XXX values |
| 83 // in |error_code| if |error_code| is non-null. | 96 // in |error_code| if |error_code| is non-null. |
| 97 // |shell_mode| should be set to one of GCAPI_INVOKED_STANDARD_SHELL or |
| 98 // GCAPI_INVOKED_UAC_ELEVATION depending on whether this method is invoked |
| 99 // from an elevated or non-elevated process. |
| 84 BOOL __stdcall ReactivateChrome(wchar_t* brand_code, | 100 BOOL __stdcall ReactivateChrome(wchar_t* brand_code, |
| 85 int previous_brand_codes_length, | 101 int previous_brand_codes_length, |
| 86 const wchar_t** previous_brand_codes, | 102 const wchar_t** previous_brand_codes, |
| 103 int shell_mode, |
| 87 DWORD* error_code); | 104 DWORD* error_code); |
| 88 | 105 |
| 89 // Function pointer type declarations to use with GetProcAddress. | 106 // Function pointer type declarations to use with GetProcAddress. |
| 90 typedef BOOL (__stdcall *GCCC_CompatibilityCheck)(BOOL, DWORD *); | 107 typedef BOOL (__stdcall *GCCC_CompatibilityCheck)(BOOL, int, DWORD *); |
| 91 typedef BOOL (__stdcall *GCCC_LaunchGC)(HANDLE *); | 108 typedef BOOL (__stdcall *GCCC_LaunchGC)(HANDLE *); |
| 92 typedef BOOL (__stdcall *GCCC_LaunchGCWithDimensions)(int, int, int, int); | 109 typedef BOOL (__stdcall *GCCC_LaunchGCWithDimensions)(int, int, int, int); |
| 93 typedef int (__stdcall *GCCC_GoogleChromeDaysSinceLastRun)(); | 110 typedef int (__stdcall *GCCC_GoogleChromeDaysSinceLastRun)(); |
| 94 typedef BOOL (__stdcall *GCCC_CanOfferReactivation)(const wchar_t*, | 111 typedef BOOL (__stdcall *GCCC_CanOfferReactivation)(const wchar_t*, |
| 95 int, | 112 int, |
| 96 const wchar_t**, | 113 const wchar_t**, |
| 114 int, |
| 97 DWORD*); | 115 DWORD*); |
| 98 typedef BOOL (__stdcall *GCCC_ReactivateChrome)(const wchar_t*, | 116 typedef BOOL (__stdcall *GCCC_ReactivateChrome)(const wchar_t*, |
| 99 int, | 117 int, |
| 100 const wchar_t**, | 118 const wchar_t**, |
| 119 int, |
| 101 DWORD*); | 120 DWORD*); |
| 102 | 121 |
| 103 } // extern "C" | 122 } // extern "C" |
| 104 | 123 |
| 105 #endif // CHROME_INSTALLER_GCAPI_GCAPI_H_ | 124 #endif // CHROME_INSTALLER_GCAPI_GCAPI_H_ |
| OLD | NEW |