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 is | 10 // A MetricsService instance is typically created at application startup. It is |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 #include "extensions/browser/process_map.h" | 219 #include "extensions/browser/process_map.h" |
220 #include "net/base/load_flags.h" | 220 #include "net/base/load_flags.h" |
221 #include "net/url_request/url_fetcher.h" | 221 #include "net/url_request/url_fetcher.h" |
222 | 222 |
223 // TODO(port): port browser_distribution.h. | 223 // TODO(port): port browser_distribution.h. |
224 #if !defined(OS_POSIX) | 224 #if !defined(OS_POSIX) |
225 #include "chrome/installer/util/browser_distribution.h" | 225 #include "chrome/installer/util/browser_distribution.h" |
226 #endif | 226 #endif |
227 | 227 |
228 #if defined(OS_CHROMEOS) | 228 #if defined(OS_CHROMEOS) |
229 #include "chrome/browser/chromeos/external_metrics.h" | |
230 #include "chrome/browser/chromeos/settings/cros_settings.h" | 229 #include "chrome/browser/chromeos/settings/cros_settings.h" |
231 #include "chromeos/system/statistics_provider.h" | 230 #include "chromeos/system/statistics_provider.h" |
232 #endif | 231 #endif |
233 | 232 |
234 #if defined(OS_WIN) | 233 #if defined(OS_WIN) |
235 #include <windows.h> // Needed for STATUS_* codes | 234 #include <windows.h> // Needed for STATUS_* codes |
236 #include "base/win/registry.h" | 235 #include "base/win/registry.h" |
237 #endif | 236 #endif |
238 | 237 |
239 #if !defined(OS_ANDROID) | 238 #if !defined(OS_ANDROID) |
(...skipping 1668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1908 RecordPluginChanges(pref); | 1907 RecordPluginChanges(pref); |
1909 } | 1908 } |
1910 | 1909 |
1911 // static | 1910 // static |
1912 bool MetricsService::IsPluginProcess(int process_type) { | 1911 bool MetricsService::IsPluginProcess(int process_type) { |
1913 return (process_type == content::PROCESS_TYPE_PLUGIN || | 1912 return (process_type == content::PROCESS_TYPE_PLUGIN || |
1914 process_type == content::PROCESS_TYPE_PPAPI_PLUGIN || | 1913 process_type == content::PROCESS_TYPE_PPAPI_PLUGIN || |
1915 process_type == content::PROCESS_TYPE_PPAPI_BROKER); | 1914 process_type == content::PROCESS_TYPE_PPAPI_BROKER); |
1916 } | 1915 } |
1917 | 1916 |
1918 #if defined(OS_CHROMEOS) | |
1919 void MetricsService::StartExternalMetrics() { | |
1920 external_metrics_ = new chromeos::ExternalMetrics; | |
1921 external_metrics_->Start(); | |
1922 } | |
1923 #endif | |
1924 | |
1925 // static | 1917 // static |
1926 bool MetricsServiceHelper::IsMetricsReportingEnabled() { | 1918 bool MetricsServiceHelper::IsMetricsReportingEnabled() { |
1927 bool result = false; | 1919 bool result = false; |
1928 const PrefService* local_state = g_browser_process->local_state(); | 1920 const PrefService* local_state = g_browser_process->local_state(); |
1929 if (local_state) { | 1921 if (local_state) { |
1930 const PrefService::Preference* uma_pref = | 1922 const PrefService::Preference* uma_pref = |
1931 local_state->FindPreference(prefs::kMetricsReportingEnabled); | 1923 local_state->FindPreference(prefs::kMetricsReportingEnabled); |
1932 if (uma_pref) { | 1924 if (uma_pref) { |
1933 bool success = uma_pref->GetValue()->GetAsBoolean(&result); | 1925 bool success = uma_pref->GetValue()->GetAsBoolean(&result); |
1934 DCHECK(success); | 1926 DCHECK(success); |
(...skipping 27 matching lines...) Expand all Loading... |
1962 if (metrics_service) | 1954 if (metrics_service) |
1963 metrics_service->AddObserver(observer); | 1955 metrics_service->AddObserver(observer); |
1964 } | 1956 } |
1965 | 1957 |
1966 void MetricsServiceHelper::RemoveMetricsServiceObserver( | 1958 void MetricsServiceHelper::RemoveMetricsServiceObserver( |
1967 MetricsServiceObserver* observer) { | 1959 MetricsServiceObserver* observer) { |
1968 MetricsService* metrics_service = g_browser_process->metrics_service(); | 1960 MetricsService* metrics_service = g_browser_process->metrics_service(); |
1969 if (metrics_service) | 1961 if (metrics_service) |
1970 metrics_service->RemoveObserver(observer); | 1962 metrics_service->RemoveObserver(observer); |
1971 } | 1963 } |
OLD | NEW |