OLD | NEW |
(Empty) | |
| 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 |
| 5 #ifndef COMPONENTS_OMAHA_QUERY_PARAMS_OMAHA_QUERY_PARAMS_H_ |
| 6 #define COMPONENTS_OMAHA_QUERY_PARAMS_OMAHA_QUERY_PARAMS_H_ |
| 7 |
| 8 #include <string> |
| 9 |
| 10 #include "base/basictypes.h" |
| 11 |
| 12 // Generates a string of URL query parameters to be used when getting |
| 13 // component and extension updates. These parameters generally remain |
| 14 // fixed for a particular build. Embedders can use the delegate to |
| 15 // define different implementations. This should be used only in the |
| 16 // browser process. |
| 17 class OmahaQueryParams { |
| 18 public: |
| 19 enum ProdId { |
| 20 CHROME = 0, |
| 21 CRX, |
| 22 }; |
| 23 |
| 24 // Generates a string of URL query parameters for Omaha. Includes the |
| 25 // following fields: os, arch, prod, prodchannel, prodversion, lang. |
| 26 static std::string Get(ProdId prod); |
| 27 |
| 28 // Returns the value we use for the "prod=" parameter. Possible return values |
| 29 // include "chrome", "chromecrx", "chromiumcrx", and "unknown". |
| 30 static const char* GetProdIdString(ProdId prod); |
| 31 |
| 32 // Returns the value we use for the "os=" parameter. Possible return values |
| 33 // include: "mac", "win", "android", "cros", "linux", and "openbsd". |
| 34 static const char* GetOS(); |
| 35 |
| 36 // Returns the value we use for the "arch=" parameter. Possible return values |
| 37 // include: "x86", "x64", and "arm". |
| 38 static const char* GetArch(); |
| 39 |
| 40 // Returns the value we use for the "nacl_arch" parameter. Note that this may |
| 41 // be different from the "arch" parameter above (e.g. one may be 32-bit and |
| 42 // the other 64-bit). Possible return values include: "x86-32", "x86-64", |
| 43 // "arm", and "mips32". |
| 44 static const char* GetNaclArch(); |
| 45 |
| 46 private: |
| 47 DISALLOW_IMPLICIT_CONSTRUCTORS(OmahaQueryParams); |
| 48 }; |
| 49 |
| 50 // Embedders can specify an OmahaQueryParamsDelegate to provide additional |
| 51 // custom parameters. If not specified (Set is never called), no additional |
| 52 // parameters are added. |
| 53 class OmahaQueryParamsDelegate { |
| 54 public: |
| 55 OmahaQueryParamsDelegate(); |
| 56 virtual ~OmahaQueryParamsDelegate(); |
| 57 |
| 58 // Use this delegate. |
| 59 static void Set(OmahaQueryParamsDelegate* delegate); |
| 60 |
| 61 // Returns additional parameters, if any. If there are any parameters, the |
| 62 // string should begin with a & character. |
| 63 virtual std::string GetExtraParams() = 0; |
| 64 |
| 65 DISALLOW_COPY_AND_ASSIGN(OmahaQueryParamsDelegate); |
| 66 }; |
| 67 |
| 68 #endif // COMPONENTS_OMAHA_QUERY_PARAMS_OMAHA_QUERY_PARAMS_H_ |
OLD | NEW |