Updating trunk VERSION from 2139.0 to 2140.0
[chromium-blink-merge.git] / components / metrics / metrics_service_client.h
blobd8e2c15893ee5678d79d8e4ad05ab0400671b07a
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.
5 #ifndef COMPONENTS_METRICS_METRICS_SERVICE_CLIENT_H_
6 #define COMPONENTS_METRICS_METRICS_SERVICE_CLIENT_H_
8 #include <string>
10 #include "base/basictypes.h"
11 #include "base/callback_forward.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "components/metrics/proto/system_profile.pb.h"
15 namespace metrics {
17 class MetricsLogUploader;
19 // An abstraction of operations that depend on the embedder's (e.g. Chrome)
20 // environment.
21 class MetricsServiceClient {
22 public:
23 virtual ~MetricsServiceClient() {}
25 // Registers the client id with other services (e.g. crash reporting), called
26 // when metrics recording gets enabled.
27 virtual void SetMetricsClientId(const std::string& client_id) = 0;
29 // Whether there's an "off the record" (aka "Incognito") session active.
30 virtual bool IsOffTheRecordSessionActive() = 0;
32 // Returns the current application locale (e.g. "en-US").
33 virtual std::string GetApplicationLocale() = 0;
35 // Retrieves the brand code string associated with the install, returning
36 // false if no brand code is available.
37 virtual bool GetBrand(std::string* brand_code) = 0;
39 // Returns the release channel (e.g. stable, beta, etc) of the application.
40 virtual SystemProfileProto::Channel GetChannel() = 0;
42 // Returns the version of the application as a string.
43 virtual std::string GetVersionString() = 0;
45 // Called by the metrics service when a log has been uploaded.
46 virtual void OnLogUploadComplete() = 0;
48 // Starts gathering metrics, calling |done_callback| when initial metrics
49 // gathering is complete.
50 virtual void StartGatheringMetrics(const base::Closure& done_callback) = 0;
52 // Called prior to a metrics log being closed, allowing the client to collect
53 // extra histograms that will go in that log. Asynchronous API - the client
54 // implementation should call |done_callback| when complete.
55 virtual void CollectFinalMetrics(const base::Closure& done_callback) = 0;
57 // Creates a MetricsLogUploader with the specified parameters (see comments on
58 // MetricsLogUploader for details).
59 virtual scoped_ptr<MetricsLogUploader> CreateUploader(
60 const std::string& server_url,
61 const std::string& mime_type,
62 const base::Callback<void(int)>& on_upload_complete) = 0;
65 } // namespace metrics
67 #endif // COMPONENTS_METRICS_METRICS_SERVICE_CLIENT_H_