update_query_params.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. #ifndef COMPONENTS_UPDATE_CLIENT_UPDATE_QUERY_PARAMS_H_
  5. #define COMPONENTS_UPDATE_CLIENT_UPDATE_QUERY_PARAMS_H_
  6. #include <string>
  7. namespace update_client {
  8. class UpdateQueryParamsDelegate;
  9. // Generates a string of URL query parameters to be used when getting
  10. // component and extension updates. These parameters generally remain
  11. // fixed for a particular build. Embedders can use the delegate to
  12. // define different implementations. This should be used only in the
  13. // browser process.
  14. class UpdateQueryParams {
  15. public:
  16. enum ProdId { CHROME = 0, CRX, WEBVIEW };
  17. UpdateQueryParams() = delete;
  18. UpdateQueryParams(const UpdateQueryParams&) = delete;
  19. UpdateQueryParams& operator=(const UpdateQueryParams&) = delete;
  20. // Generates a string of URL query parameters for Omaha. Includes the
  21. // following fields: "os", "arch", "nacl_arch", "prod", "prodchannel",
  22. // "prodversion", and "lang"
  23. static std::string Get(ProdId prod);
  24. // Returns the value we use for the "prod=" parameter. Possible return values
  25. // include "chrome", "chromecrx", "chromiumcrx", and "unknown".
  26. static const char* GetProdIdString(ProdId prod);
  27. // Returns the value we use for the "os=" parameter. Possible return values
  28. // include: "mac", "win", "android", "cros", "linux", and "openbsd".
  29. static const char* GetOS();
  30. // Returns the value we use for the "arch=" parameter. Possible return values
  31. // include: "x86", "x64", and "arm".
  32. static const char* GetArch();
  33. // Returns the value we use for the "nacl_arch" parameter. Note that this may
  34. // be different from the "arch" parameter above (e.g. one may be 32-bit and
  35. // the other 64-bit). Possible return values include: "x86-32", "x86-64",
  36. // "arm", "mips32", and "ppc64".
  37. static const char* GetNaclArch();
  38. // Returns the current version of Chrome/Chromium.
  39. static std::string GetProdVersion();
  40. // Use this delegate.
  41. static void SetDelegate(UpdateQueryParamsDelegate* delegate);
  42. };
  43. } // namespace update_client
  44. #endif // COMPONENTS_UPDATE_CLIENT_UPDATE_QUERY_PARAMS_H_