Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(516)

Side by Side Diff: chrome/browser/metrics/metrics_log.cc

Issue 7648017: Make WebPluginInfo more generic (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/metrics/metrics_log.h ('k') | chrome/browser/metrics/metrics_service.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/file_util.h" 11 #include "base/file_util.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/perftimer.h" 13 #include "base/perftimer.h"
14 #include "base/string_util.h" 14 #include "base/string_util.h"
15 #include "base/sys_info.h" 15 #include "base/sys_info.h"
16 #include "base/third_party/nspr/prtime.h" 16 #include "base/third_party/nspr/prtime.h"
17 #include "base/time.h" 17 #include "base/time.h"
18 #include "base/utf_string_conversions.h" 18 #include "base/utf_string_conversions.h"
19 #include "chrome/browser/autocomplete/autocomplete.h" 19 #include "chrome/browser/autocomplete/autocomplete.h"
20 #include "chrome/browser/autocomplete/autocomplete_match.h" 20 #include "chrome/browser/autocomplete/autocomplete_match.h"
21 #include "chrome/browser/browser_process.h" 21 #include "chrome/browser/browser_process.h"
22 #include "chrome/browser/metrics/display_utils.h" 22 #include "chrome/browser/metrics/display_utils.h"
23 #include "chrome/browser/prefs/pref_service.h" 23 #include "chrome/browser/prefs/pref_service.h"
24 #include "chrome/common/chrome_version_info.h" 24 #include "chrome/common/chrome_version_info.h"
25 #include "chrome/common/logging_chrome.h" 25 #include "chrome/common/logging_chrome.h"
26 #include "chrome/common/pref_names.h" 26 #include "chrome/common/pref_names.h"
27 #include "content/browser/gpu/gpu_data_manager.h" 27 #include "content/browser/gpu/gpu_data_manager.h"
28 #include "googleurl/src/gurl.h" 28 #include "googleurl/src/gurl.h"
29 #include "webkit/plugins/npapi/webplugininfo.h" 29 #include "webkit/plugins/webplugininfo.h"
30 30
31 #define OPEN_ELEMENT_FOR_SCOPE(name) ScopedElement scoped_element(this, name) 31 #define OPEN_ELEMENT_FOR_SCOPE(name) ScopedElement scoped_element(this, name)
32 32
33 // http://blogs.msdn.com/oldnewthing/archive/2004/10/25/247180.aspx 33 // http://blogs.msdn.com/oldnewthing/archive/2004/10/25/247180.aspx
34 #if defined(OS_WIN) 34 #if defined(OS_WIN)
35 extern "C" IMAGE_DOS_HEADER __ImageBase; 35 extern "C" IMAGE_DOS_HEADER __ImageBase;
36 #endif 36 #endif
37 37
38 MetricsLog::MetricsLog(const std::string& client_id, int session_id) 38 MetricsLog::MetricsLog(const std::string& client_id, int session_id)
39 : MetricsLogBase(client_id, session_id, MetricsLog::GetVersionString()) {} 39 : MetricsLogBase(client_id, session_id, MetricsLog::GetVersionString()) {}
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 pref->SetInteger(prefs::kStabilitySystemUncleanShutdownCount, 0); 263 pref->SetInteger(prefs::kStabilitySystemUncleanShutdownCount, 0);
264 } 264 }
265 #endif // OS_CHROMEOS 265 #endif // OS_CHROMEOS
266 266
267 int64 recent_duration = GetIncrementalUptime(pref); 267 int64 recent_duration = GetIncrementalUptime(pref);
268 if (recent_duration) 268 if (recent_duration)
269 WriteInt64Attribute("uptimesec", recent_duration); 269 WriteInt64Attribute("uptimesec", recent_duration);
270 } 270 }
271 271
272 void MetricsLog::WritePluginList( 272 void MetricsLog::WritePluginList(
273 const std::vector<webkit::npapi::WebPluginInfo>& plugin_list) { 273 const std::vector<webkit::WebPluginInfo>& plugin_list) {
274 DCHECK(!locked_); 274 DCHECK(!locked_);
275 275
276 OPEN_ELEMENT_FOR_SCOPE("plugins"); 276 OPEN_ELEMENT_FOR_SCOPE("plugins");
277 277
278 for (std::vector<webkit::npapi::WebPluginInfo>::const_iterator iter = 278 for (std::vector<webkit::WebPluginInfo>::const_iterator iter =
279 plugin_list.begin(); 279 plugin_list.begin();
280 iter != plugin_list.end(); ++iter) { 280 iter != plugin_list.end(); ++iter) {
281 OPEN_ELEMENT_FOR_SCOPE("plugin"); 281 OPEN_ELEMENT_FOR_SCOPE("plugin");
282 282
283 // Plugin name and filename are hashed for the privacy of those 283 // Plugin name and filename are hashed for the privacy of those
284 // testing unreleased new extensions. 284 // testing unreleased new extensions.
285 WriteAttribute("name", CreateBase64Hash(UTF16ToUTF8(iter->name))); 285 WriteAttribute("name", CreateBase64Hash(UTF16ToUTF8(iter->name)));
286 std::string filename_bytes = 286 std::string filename_bytes =
287 #if defined(OS_WIN) 287 #if defined(OS_WIN)
288 UTF16ToUTF8(iter->path.BaseName().value()); 288 UTF16ToUTF8(iter->path.BaseName().value());
289 #else 289 #else
290 iter->path.BaseName().value(); 290 iter->path.BaseName().value();
291 #endif 291 #endif
292 WriteAttribute("filename", CreateBase64Hash(filename_bytes)); 292 WriteAttribute("filename", CreateBase64Hash(filename_bytes));
293 WriteAttribute("version", UTF16ToUTF8(iter->version)); 293 WriteAttribute("version", UTF16ToUTF8(iter->version));
294 WriteIntAttribute("disabled", !webkit::npapi::IsPluginEnabled(*iter)); 294 WriteIntAttribute("disabled", !webkit::IsPluginEnabled(*iter));
295 } 295 }
296 } 296 }
297 297
298 void MetricsLog::WriteInstallElement() { 298 void MetricsLog::WriteInstallElement() {
299 OPEN_ELEMENT_FOR_SCOPE("install"); 299 OPEN_ELEMENT_FOR_SCOPE("install");
300 WriteAttribute("installdate", GetInstallDate()); 300 WriteAttribute("installdate", GetInstallDate());
301 WriteIntAttribute("buildid", 0); // We're using appversion instead. 301 WriteIntAttribute("buildid", 0); // We're using appversion instead.
302 } 302 }
303 303
304 void MetricsLog::RecordEnvironment( 304 void MetricsLog::RecordEnvironment(
305 const std::vector<webkit::npapi::WebPluginInfo>& plugin_list, 305 const std::vector<webkit::WebPluginInfo>& plugin_list,
306 const DictionaryValue* profile_metrics) { 306 const DictionaryValue* profile_metrics) {
307 DCHECK(!locked_); 307 DCHECK(!locked_);
308 308
309 PrefService* pref = g_browser_process->local_state(); 309 PrefService* pref = g_browser_process->local_state();
310 310
311 OPEN_ELEMENT_FOR_SCOPE("profile"); 311 OPEN_ELEMENT_FOR_SCOPE("profile");
312 WriteCommonEventAttributes(); 312 WriteCommonEventAttributes();
313 313
314 WriteInstallElement(); 314 WriteInstallElement();
315 315
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
486 const std::string result_type(AutocompleteMatch::TypeToString(i->type)); 486 const std::string result_type(AutocompleteMatch::TypeToString(i->type));
487 if (!result_type.empty()) 487 if (!result_type.empty())
488 WriteAttribute("resulttype", result_type); 488 WriteAttribute("resulttype", result_type);
489 WriteIntAttribute("relevance", i->relevance); 489 WriteIntAttribute("relevance", i->relevance);
490 WriteIntAttribute("isstarred", i->starred ? 1 : 0); 490 WriteIntAttribute("isstarred", i->starred ? 1 : 0);
491 } 491 }
492 } 492 }
493 493
494 ++num_events_; 494 ++num_events_;
495 } 495 }
OLDNEW
« no previous file with comments | « chrome/browser/metrics/metrics_log.h ('k') | chrome/browser/metrics/metrics_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698