| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #include "chrome/browser/metrics/chrome_metrics_services_manager_client.h" | 5 #include "chrome/browser/metrics/chrome_metrics_services_manager_client.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
| 10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 net::URLRequestContextGetter* | 66 net::URLRequestContextGetter* |
| 67 ChromeMetricsServicesManagerClient::GetURLRequestContext() { | 67 ChromeMetricsServicesManagerClient::GetURLRequestContext() { |
| 68 return g_browser_process->system_request_context(); | 68 return g_browser_process->system_request_context(); |
| 69 } | 69 } |
| 70 | 70 |
| 71 bool ChromeMetricsServicesManagerClient::IsSafeBrowsingEnabled( | 71 bool ChromeMetricsServicesManagerClient::IsSafeBrowsingEnabled( |
| 72 const base::Closure& on_update_callback) { | 72 const base::Closure& on_update_callback) { |
| 73 // Start listening for updates to SB service state. This is done here instead | 73 // Start listening for updates to SB service state. This is done here instead |
| 74 // of in the constructor to avoid errors from trying to instantiate SB | 74 // of in the constructor to avoid errors from trying to instantiate SB |
| 75 // service before the IO thread exists. | 75 // service before the IO thread exists. |
| 76 SafeBrowsingService* sb_service = g_browser_process->safe_browsing_service(); | 76 safe_browsing::SafeBrowsingService* sb_service = |
| 77 g_browser_process->safe_browsing_service(); |
| 77 if (!sb_state_subscription_ && sb_service) { | 78 if (!sb_state_subscription_ && sb_service) { |
| 78 // It is safe to pass the callback received from the | 79 // It is safe to pass the callback received from the |
| 79 // MetricsServicesManager here since the MetricsServicesManager owns | 80 // MetricsServicesManager here since the MetricsServicesManager owns |
| 80 // this object, which owns the sb_state_subscription_, which owns the | 81 // this object, which owns the sb_state_subscription_, which owns the |
| 81 // pointer to the MetricsServicesManager. | 82 // pointer to the MetricsServicesManager. |
| 82 sb_state_subscription_ = | 83 sb_state_subscription_ = |
| 83 sb_service->RegisterStateCallback(on_update_callback); | 84 sb_service->RegisterStateCallback(on_update_callback); |
| 84 } | 85 } |
| 85 | 86 |
| 86 return sb_service && sb_service->enabled_by_prefs(); | 87 return sb_service && sb_service->enabled_by_prefs(); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 102 if (!metrics_state_manager_) { | 103 if (!metrics_state_manager_) { |
| 103 metrics_state_manager_ = metrics::MetricsStateManager::Create( | 104 metrics_state_manager_ = metrics::MetricsStateManager::Create( |
| 104 local_state_, | 105 local_state_, |
| 105 base::Bind( | 106 base::Bind( |
| 106 &ChromeMetricsServiceAccessor::IsMetricsAndCrashReportingEnabled), | 107 &ChromeMetricsServiceAccessor::IsMetricsAndCrashReportingEnabled), |
| 107 base::Bind(&PostStoreMetricsClientInfo), | 108 base::Bind(&PostStoreMetricsClientInfo), |
| 108 base::Bind(&GoogleUpdateSettings::LoadMetricsClientInfo)); | 109 base::Bind(&GoogleUpdateSettings::LoadMetricsClientInfo)); |
| 109 } | 110 } |
| 110 return metrics_state_manager_.get(); | 111 return metrics_state_manager_.get(); |
| 111 } | 112 } |
| OLD | NEW |