| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 //------------------------------------------------------------------------------ | 5 //------------------------------------------------------------------------------ |
| 6 // Description of the life cycle of a instance of MetricsService. | 6 // Description of the life cycle of a instance of MetricsService. |
| 7 // | 7 // |
| 8 // OVERVIEW | 8 // OVERVIEW |
| 9 // | 9 // |
| 10 // A MetricsService instance is typically created at application startup. It | 10 // A MetricsService instance is typically created at application startup. It |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 #include "chrome/browser/metrics/metrics_log_serializer.h" | 172 #include "chrome/browser/metrics/metrics_log_serializer.h" |
| 173 #include "chrome/browser/metrics/metrics_reporting_scheduler.h" | 173 #include "chrome/browser/metrics/metrics_reporting_scheduler.h" |
| 174 #include "chrome/browser/metrics/tracking_synchronizer.h" | 174 #include "chrome/browser/metrics/tracking_synchronizer.h" |
| 175 #include "chrome/browser/net/http_pipelining_compatibility_client.h" | 175 #include "chrome/browser/net/http_pipelining_compatibility_client.h" |
| 176 #include "chrome/browser/net/network_stats.h" | 176 #include "chrome/browser/net/network_stats.h" |
| 177 #include "chrome/browser/prefs/pref_service.h" | 177 #include "chrome/browser/prefs/pref_service.h" |
| 178 #include "chrome/browser/prefs/scoped_user_pref_update.h" | 178 #include "chrome/browser/prefs/scoped_user_pref_update.h" |
| 179 #include "chrome/browser/profiles/profile.h" | 179 #include "chrome/browser/profiles/profile.h" |
| 180 #include "chrome/browser/search_engines/template_url_service.h" | 180 #include "chrome/browser/search_engines/template_url_service.h" |
| 181 #include "chrome/browser/ui/browser_list.h" | 181 #include "chrome/browser/ui/browser_list.h" |
| 182 #include "chrome/browser/ui/browser_otr_state.h" |
| 182 #include "chrome/common/child_process_logging.h" | 183 #include "chrome/common/child_process_logging.h" |
| 183 #include "chrome/common/chrome_notification_types.h" | 184 #include "chrome/common/chrome_notification_types.h" |
| 184 #include "chrome/common/chrome_result_codes.h" | 185 #include "chrome/common/chrome_result_codes.h" |
| 185 #include "chrome/common/chrome_switches.h" | 186 #include "chrome/common/chrome_switches.h" |
| 186 #include "chrome/common/metrics/metrics_log_manager.h" | 187 #include "chrome/common/metrics/metrics_log_manager.h" |
| 187 #include "chrome/common/net/test_server_locations.h" | 188 #include "chrome/common/net/test_server_locations.h" |
| 188 #include "chrome/common/pref_names.h" | 189 #include "chrome/common/pref_names.h" |
| 189 #include "chrome/common/render_messages.h" | 190 #include "chrome/common/render_messages.h" |
| 190 #include "content/public/browser/child_process_data.h" | 191 #include "content/public/browser/child_process_data.h" |
| 191 #include "content/public/browser/histogram_fetcher.h" | 192 #include "content/public/browser/histogram_fetcher.h" |
| (...skipping 1664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1856 child_process_stats_buffer_.clear(); | 1857 child_process_stats_buffer_.clear(); |
| 1857 } | 1858 } |
| 1858 | 1859 |
| 1859 bool MetricsService::CanLogNotification( | 1860 bool MetricsService::CanLogNotification( |
| 1860 int type, | 1861 int type, |
| 1861 const content::NotificationSource& source, | 1862 const content::NotificationSource& source, |
| 1862 const content::NotificationDetails& details) { | 1863 const content::NotificationDetails& details) { |
| 1863 // We simply don't log anything to UMA if there is a single incognito | 1864 // We simply don't log anything to UMA if there is a single incognito |
| 1864 // session visible. The problem is that we always notify using the orginal | 1865 // session visible. The problem is that we always notify using the orginal |
| 1865 // profile in order to simplify notification processing. | 1866 // profile in order to simplify notification processing. |
| 1866 return !BrowserList::IsOffTheRecordSessionActive(); | 1867 return !browser::IsOffTheRecordSessionActive(); |
| 1867 } | 1868 } |
| 1868 | 1869 |
| 1869 void MetricsService::RecordBooleanPrefValue(const char* path, bool value) { | 1870 void MetricsService::RecordBooleanPrefValue(const char* path, bool value) { |
| 1870 DCHECK(IsSingleThreaded()); | 1871 DCHECK(IsSingleThreaded()); |
| 1871 | 1872 |
| 1872 PrefService* pref = g_browser_process->local_state(); | 1873 PrefService* pref = g_browser_process->local_state(); |
| 1873 DCHECK(pref); | 1874 DCHECK(pref); |
| 1874 | 1875 |
| 1875 pref->SetBoolean(path, value); | 1876 pref->SetBoolean(path, value); |
| 1876 RecordCurrentState(pref); | 1877 RecordCurrentState(pref); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 1903 if (local_state) { | 1904 if (local_state) { |
| 1904 const PrefService::Preference* uma_pref = | 1905 const PrefService::Preference* uma_pref = |
| 1905 local_state->FindPreference(prefs::kMetricsReportingEnabled); | 1906 local_state->FindPreference(prefs::kMetricsReportingEnabled); |
| 1906 if (uma_pref) { | 1907 if (uma_pref) { |
| 1907 bool success = uma_pref->GetValue()->GetAsBoolean(&result); | 1908 bool success = uma_pref->GetValue()->GetAsBoolean(&result); |
| 1908 DCHECK(success); | 1909 DCHECK(success); |
| 1909 } | 1910 } |
| 1910 } | 1911 } |
| 1911 return result; | 1912 return result; |
| 1912 } | 1913 } |
| OLD | NEW |