variations_service_client.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. // Copyright 2015 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_VARIATIONS_SERVICE_VARIATIONS_SERVICE_CLIENT_H_
  5. #define COMPONENTS_VARIATIONS_SERVICE_VARIATIONS_SERVICE_CLIENT_H_
  6. #include <string>
  7. #include "base/memory/scoped_refptr.h"
  8. #include "base/version.h"
  9. #include "components/variations/proto/study.pb.h"
  10. #include "components/version_info/channel.h"
  11. #include "components/version_info/version_info.h"
  12. namespace network {
  13. class SharedURLLoaderFactory;
  14. }
  15. namespace network_time {
  16. class NetworkTimeTracker;
  17. }
  18. namespace variations {
  19. // An abstraction of operations that depend on the embedder's (e.g. Chrome)
  20. // environment.
  21. class VariationsServiceClient {
  22. public:
  23. virtual ~VariationsServiceClient() {}
  24. // Returns the version to use for variations seed simulation.
  25. virtual base::Version GetVersionForSimulation() = 0;
  26. virtual scoped_refptr<network::SharedURLLoaderFactory>
  27. GetURLLoaderFactory() = 0;
  28. virtual network_time::NetworkTimeTracker* GetNetworkTimeTracker() = 0;
  29. // Returns whether the embedder overrides the value of the restrict parameter.
  30. // |parameter| is an out-param that will contain the value of the restrict
  31. // parameter if true is returned.
  32. virtual bool OverridesRestrictParameter(std::string* parameter) = 0;
  33. // Gets the channel to use for variations. The --fake-variations-channel
  34. // override switch takes precedence over the embedder-provided channel.
  35. // If that switch is not set, it will return the embedder-provided channel,
  36. // (which could be UNKNOWN).
  37. version_info::Channel GetChannelForVariations();
  38. // Returns the current form factor of the device.
  39. virtual Study::FormFactor GetCurrentFormFactor();
  40. // Returns whether the client is enterprise.
  41. // TODO(manukh): crbug.com/1003025. This is inconsistent with UMA which
  42. // analyzes brand_code to determine if the client is an enterprise user:
  43. // - For android, linux, and iOS, they are consistent because both UMA and
  44. // chromium consider all such devices as non-enterprise.
  45. // - For mac and chromeOS, they are inconsistent because UMA does not consider
  46. // any such devices as enterprise, but chromium does.
  47. // - For windows, both consider some clients as enterprise, but use different
  48. // chromium doesn't use brand_code so they may have inconsistent results.
  49. // That being said, studies restricted by finch won't need to filter on UMA as
  50. // well. But this could be confusing and could prevent using UMA filters on a
  51. // non finch-filtered study to analyze the finch-filtered launch potential.
  52. virtual bool IsEnterprise() = 0;
  53. private:
  54. // Gets the channel of the embedder. But all variations callers should use
  55. // |GetChannelForVariations()| instead.
  56. virtual version_info::Channel GetChannel() = 0;
  57. };
  58. } // namespace variations
  59. #endif // COMPONENTS_VARIATIONS_SERVICE_VARIATIONS_SERVICE_CLIENT_H_