Revert of clang/win: Fix a few warnings in targets not in chromium_builder_tests...
[chromium-blink-merge.git] / chrome / installer / gcapi / gcapi.h
bloba35293e3d5b8311a25f7fc9ba13e7b256bbb9bd0
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
3 // found in the LICENSE file.
5 #ifndef CHROME_INSTALLER_GCAPI_GCAPI_H_
6 #define CHROME_INSTALLER_GCAPI_GCAPI_H_
8 #include <windows.h>
10 // Error conditions for GoogleChromeCompatibilityCheck().
11 #define GCCC_ERROR_USERLEVELALREADYPRESENT (1 << 0)
12 #define GCCC_ERROR_SYSTEMLEVELALREADYPRESENT (1 << 1)
13 #define GCCC_ERROR_ACCESSDENIED (1 << 2)
14 #define GCCC_ERROR_OSNOTSUPPORTED (1 << 3)
15 #define GCCC_ERROR_ALREADYOFFERED (1 << 4)
16 #define GCCC_ERROR_INTEGRITYLEVEL (1 << 5)
18 // Error conditions for CanReactivateChrome().
19 #define REACTIVATE_ERROR_NOTINSTALLED (1 << 0)
20 #define REACTIVATE_ERROR_NOTDORMANT (1 << 1)
21 #define REACTIVATE_ERROR_ALREADY_REACTIVATED (1 << 2)
22 #define REACTIVATE_ERROR_INVALID_INPUT (1 << 3)
23 #define REACTIVATE_ERROR_REACTIVATION_FAILED (1 << 4)
25 // Error conditions for CanOfferRelaunch().
26 #define RELAUNCH_ERROR_NOTINSTALLED (1 << 0)
27 #define RELAUNCH_ERROR_INVALID_PARTNER (1 << 1)
28 #define RELAUNCH_ERROR_PINGS_SENT (1 << 2)
29 #define RELAUNCH_ERROR_NOTDORMANT (1 << 3)
30 #define RELAUNCH_ERROR_ALREADY_RELAUNCHED (1 << 4)
31 #define RELAUNCH_ERROR_INVALID_INPUT (1 << 5)
32 #define RELAUNCH_ERROR_RELAUNCH_FAILED (1 << 6)
34 // Flags to indicate how GCAPI is invoked
35 #define GCAPI_INVOKED_STANDARD_SHELL (1 << 0)
36 #define GCAPI_INVOKED_UAC_ELEVATION (1 << 1)
38 #ifdef __cplusplus
39 extern "C" {
40 #endif
42 // The minimum number of days an installation can be dormant before reactivation
43 // may be offered.
44 const int kReactivationMinDaysDormant = 50;
46 // The minimum number of days an installation can be dormant before a relaunch
47 // may be offered.
48 const int kRelaunchMinDaysDormant = 30;
50 // This function returns TRUE if Google Chrome should be offered.
51 // If the return is FALSE, the |reasons| DWORD explains why. If you don't care
52 // for the reason, you can pass NULL for |reasons|.
53 // |set_flag| indicates whether a flag should be set indicating that Chrome was
54 // offered within the last six months; if passed FALSE, this method will not
55 // set the flag even if Chrome can be offered. If passed TRUE, this method
56 // will set the flag only if Chrome can be offered.
57 // |shell_mode| should be set to one of GCAPI_INVOKED_STANDARD_SHELL or
58 // GCAPI_INVOKED_UAC_ELEVATION depending on whether this method is invoked
59 // from an elevated or non-elevated process.
60 BOOL __stdcall GoogleChromeCompatibilityCheck(BOOL set_flag,
61 int shell_mode,
62 DWORD* reasons);
64 // This function launches Google Chrome after a successful install. Make
65 // sure COM library is NOT initialized before you call this function (so if
66 // you called CoInitialize, call CoUninitialize before calling this function).
67 BOOL __stdcall LaunchGoogleChrome();
69 // This function launches Google Chrome after a successful install, ensuring
70 // that any windows that it makes are shunted to the background. Make sure COM
71 // library is NOT initialized before you call this function (so if you called
72 // CoInitialize, call CoUninitialize before calling this function).
73 BOOL __stdcall LaunchGoogleChromeInBackground();
75 // This function launches Google Chrome after a successful install at the given
76 // x,y coordinates with size height,length. Pass -1 for x and y to avoid moving
77 // the window. Pass -1 for width and height to avoid resizing the window. Set
78 // in_background to true to move Google Chrome behind all other windows or false
79 // to have it appear at the default z-order. Make sure that COM is NOT
80 // initialized before you call this function (so if you called CoInitialize,
81 // call CoUninitialize before calling this function). This call is synchronous,
82 // meaning it waits for Chrome to launch and appear to resize it before
83 // returning.
84 BOOL __stdcall LaunchGoogleChromeWithDimensions(int x,
85 int y,
86 int width,
87 int height,
88 bool in_background);
90 // This function returns the number of days since Google Chrome was last run by
91 // the current user. If both user-level and machine-wide installations are
92 // present on the system, it will return the lowest last-run-days count of
93 // the two.
94 // Returns -1 if Chrome is not installed, the last run date is in the future,
95 // or we are otherwise unable to determine how long since Chrome was last
96 // launched.
97 int __stdcall GoogleChromeDaysSinceLastRun();
99 // Returns true if a vendor with the specified |brand_code| may offer
100 // reactivation at this time. Returns false if the vendor may not offer
101 // reactivation at this time, and places one of the REACTIVATE_ERROR_XXX values
102 // in |error_code| if |error_code| is non-null.
103 // |shell_mode| should be set to one of GCAPI_INVOKED_STANDARD_SHELL or
104 // GCAPI_INVOKED_UAC_ELEVATION depending on whether this method is invoked
105 // from an elevated or non-elevated process.
106 BOOL __stdcall CanOfferReactivation(const wchar_t* brand_code,
107 int shell_mode,
108 DWORD* error_code);
110 // Attempts to reactivate Chrome for the specified |brand_code|. Returns false
111 // if reactivation fails, and places one of the REACTIVATE_ERROR_XXX values
112 // in |error_code| if |error_code| is non-null.
113 // |shell_mode| should be set to one of GCAPI_INVOKED_STANDARD_SHELL or
114 // GCAPI_INVOKED_UAC_ELEVATION depending on whether this method is invoked
115 // from an elevated or non-elevated process.
116 BOOL __stdcall ReactivateChrome(wchar_t* brand_code,
117 int shell_mode,
118 DWORD* error_code);
120 // Returns true if a vendor may offer relaunch at this time. Returns false if
121 // the vendor may not offer relaunching at this time, and places one of the
122 // RELAUNCH_ERROR_XXX values in |error_code| if |error_code| is non-null. The
123 // installed brandcode must be in |partner_brandcode_list|. |shell_mode| should
124 // be set to one of GCAPI_INVOKED_STANDARD_SHELL or GCAPI_INVOKED_UAC_ELEVATION
125 // depending on whether this method is invoked from an elevated or non-elevated
126 // process.
127 BOOL __stdcall CanOfferRelaunch(const wchar_t** partner_brandcode_list,
128 int partner_brandcode_list_length,
129 int shell_mode,
130 DWORD* error_code);
132 // Returns true if a vendor may relaunch at this time (and stores that a
133 // relaunch was offered). Returns false if the vendor may not relaunch
134 // at this time, and places one of the RELAUNCH_ERROR_XXX values in |error_code|
135 // if |error_code| is non-null. As for |CanOfferRelaunch|, the installed
136 // brandcode must be in |partner_brandcode_list|. |shell_mode| should be set to
137 // one of GCAPI_INVOKED_STANDARD_SHELL or GCAPI_INVOKED_UAC_ELEVATION depending
138 // on whether this method is invoked from an elevated or non-elevated process.
139 // The |relaunch_brandcode| will be stored as the brandcode that was used for
140 // offering this relaunch.
141 BOOL __stdcall SetRelaunchOffered(const wchar_t** partner_brandcode_list,
142 int partner_brandcode_list_length,
143 const wchar_t* relaunch_brandcode,
144 int shell_mode,
145 DWORD* error_code);
147 // Function pointer type declarations to use with GetProcAddress.
148 typedef BOOL (__stdcall *GCCC_CompatibilityCheck)(BOOL, int, DWORD *);
149 typedef BOOL (__stdcall *GCCC_LaunchGC)();
150 typedef BOOL (__stdcall *GCCC_LaunchGoogleChromeInBackground)();
151 typedef BOOL (__stdcall *GCCC_LaunchGCWithDimensions)(int, int, int, int, bool);
152 typedef int (__stdcall *GCCC_GoogleChromeDaysSinceLastRun)();
153 typedef BOOL (__stdcall *GCCC_CanOfferReactivation)(const wchar_t*,
154 int,
155 DWORD*);
156 typedef BOOL (__stdcall *GCCC_ReactivateChrome)(const wchar_t*,
157 int,
158 DWORD*);
159 typedef BOOL (__stdcall *GCCC_CanOfferRelaunch)(const wchar_t**,
160 int,
161 int,
162 DWORD*);
163 typedef BOOL (__stdcall *GCCC_SetRelaunchOffered)(const wchar_t**,
164 int,
165 const wchar_t*,
166 int,
167 DWORD*);
169 #ifdef __cplusplus
170 } // extern "C"
171 #endif
173 #endif // CHROME_INSTALLER_GCAPI_GCAPI_H_