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 #include "chrome/browser/metrics/metrics_log.h" | 5 #include "chrome/browser/metrics/metrics_log.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 case PROCESS_TYPE_NACL_LOADER: | 196 case PROCESS_TYPE_NACL_LOADER: |
197 return ProfilerEventProto::TrackedObject::NACL_LOADER; | 197 return ProfilerEventProto::TrackedObject::NACL_LOADER; |
198 case PROCESS_TYPE_NACL_BROKER: | 198 case PROCESS_TYPE_NACL_BROKER: |
199 return ProfilerEventProto::TrackedObject::NACL_BROKER; | 199 return ProfilerEventProto::TrackedObject::NACL_BROKER; |
200 default: | 200 default: |
201 NOTREACHED(); | 201 NOTREACHED(); |
202 return ProfilerEventProto::TrackedObject::UNKNOWN; | 202 return ProfilerEventProto::TrackedObject::UNKNOWN; |
203 } | 203 } |
204 } | 204 } |
205 | 205 |
| 206 #if defined(ENABLE_PLUGINS) |
206 // Returns the plugin preferences corresponding for this user, if available. | 207 // Returns the plugin preferences corresponding for this user, if available. |
207 // If multiple user profiles are loaded, returns the preferences corresponding | 208 // If multiple user profiles are loaded, returns the preferences corresponding |
208 // to an arbitrary one of the profiles. | 209 // to an arbitrary one of the profiles. |
209 PluginPrefs* GetPluginPrefs() { | 210 PluginPrefs* GetPluginPrefs() { |
210 ProfileManager* profile_manager = g_browser_process->profile_manager(); | 211 ProfileManager* profile_manager = g_browser_process->profile_manager(); |
211 | 212 |
212 if (!profile_manager) { | 213 if (!profile_manager) { |
213 // The profile manager can be NULL when testing. | 214 // The profile manager can be NULL when testing. |
214 return NULL; | 215 return NULL; |
215 } | 216 } |
216 | 217 |
217 std::vector<Profile*> profiles = profile_manager->GetLoadedProfiles(); | 218 std::vector<Profile*> profiles = profile_manager->GetLoadedProfiles(); |
218 if (profiles.empty()) | 219 if (profiles.empty()) |
219 return NULL; | 220 return NULL; |
220 | 221 |
221 return PluginPrefs::GetForProfile(profiles.front()).get(); | 222 return PluginPrefs::GetForProfile(profiles.front()).get(); |
222 } | 223 } |
223 | 224 |
224 // Fills |plugin| with the info contained in |plugin_info| and |plugin_prefs|. | 225 // Fills |plugin| with the info contained in |plugin_info| and |plugin_prefs|. |
225 void SetPluginInfo(const content::WebPluginInfo& plugin_info, | 226 void SetPluginInfo(const content::WebPluginInfo& plugin_info, |
226 const PluginPrefs* plugin_prefs, | 227 const PluginPrefs* plugin_prefs, |
227 SystemProfileProto::Plugin* plugin) { | 228 SystemProfileProto::Plugin* plugin) { |
228 plugin->set_name(UTF16ToUTF8(plugin_info.name)); | 229 plugin->set_name(UTF16ToUTF8(plugin_info.name)); |
229 plugin->set_filename(plugin_info.path.BaseName().AsUTF8Unsafe()); | 230 plugin->set_filename(plugin_info.path.BaseName().AsUTF8Unsafe()); |
230 plugin->set_version(UTF16ToUTF8(plugin_info.version)); | 231 plugin->set_version(UTF16ToUTF8(plugin_info.version)); |
231 plugin->set_is_pepper(plugin_info.is_pepper_plugin()); | 232 plugin->set_is_pepper(plugin_info.is_pepper_plugin()); |
232 if (plugin_prefs) | 233 if (plugin_prefs) |
233 plugin->set_is_disabled(!plugin_prefs->IsPluginEnabled(plugin_info)); | 234 plugin->set_is_disabled(!plugin_prefs->IsPluginEnabled(plugin_info)); |
234 } | 235 } |
| 236 #endif // defined(ENABLE_PLUGINS) |
235 | 237 |
236 void WriteFieldTrials(const std::vector<ActiveGroupId>& field_trial_ids, | 238 void WriteFieldTrials(const std::vector<ActiveGroupId>& field_trial_ids, |
237 SystemProfileProto* system_profile) { | 239 SystemProfileProto* system_profile) { |
238 for (std::vector<ActiveGroupId>::const_iterator it = | 240 for (std::vector<ActiveGroupId>::const_iterator it = |
239 field_trial_ids.begin(); it != field_trial_ids.end(); ++it) { | 241 field_trial_ids.begin(); it != field_trial_ids.end(); ++it) { |
240 SystemProfileProto::FieldTrial* field_trial = | 242 SystemProfileProto::FieldTrial* field_trial = |
241 system_profile->add_field_trial(); | 243 system_profile->add_field_trial(); |
242 field_trial->set_name_id(it->name); | 244 field_trial->set_name_id(it->name); |
243 field_trial->set_group_id(it->group); | 245 field_trial->set_group_id(it->group); |
244 } | 246 } |
(...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
961 | 963 |
962 // We invalidate the user count if it changed while the log was open. | 964 // We invalidate the user count if it changed while the log was open. |
963 if (system_profile->has_multi_profile_user_count() && | 965 if (system_profile->has_multi_profile_user_count() && |
964 user_count != system_profile->multi_profile_user_count()) | 966 user_count != system_profile->multi_profile_user_count()) |
965 user_count = 0; | 967 user_count = 0; |
966 | 968 |
967 system_profile->set_multi_profile_user_count(user_count); | 969 system_profile->set_multi_profile_user_count(user_count); |
968 } | 970 } |
969 } | 971 } |
970 #endif | 972 #endif |
OLD | NEW |