metrics_services_manager_client.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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_METRICS_SERVICES_MANAGER_METRICS_SERVICES_MANAGER_CLIENT_H_
  5. #define COMPONENTS_METRICS_SERVICES_MANAGER_METRICS_SERVICES_MANAGER_CLIENT_H_
  6. #include <memory>
  7. #include "base/memory/scoped_refptr.h"
  8. namespace metrics {
  9. class MetricsServiceClient;
  10. class MetricsStateManager;
  11. }
  12. namespace network {
  13. class SharedURLLoaderFactory;
  14. }
  15. namespace variations {
  16. class VariationsService;
  17. }
  18. namespace metrics_services_manager {
  19. // MetricsServicesManagerClient is an interface that allows
  20. // MetricsServicesManager to interact with its embedder.
  21. class MetricsServicesManagerClient {
  22. public:
  23. virtual ~MetricsServicesManagerClient() {}
  24. // Methods that create the various services in the context of the embedder.
  25. virtual std::unique_ptr<variations::VariationsService>
  26. CreateVariationsService() = 0;
  27. virtual std::unique_ptr<metrics::MetricsServiceClient>
  28. CreateMetricsServiceClient() = 0;
  29. // Gets the MetricsStateManager, creating it if it has not already been
  30. // created.
  31. virtual metrics::MetricsStateManager* GetMetricsStateManager() = 0;
  32. // Returns the URL loader factory which the metrics services should use.
  33. virtual scoped_refptr<network::SharedURLLoaderFactory>
  34. GetURLLoaderFactory() = 0;
  35. // Returns whether metrics reporting is enabled.
  36. virtual bool IsMetricsReportingEnabled() = 0;
  37. // Returns whether metrics consent is given.
  38. virtual bool IsMetricsConsentGiven() = 0;
  39. // Returns whether there are any OffTheRecord browsers/tabs open.
  40. virtual bool IsOffTheRecordSessionActive() = 0;
  41. // Update the running state of metrics services managed by the embedder, for
  42. // example, crash reporting.
  43. virtual void UpdateRunningServices(bool may_record, bool may_upload) {}
  44. };
  45. } // namespace metrics_services_manager
  46. #endif // COMPONENTS_METRICS_SERVICES_MANAGER_METRICS_SERVICES_MANAGER_CLIENT_H_