| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 // This file defines a service that collects information about the user | 5 // This file defines a service that collects information about the user |
| 6 // experience in order to help improve future versions of the app. | 6 // experience in order to help improve future versions of the app. |
| 7 | 7 |
| 8 #ifndef COMPONENTS_METRICS_METRICS_SERVICE_H_ | 8 #ifndef COMPONENTS_METRICS_METRICS_SERVICE_H_ |
| 9 #define COMPONENTS_METRICS_METRICS_SERVICE_H_ | 9 #define COMPONENTS_METRICS_METRICS_SERVICE_H_ |
| 10 | 10 |
| 11 #include <stdint.h> | 11 #include <stdint.h> |
| 12 | 12 |
| 13 #include <map> | 13 #include <map> |
| 14 #include <memory> | 14 #include <memory> |
| 15 #include <string> | 15 #include <string> |
| 16 #include <vector> | 16 #include <vector> |
| 17 | 17 |
| 18 #include "base/gtest_prod_util.h" | 18 #include "base/gtest_prod_util.h" |
| 19 #include "base/macros.h" | 19 #include "base/macros.h" |
| 20 #include "base/memory/scoped_vector.h" | |
| 21 #include "base/memory/weak_ptr.h" | 20 #include "base/memory/weak_ptr.h" |
| 22 #include "base/metrics/field_trial.h" | 21 #include "base/metrics/field_trial.h" |
| 23 #include "base/metrics/histogram_flattener.h" | 22 #include "base/metrics/histogram_flattener.h" |
| 24 #include "base/metrics/histogram_snapshot_manager.h" | 23 #include "base/metrics/histogram_snapshot_manager.h" |
| 25 #include "base/metrics/user_metrics.h" | 24 #include "base/metrics/user_metrics.h" |
| 26 #include "base/observer_list.h" | 25 #include "base/observer_list.h" |
| 27 #include "base/threading/thread_checker.h" | 26 #include "base/threading/thread_checker.h" |
| 28 #include "base/time/time.h" | 27 #include "base/time/time.h" |
| 29 #include "build/build_config.h" | 28 #include "build/build_config.h" |
| 30 #include "components/metrics/clean_exit_beacon.h" | 29 #include "components/metrics/clean_exit_beacon.h" |
| (...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 373 | 372 |
| 374 // Used to manage various metrics reporting state prefs, such as client id, | 373 // Used to manage various metrics reporting state prefs, such as client id, |
| 375 // low entropy source and whether metrics reporting is enabled. Weak pointer. | 374 // low entropy source and whether metrics reporting is enabled. Weak pointer. |
| 376 MetricsStateManager* const state_manager_; | 375 MetricsStateManager* const state_manager_; |
| 377 | 376 |
| 378 // Used to interact with the embedder. Weak pointer; must outlive |this| | 377 // Used to interact with the embedder. Weak pointer; must outlive |this| |
| 379 // instance. | 378 // instance. |
| 380 MetricsServiceClient* const client_; | 379 MetricsServiceClient* const client_; |
| 381 | 380 |
| 382 // Registered metrics providers. | 381 // Registered metrics providers. |
| 383 ScopedVector<MetricsProvider> metrics_providers_; | 382 std::vector<std::unique_ptr<MetricsProvider>> metrics_providers_; |
| 384 | 383 |
| 385 PrefService* local_state_; | 384 PrefService* local_state_; |
| 386 | 385 |
| 387 CleanExitBeacon clean_exit_beacon_; | 386 CleanExitBeacon clean_exit_beacon_; |
| 388 | 387 |
| 389 base::ActionCallback action_callback_; | 388 base::ActionCallback action_callback_; |
| 390 | 389 |
| 391 // Indicate whether recording and reporting are currently happening. | 390 // Indicate whether recording and reporting are currently happening. |
| 392 // These should not be set directly, but by calling SetRecording and | 391 // These should not be set directly, but by calling SetRecording and |
| 393 // SetReporting. | 392 // SetReporting. |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 460 // Weak pointers factory used to post task on different threads. All weak | 459 // Weak pointers factory used to post task on different threads. All weak |
| 461 // pointers managed by this factory have the same lifetime as MetricsService. | 460 // pointers managed by this factory have the same lifetime as MetricsService. |
| 462 base::WeakPtrFactory<MetricsService> self_ptr_factory_; | 461 base::WeakPtrFactory<MetricsService> self_ptr_factory_; |
| 463 | 462 |
| 464 DISALLOW_COPY_AND_ASSIGN(MetricsService); | 463 DISALLOW_COPY_AND_ASSIGN(MetricsService); |
| 465 }; | 464 }; |
| 466 | 465 |
| 467 } // namespace metrics | 466 } // namespace metrics |
| 468 | 467 |
| 469 #endif // COMPONENTS_METRICS_METRICS_SERVICE_H_ | 468 #endif // COMPONENTS_METRICS_METRICS_SERVICE_H_ |
| OLD | NEW |