OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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_BROWSER_OMAHA_QUERY_PARAMS_OMAHA_QUERY_PARAMS_H_ | 5 #ifndef COMPONENTS_OMAHA_QUERY_PARAMS_OMAHA_QUERY_PARAMS_H_ |
6 #define CHROME_BROWSER_OMAHA_QUERY_PARAMS_OMAHA_QUERY_PARAMS_H_ | 6 #define COMPONENTS_OMAHA_QUERY_PARAMS_OMAHA_QUERY_PARAMS_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 | 11 |
12 namespace chrome { | 12 namespace omaha_query_params { |
13 | 13 |
| 14 class OmahaQueryParamsDelegate; |
| 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. |
14 class OmahaQueryParams { | 21 class OmahaQueryParams { |
15 public: | 22 public: |
16 enum ProdId { | 23 enum ProdId { |
17 CHROME = 0, | 24 CHROME = 0, |
18 CRX, | 25 CRX, |
19 }; | 26 }; |
20 | 27 |
21 // Generates a string of URL query paramaters to be used when getting | 28 // Generates a string of URL query parameters for Omaha. Includes the |
22 // component and extension updates. Includes the following fields: os, arch, | 29 // following fields: os, arch, prod, prodchannel, prodversion, lang. |
23 // prod, prodchannel, prodversion, lang. | |
24 static std::string Get(ProdId prod); | 30 static std::string Get(ProdId prod); |
25 | 31 |
26 // Returns the value we use for the "prod=" parameter. Possible return values | 32 // Returns the value we use for the "prod=" parameter. Possible return values |
27 // include "chrome", "chromecrx", "chromiumcrx", and "unknown". | 33 // include "chrome", "chromecrx", "chromiumcrx", and "unknown". |
28 static const char* GetProdIdString(chrome::OmahaQueryParams::ProdId prod); | 34 static const char* GetProdIdString(ProdId prod); |
29 | 35 |
30 // Returns the value we use for the "os=" parameter. Possible return values | 36 // Returns the value we use for the "os=" parameter. Possible return values |
31 // include: "mac", "win", "android", "cros", "linux", and "openbsd". | 37 // include: "mac", "win", "android", "cros", "linux", and "openbsd". |
32 static const char* GetOS(); | 38 static const char* GetOS(); |
33 | 39 |
34 // Returns the value we use for the "arch=" parameter. Possible return values | 40 // Returns the value we use for the "arch=" parameter. Possible return values |
35 // include: "x86", "x64", and "arm". | 41 // include: "x86", "x64", and "arm". |
36 static const char* GetArch(); | 42 static const char* GetArch(); |
37 | 43 |
38 // Returns the value we use for the "nacl_arch" parameter. Note that this may | 44 // Returns the value we use for the "nacl_arch" parameter. Note that this may |
39 // be different from the "arch" parameter above (e.g. one may be 32-bit and | 45 // be different from the "arch" parameter above (e.g. one may be 32-bit and |
40 // the other 64-bit). Possible return values include: "x86-32", "x86-64", | 46 // the other 64-bit). Possible return values include: "x86-32", "x86-64", |
41 // "arm", and "mips32". | 47 // "arm", and "mips32". |
42 static const char* GetNaclArch(); | 48 static const char* GetNaclArch(); |
43 | 49 |
44 // Returns the value we use for the "updaterchannel=" and "prodchannel=" | 50 // Use this delegate. |
45 // parameters. Possible return values include: "canary", "dev", "beta", and | 51 static void SetDelegate(OmahaQueryParamsDelegate* delegate); |
46 // "stable". | |
47 static const char* GetChannelString(); | |
48 | |
49 // Returns the language for the present locale. Possible return values are | |
50 // standard tags for languages, such as "en", "en-US", "de", "fr", "af", etc. | |
51 static const char* GetLang(); | |
52 | 52 |
53 private: | 53 private: |
54 DISALLOW_IMPLICIT_CONSTRUCTORS(OmahaQueryParams); | 54 DISALLOW_IMPLICIT_CONSTRUCTORS(OmahaQueryParams); |
55 }; | 55 }; |
56 | 56 |
57 } // namespace chrome | 57 } // namespace omaha_query_params |
58 | 58 |
59 #endif // CHROME_BROWSER_OMAHA_QUERY_PARAMS_OMAHA_QUERY_PARAMS_H_ | 59 #endif // COMPONENTS_OMAHA_QUERY_PARAMS_OMAHA_QUERY_PARAMS_H_ |
OLD | NEW |