| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef COMPONENTS_UKM_UKM_SERVICE_H_ | 5 #ifndef COMPONENTS_UKM_UKM_SERVICE_H_ |
| 6 #define COMPONENTS_UKM_UKM_SERVICE_H_ | 6 #define COMPONENTS_UKM_UKM_SERVICE_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 // uploading reports that contain fine grained performance metrics including | 42 // uploading reports that contain fine grained performance metrics including |
| 43 // URLs for top-level navigations. | 43 // URLs for top-level navigations. |
| 44 class UkmService : public base::SupportsWeakPtr<UkmService> { | 44 class UkmService : public base::SupportsWeakPtr<UkmService> { |
| 45 public: | 45 public: |
| 46 // Constructs a UkmService. | 46 // Constructs a UkmService. |
| 47 // Calling code is responsible for ensuring that the lifetime of | 47 // Calling code is responsible for ensuring that the lifetime of |
| 48 // |pref_service| is longer than the lifetime of UkmService. | 48 // |pref_service| is longer than the lifetime of UkmService. |
| 49 UkmService(PrefService* pref_service, metrics::MetricsServiceClient* client); | 49 UkmService(PrefService* pref_service, metrics::MetricsServiceClient* client); |
| 50 virtual ~UkmService(); | 50 virtual ~UkmService(); |
| 51 | 51 |
| 52 // Get the new source ID, which is unique for the duration of a browser |
| 53 // session. |
| 54 static int32_t GetNewSourceID(); |
| 55 |
| 52 // Update the URL on the source keyed to the given source ID. If the source | 56 // Update the URL on the source keyed to the given source ID. If the source |
| 53 // does not exist, it will create a new UkmSource object. | 57 // does not exist, it will create a new UkmSource object. |
| 54 void UpdateSourceURL(int32_t source_id, const GURL& url); | 58 void UpdateSourceURL(int32_t source_id, const GURL& url); |
| 55 | 59 |
| 56 // Initializes the UKM service. | 60 // Initializes the UKM service. |
| 57 void Initialize(); | 61 void Initialize(); |
| 58 | 62 |
| 59 // Enables/disables recording control if data is allowed to be collected. | 63 // Enables/disables recording control if data is allowed to be collected. |
| 60 void EnableRecording(); | 64 void EnableRecording(); |
| 61 void DisableRecording(); | 65 void DisableRecording(); |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 // Weak pointers factory used to post task on different threads. All weak | 180 // Weak pointers factory used to post task on different threads. All weak |
| 177 // pointers managed by this factory have the same lifetime as UkmService. | 181 // pointers managed by this factory have the same lifetime as UkmService. |
| 178 base::WeakPtrFactory<UkmService> self_ptr_factory_; | 182 base::WeakPtrFactory<UkmService> self_ptr_factory_; |
| 179 | 183 |
| 180 DISALLOW_COPY_AND_ASSIGN(UkmService); | 184 DISALLOW_COPY_AND_ASSIGN(UkmService); |
| 181 }; | 185 }; |
| 182 | 186 |
| 183 } // namespace ukm | 187 } // namespace ukm |
| 184 | 188 |
| 185 #endif // COMPONENTS_UKM_UKM_SERVICE_H_ | 189 #endif // COMPONENTS_UKM_UKM_SERVICE_H_ |
| OLD | NEW |