| 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  | 
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  236  |  236  | 
|  237   // Check if this install was cloned or imaged from another machine. If a |  237   // Check if this install was cloned or imaged from another machine. If a | 
|  238   // clone is detected, reset the client id and low entropy source. This |  238   // clone is detected, reset the client id and low entropy source. This | 
|  239   // should not be called more than once. |  239   // should not be called more than once. | 
|  240   void CheckForClonedInstall( |  240   void CheckForClonedInstall( | 
|  241       scoped_refptr<base::SingleThreadTaskRunner> task_runner); |  241       scoped_refptr<base::SingleThreadTaskRunner> task_runner); | 
|  242  |  242  | 
|  243   // Clears the stability metrics that are saved in local state. |  243   // Clears the stability metrics that are saved in local state. | 
|  244   void ClearSavedStabilityMetrics(); |  244   void ClearSavedStabilityMetrics(); | 
|  245  |  245  | 
|  246   // Sets the connection type callback used to pass to the scheduler. |  | 
|  247   void SetConnectionTypeCallback( |  | 
|  248       base::Callback<void(bool*)> is_cellular_callback); |  | 
|  249  |  | 
|  250  protected: |  246  protected: | 
|  251   // Exposed for testing. |  247   // Exposed for testing. | 
|  252   MetricsLogManager* log_manager() { return &log_manager_; } |  248   MetricsLogManager* log_manager() { return &log_manager_; } | 
|  253  |  249  | 
|  254  private: |  250  private: | 
|  255   // The MetricsService has a lifecycle that is stored as a state. |  251   // The MetricsService has a lifecycle that is stored as a state. | 
|  256   // See metrics_service.cc for description of this lifecycle. |  252   // See metrics_service.cc for description of this lifecycle. | 
|  257   enum State { |  253   enum State { | 
|  258     INITIALIZED,                    // Constructor was called. |  254     INITIALIZED,                    // Constructor was called. | 
|  259     INIT_TASK_SCHEDULED,            // Waiting for deferred init tasks to |  255     INIT_TASK_SCHEDULED,            // Waiting for deferred init tasks to | 
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  479   // List of observers of |synthetic_trial_groups_| changes. |  475   // List of observers of |synthetic_trial_groups_| changes. | 
|  480   ObserverList<SyntheticTrialObserver> synthetic_trial_observer_list_; |  476   ObserverList<SyntheticTrialObserver> synthetic_trial_observer_list_; | 
|  481  |  477  | 
|  482   // Execution phase the browser is in. |  478   // Execution phase the browser is in. | 
|  483   static ExecutionPhase execution_phase_; |  479   static ExecutionPhase execution_phase_; | 
|  484  |  480  | 
|  485   // Reduntant marker to check that we completed our shutdown, and set the |  481   // Reduntant marker to check that we completed our shutdown, and set the | 
|  486   // exited-cleanly bit in the prefs. |  482   // exited-cleanly bit in the prefs. | 
|  487   static ShutdownCleanliness clean_shutdown_status_; |  483   static ShutdownCleanliness clean_shutdown_status_; | 
|  488  |  484  | 
|  489   // Callback function used to get current network connection type. |  | 
|  490   base::Callback<void(bool*)> is_cellular_callback_; |  | 
|  491  |  | 
|  492   FRIEND_TEST_ALL_PREFIXES(MetricsServiceTest, IsPluginProcess); |  485   FRIEND_TEST_ALL_PREFIXES(MetricsServiceTest, IsPluginProcess); | 
|  493   FRIEND_TEST_ALL_PREFIXES(MetricsServiceTest, |  486   FRIEND_TEST_ALL_PREFIXES(MetricsServiceTest, | 
|  494                            PermutedEntropyCacheClearedWhenLowEntropyReset); |  487                            PermutedEntropyCacheClearedWhenLowEntropyReset); | 
|  495   FRIEND_TEST_ALL_PREFIXES(MetricsServiceTest, RegisterSyntheticTrial); |  488   FRIEND_TEST_ALL_PREFIXES(MetricsServiceTest, RegisterSyntheticTrial); | 
|  496  |  489  | 
|  497   // Weak pointers factory used to post task on different threads. All weak |  490   // Weak pointers factory used to post task on different threads. All weak | 
|  498   // pointers managed by this factory have the same lifetime as MetricsService. |  491   // pointers managed by this factory have the same lifetime as MetricsService. | 
|  499   base::WeakPtrFactory<MetricsService> self_ptr_factory_; |  492   base::WeakPtrFactory<MetricsService> self_ptr_factory_; | 
|  500  |  493  | 
|  501   // Weak pointers factory used for saving state. All weak pointers managed by |  494   // Weak pointers factory used for saving state. All weak pointers managed by | 
|  502   // this factory are invalidated in ScheduleNextStateSave. |  495   // this factory are invalidated in ScheduleNextStateSave. | 
|  503   base::WeakPtrFactory<MetricsService> state_saver_factory_; |  496   base::WeakPtrFactory<MetricsService> state_saver_factory_; | 
|  504  |  497  | 
|  505   DISALLOW_COPY_AND_ASSIGN(MetricsService); |  498   DISALLOW_COPY_AND_ASSIGN(MetricsService); | 
|  506 }; |  499 }; | 
|  507  |  500  | 
|  508 }  // namespace metrics |  501 }  // namespace metrics | 
|  509  |  502  | 
|  510 #endif  // COMPONENTS_METRICS_METRICS_SERVICE_H_ |  503 #endif  // COMPONENTS_METRICS_METRICS_SERVICE_H_ | 
| OLD | NEW |