[email protected] | 8f4b69e | 2014-06-26 00:01:31 | [diff] [blame] | 1 | // Copyright 2014 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. |
| 4 | |
sorin | 39eab2f | 2015-01-06 01:09:08 | [diff] [blame] | 5 | #ifndef COMPONENTS_UPDATE_CLIENT_UPDATE_QUERY_PARAMS_H_ |
| 6 | #define COMPONENTS_UPDATE_CLIENT_UPDATE_QUERY_PARAMS_H_ |
[email protected] | 8f4b69e | 2014-06-26 00:01:31 | [diff] [blame] | 7 | |
| 8 | #include <string> |
| 9 | |
avi | 5dd91f8 | 2015-12-25 22:30:46 | [diff] [blame] | 10 | #include "base/macros.h" |
[email protected] | 8f4b69e | 2014-06-26 00:01:31 | [diff] [blame] | 11 | |
sorin | 39eab2f | 2015-01-06 01:09:08 | [diff] [blame] | 12 | namespace update_client { |
[email protected] | 8f4b69e | 2014-06-26 00:01:31 | [diff] [blame] | 13 | |
sorin | 39eab2f | 2015-01-06 01:09:08 | [diff] [blame] | 14 | class UpdateQueryParamsDelegate; |
[email protected] | 8f4b69e | 2014-06-26 00:01:31 | [diff] [blame] | 15 | |
| 16 | // Generates a string of URL query parameters to be used when getting |
| 17 | // component and extension updates. These parameters generally remain |
| 18 | // fixed for a particular build. Embedders can use the delegate to |
| 19 | // define different implementations. This should be used only in the |
| 20 | // browser process. |
sorin | 39eab2f | 2015-01-06 01:09:08 | [diff] [blame] | 21 | class UpdateQueryParams { |
[email protected] | 8f4b69e | 2014-06-26 00:01:31 | [diff] [blame] | 22 | public: |
| 23 | enum ProdId { |
| 24 | CHROME = 0, |
| 25 | CRX, |
| 26 | }; |
| 27 | |
| 28 | // Generates a string of URL query parameters for Omaha. Includes the |
[email protected] | a97fa55 | 2014-07-10 03:45:45 | [diff] [blame] | 29 | // following fields: "os", "arch", "nacl_arch", "prod", "prodchannel", |
| 30 | // "prodversion", and "lang" |
[email protected] | 8f4b69e | 2014-06-26 00:01:31 | [diff] [blame] | 31 | static std::string Get(ProdId prod); |
| 32 | |
| 33 | // Returns the value we use for the "prod=" parameter. Possible return values |
| 34 | // include "chrome", "chromecrx", "chromiumcrx", and "unknown". |
| 35 | static const char* GetProdIdString(ProdId prod); |
| 36 | |
| 37 | // Returns the value we use for the "os=" parameter. Possible return values |
| 38 | // include: "mac", "win", "android", "cros", "linux", and "openbsd". |
| 39 | static const char* GetOS(); |
| 40 | |
| 41 | // Returns the value we use for the "arch=" parameter. Possible return values |
| 42 | // include: "x86", "x64", and "arm". |
| 43 | static const char* GetArch(); |
| 44 | |
| 45 | // Returns the value we use for the "nacl_arch" parameter. Note that this may |
| 46 | // be different from the "arch" parameter above (e.g. one may be 32-bit and |
| 47 | // the other 64-bit). Possible return values include: "x86-32", "x86-64", |
Shawn Anastasio | 0daeebc | 2019-03-20 22:31:41 | [diff] [blame] | 48 | // "arm", "mips32", and "ppc64". |
[email protected] | 8f4b69e | 2014-06-26 00:01:31 | [diff] [blame] | 49 | static const char* GetNaclArch(); |
| 50 | |
mxnguyen | b7647619 | 2017-04-03 17:54:14 | [diff] [blame] | 51 | // Returns the current version of Chrome/Chromium. |
| 52 | static std::string GetProdVersion(); |
| 53 | |
[email protected] | 8f4b69e | 2014-06-26 00:01:31 | [diff] [blame] | 54 | // Use this delegate. |
sorin | 39eab2f | 2015-01-06 01:09:08 | [diff] [blame] | 55 | static void SetDelegate(UpdateQueryParamsDelegate* delegate); |
[email protected] | 8f4b69e | 2014-06-26 00:01:31 | [diff] [blame] | 56 | |
| 57 | private: |
sorin | 39eab2f | 2015-01-06 01:09:08 | [diff] [blame] | 58 | DISALLOW_IMPLICIT_CONSTRUCTORS(UpdateQueryParams); |
[email protected] | 8f4b69e | 2014-06-26 00:01:31 | [diff] [blame] | 59 | }; |
| 60 | |
sorin | 39eab2f | 2015-01-06 01:09:08 | [diff] [blame] | 61 | } // namespace update_client |
[email protected] | 8f4b69e | 2014-06-26 00:01:31 | [diff] [blame] | 62 | |
sorin | 39eab2f | 2015-01-06 01:09:08 | [diff] [blame] | 63 | #endif // COMPONENTS_UPDATE_CLIENT_UPDATE_QUERY_PARAMS_H_ |