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 968 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
979 target_loop->PostTask(FROM_HERE, | 979 target_loop->PostTask(FROM_HERE, |
980 base::Bind(&MetricsService::OnInitTaskGotHardwareClass, | 980 base::Bind(&MetricsService::OnInitTaskGotHardwareClass, |
981 self, hardware_class)); | 981 self, hardware_class)); |
982 } | 982 } |
983 | 983 |
984 void MetricsService::OnInitTaskGotHardwareClass( | 984 void MetricsService::OnInitTaskGotHardwareClass( |
985 const std::string& hardware_class) { | 985 const std::string& hardware_class) { |
986 DCHECK_EQ(INIT_TASK_SCHEDULED, state_); | 986 DCHECK_EQ(INIT_TASK_SCHEDULED, state_); |
987 hardware_class_ = hardware_class; | 987 hardware_class_ = hardware_class; |
988 | 988 |
| 989 #if defined(ENABLE_PLUGINS) |
989 // Start the next part of the init task: loading plugin information. | 990 // Start the next part of the init task: loading plugin information. |
990 PluginService::GetInstance()->GetPlugins( | 991 PluginService::GetInstance()->GetPlugins( |
991 base::Bind(&MetricsService::OnInitTaskGotPluginInfo, | 992 base::Bind(&MetricsService::OnInitTaskGotPluginInfo, |
992 self_ptr_factory_.GetWeakPtr())); | 993 self_ptr_factory_.GetWeakPtr())); |
| 994 #else |
| 995 std::vector<webkit::WebPluginInfo> plugin_list_empty; |
| 996 OnInitTaskGotPluginInfo(plugin_list_empty); |
| 997 #endif // defined(ENABLE_PLUGINS) |
993 } | 998 } |
994 | 999 |
995 void MetricsService::OnInitTaskGotPluginInfo( | 1000 void MetricsService::OnInitTaskGotPluginInfo( |
996 const std::vector<webkit::WebPluginInfo>& plugins) { | 1001 const std::vector<webkit::WebPluginInfo>& plugins) { |
997 DCHECK_EQ(INIT_TASK_SCHEDULED, state_); | 1002 DCHECK_EQ(INIT_TASK_SCHEDULED, state_); |
998 plugins_ = plugins; | 1003 plugins_ = plugins; |
999 | 1004 |
1000 // Schedules a task on a blocking pool thread to gather Google Update | 1005 // Schedules a task on a blocking pool thread to gather Google Update |
1001 // statistics (requires Registry reads). | 1006 // statistics (requires Registry reads). |
1002 BrowserThread::PostBlockingPoolTask( | 1007 BrowserThread::PostBlockingPoolTask( |
(...skipping 984 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1987 if (local_state) { | 1992 if (local_state) { |
1988 const PrefService::Preference* uma_pref = | 1993 const PrefService::Preference* uma_pref = |
1989 local_state->FindPreference(prefs::kMetricsReportingEnabled); | 1994 local_state->FindPreference(prefs::kMetricsReportingEnabled); |
1990 if (uma_pref) { | 1995 if (uma_pref) { |
1991 bool success = uma_pref->GetValue()->GetAsBoolean(&result); | 1996 bool success = uma_pref->GetValue()->GetAsBoolean(&result); |
1992 DCHECK(success); | 1997 DCHECK(success); |
1993 } | 1998 } |
1994 } | 1999 } |
1995 return result; | 2000 return result; |
1996 } | 2001 } |
OLD | NEW |