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 namespace omaha_query_params { 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. 21 class OmahaQueryParams { 22 public: 23 enum ProdId { 24 CHROME = 0, 25 CRX, 26 }; 27 28 // Generates a string of URL query parameters for Omaha. Includes the 29 // following fields: "os", "arch", "nacl_arch", "prod", "prodchannel", 30 // "prodversion", and "lang" 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", 48 // "arm", and "mips32". 49 static const char* GetNaclArch(); 50 51 // Use this delegate. 52 static void SetDelegate(OmahaQueryParamsDelegate* delegate); 53 54 private: 55 DISALLOW_IMPLICIT_CONSTRUCTORS(OmahaQueryParams); 56 }; 57 58 } // namespace omaha_query_params 59 60 #endif // COMPONENTS_OMAHA_QUERY_PARAMS_OMAHA_QUERY_PARAMS_H_ 61