Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1677)

Unified Diff: android_webview/browser/aw_metrics_service_client.h

Issue 2611883002: Prepare to call GMS APIs from WebView (Closed)
Patch Set: explicit destructor for style checker Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « android_webview/browser/aw_browser_context.cc ('k') | android_webview/browser/aw_metrics_service_client.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: android_webview/browser/aw_metrics_service_client.h
diff --git a/android_webview/browser/aw_metrics_service_client.h b/android_webview/browser/aw_metrics_service_client.h
index 3bfc512367cea25c5c00fe1eafcf940b51ece561..82ac198fe8b3856bd5c042654c112bfe57265c4a 100644
--- a/android_webview/browser/aw_metrics_service_client.h
+++ b/android_webview/browser/aw_metrics_service_client.h
@@ -5,12 +5,6 @@
#ifndef ANDROID_WEBVIEW_BROWSER_AW_METRICS_SERVICE_CLIENT_IMPL_H_
#define ANDROID_WEBVIEW_BROWSER_AW_METRICS_SERVICE_CLIENT_IMPL_H_
-#include <memory>
-#include <string>
-
-#include "android_webview/browser/aw_metrics_service_client.h"
-#include "base/lazy_instance.h"
-#include "base/macros.h"
#include "components/metrics/enabled_state_provider.h"
#include "components/metrics/metrics_service_client.h"
@@ -20,69 +14,25 @@ namespace base {
class FilePath;
}
-namespace metrics {
-class MetricsStateManager;
-}
-
namespace net {
class URLRequestContextGetter;
}
namespace android_webview {
-// This singleton manages metrics for an app using any number of WebViews. The
-// homonymous Java class is responsible for turning metrics on and off. This
-// singleton must always be used on the same thread. (Currently the UI thread
-// is enforced, but it could be any thread.) This is to prevent enable/disable
-// race conditions, and because MetricsService is single-threaded.
-// Initialization is asynchronous; even after Initialize has returned, some
-// methods may not be ready to use (see below).
class AwMetricsServiceClient : public metrics::MetricsServiceClient,
public metrics::EnabledStateProvider {
- friend struct base::DefaultLazyInstanceTraits<AwMetricsServiceClient>;
-
public:
- // These may be called at any time.
static AwMetricsServiceClient* GetInstance();
- void Initialize(PrefService* pref_service,
- net::URLRequestContextGetter* request_context,
- const base::FilePath guid_file_path);
- void SetMetricsEnabled(bool enabled);
-
- // metrics::EnabledStateProvider:
- bool IsConsentGiven() override;
+ virtual void Initialize(PrefService* pref_service,
+ net::URLRequestContextGetter* request_context,
+ const base::FilePath guid_file_path) = 0;
- // These implement metrics::MetricsServiceClient. They must not be called
- // until initialization has asynchronously finished.
- metrics::MetricsService* GetMetricsService() override;
- void SetMetricsClientId(const std::string& client_id) override;
- int32_t GetProduct() override;
- std::string GetApplicationLocale() override;
- bool GetBrand(std::string* brand_code) override;
- metrics::SystemProfileProto::Channel GetChannel() override;
- std::string GetVersionString() override;
- void InitializeSystemProfileMetrics(
- const base::Closure& done_callback) override;
- void CollectFinalMetricsForLog(const base::Closure& done_callback) override;
- std::unique_ptr<metrics::MetricsLogUploader> CreateUploader(
- const std::string& server_url,
- const std::string& mime_type,
- const base::Callback<void(int)>& on_upload_complete) override;
- base::TimeDelta GetStandardUploadInterval() override;
-
- private:
+ protected:
AwMetricsServiceClient();
~AwMetricsServiceClient() override;
- void InitializeWithGUID(std::string* guid);
-
- bool is_initialized_;
- bool is_enabled_;
- PrefService* pref_service_;
- net::URLRequestContextGetter* request_context_;
- std::unique_ptr<metrics::MetricsStateManager> metrics_state_manager_;
- std::unique_ptr<metrics::MetricsService> metrics_service_;
-
+ private:
DISALLOW_COPY_AND_ASSIGN(AwMetricsServiceClient);
};
« no previous file with comments | « android_webview/browser/aw_browser_context.cc ('k') | android_webview/browser/aw_metrics_service_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698