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 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 | 375 |
377 // Used to manage various metrics reporting state prefs, such as client id, | 376 // Used to manage various metrics reporting state prefs, such as client id, |
378 // low entropy source and whether metrics reporting is enabled. Weak pointer. | 377 // low entropy source and whether metrics reporting is enabled. Weak pointer. |
379 MetricsStateManager* const state_manager_; | 378 MetricsStateManager* const state_manager_; |
380 | 379 |
381 // Used to interact with the embedder. Weak pointer; must outlive |this| | 380 // Used to interact with the embedder. Weak pointer; must outlive |this| |
382 // instance. | 381 // instance. |
383 MetricsServiceClient* const client_; | 382 MetricsServiceClient* const client_; |
384 | 383 |
385 // Registered metrics providers. | 384 // Registered metrics providers. |
386 ScopedVector<MetricsProvider> metrics_providers_; | 385 std::vector<std::unique_ptr<MetricsProvider>> metrics_providers_; |
387 | 386 |
388 PrefService* local_state_; | 387 PrefService* local_state_; |
389 | 388 |
390 CleanExitBeacon clean_exit_beacon_; | 389 CleanExitBeacon clean_exit_beacon_; |
391 | 390 |
392 base::ActionCallback action_callback_; | 391 base::ActionCallback action_callback_; |
393 | 392 |
394 // Indicate whether recording and reporting are currently happening. | 393 // Indicate whether recording and reporting are currently happening. |
395 // These should not be set directly, but by calling SetRecording and | 394 // These should not be set directly, but by calling SetRecording and |
396 // SetReporting. | 395 // SetReporting. |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
463 // Weak pointers factory used to post task on different threads. All weak | 462 // Weak pointers factory used to post task on different threads. All weak |
464 // pointers managed by this factory have the same lifetime as MetricsService. | 463 // pointers managed by this factory have the same lifetime as MetricsService. |
465 base::WeakPtrFactory<MetricsService> self_ptr_factory_; | 464 base::WeakPtrFactory<MetricsService> self_ptr_factory_; |
466 | 465 |
467 DISALLOW_COPY_AND_ASSIGN(MetricsService); | 466 DISALLOW_COPY_AND_ASSIGN(MetricsService); |
468 }; | 467 }; |
469 | 468 |
470 } // namespace metrics | 469 } // namespace metrics |
471 | 470 |
472 #endif // COMPONENTS_METRICS_METRICS_SERVICE_H_ | 471 #endif // COMPONENTS_METRICS_METRICS_SERVICE_H_ |
OLD | NEW |