| 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 #ifndef COMPONENTS_METRICS_SERVICES_MANAGER_METRICS_SERVICES_MANAGER_H_ | 5 #ifndef COMPONENTS_METRICS_SERVICES_MANAGER_METRICS_SERVICES_MANAGER_H_ |
| 6 #define COMPONENTS_METRICS_SERVICES_MANAGER_METRICS_SERVICES_MANAGER_H_ | 6 #define COMPONENTS_METRICS_SERVICES_MANAGER_METRICS_SERVICES_MANAGER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 | 72 |
| 73 // Should be called when a plugin loading error occurs. | 73 // Should be called when a plugin loading error occurs. |
| 74 void OnPluginLoadingError(const base::FilePath& plugin_path); | 74 void OnPluginLoadingError(const base::FilePath& plugin_path); |
| 75 | 75 |
| 76 // Some embedders use this method to notify the metrics system when a | 76 // Some embedders use this method to notify the metrics system when a |
| 77 // renderer process exits unexpectedly. | 77 // renderer process exits unexpectedly. |
| 78 void OnRendererProcessCrash(); | 78 void OnRendererProcessCrash(); |
| 79 | 79 |
| 80 // Update the managed services when permissions for recording/uploading | 80 // Update the managed services when permissions for recording/uploading |
| 81 // metrics change. | 81 // metrics change. |
| 82 void UpdatePermissions(bool may_record, bool may_upload); | 82 void UpdatePermissions(bool current_may_record, bool current_may_upload); |
| 83 | 83 |
| 84 // Update the managed services when permissions for uploading metrics change. | 84 // Update the managed services when permissions for uploading metrics change. |
| 85 void UpdateUploadPermissions(bool may_upload); | 85 void UpdateUploadPermissions(bool may_upload); |
| 86 | 86 |
| 87 private: | 87 private: |
| 88 // Update the managed services when permissions for recording/uploading | 88 // Update the managed services when permissions for recording/uploading |
| 89 // metrics change. | 89 // metrics change. |
| 90 void UpdateRapporServiceImpl(); | 90 void UpdateRapporServiceImpl(); |
| 91 | 91 |
| 92 // Returns the MetricsServiceClient, creating it if it hasn't been | 92 // Returns the MetricsServiceClient, creating it if it hasn't been |
| 93 // created yet (and additionally creating the MetricsService in that case). | 93 // created yet (and additionally creating the MetricsService in that case). |
| 94 metrics::MetricsServiceClient* GetMetricsServiceClient(); | 94 metrics::MetricsServiceClient* GetMetricsServiceClient(); |
| 95 | 95 |
| 96 metrics::MetricsStateManager* GetMetricsStateManager(); | 96 metrics::MetricsStateManager* GetMetricsStateManager(); |
| 97 | 97 |
| 98 // Update which services are running to match current permissions. | 98 // Update which services are running to match current permissions. |
| 99 void UpdateRunningServices(); | 99 void UpdateRunningServices(); |
| 100 | 100 |
| 101 // Update the state of UkmService to match current permissions. |
| 102 void UpdateUkmService(); |
| 103 |
| 101 // The client passed in from the embedder. | 104 // The client passed in from the embedder. |
| 102 std::unique_ptr<MetricsServicesManagerClient> client_; | 105 std::unique_ptr<MetricsServicesManagerClient> client_; |
| 103 | 106 |
| 104 // Ensures that all functions are called from the same thread. | 107 // Ensures that all functions are called from the same thread. |
| 105 base::ThreadChecker thread_checker_; | 108 base::ThreadChecker thread_checker_; |
| 106 | 109 |
| 107 // The current metrics reporting setting. | 110 // The current metrics reporting setting. |
| 108 bool may_upload_; | 111 bool may_upload_; |
| 109 | 112 |
| 110 // The current metrics recording setting. | 113 // The current metrics recording setting. |
| 111 bool may_record_; | 114 bool may_record_; |
| 112 | 115 |
| 113 // The MetricsServiceClient. Owns the MetricsService. | 116 // The MetricsServiceClient. Owns the MetricsService. |
| 114 std::unique_ptr<metrics::MetricsServiceClient> metrics_service_client_; | 117 std::unique_ptr<metrics::MetricsServiceClient> metrics_service_client_; |
| 115 | 118 |
| 116 // The RapporServiceImpl, for RAPPOR metric uploads. | 119 // The RapporServiceImpl, for RAPPOR metric uploads. |
| 117 std::unique_ptr<rappor::RapporServiceImpl> rappor_service_; | 120 std::unique_ptr<rappor::RapporServiceImpl> rappor_service_; |
| 118 | 121 |
| 119 // The VariationsService, for server-side experiments infrastructure. | 122 // The VariationsService, for server-side experiments infrastructure. |
| 120 std::unique_ptr<variations::VariationsService> variations_service_; | 123 std::unique_ptr<variations::VariationsService> variations_service_; |
| 121 | 124 |
| 122 DISALLOW_COPY_AND_ASSIGN(MetricsServicesManager); | 125 DISALLOW_COPY_AND_ASSIGN(MetricsServicesManager); |
| 123 }; | 126 }; |
| 124 | 127 |
| 125 } // namespace metrics_services_manager | 128 } // namespace metrics_services_manager |
| 126 | 129 |
| 127 #endif // COMPONENTS_METRICS_SERVICES_MANAGER_METRICS_SERVICES_MANAGER_H_ | 130 #endif // COMPONENTS_METRICS_SERVICES_MANAGER_METRICS_SERVICES_MANAGER_H_ |
| OLD | NEW |