OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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_log.h" | 5 #include "chrome/browser/metrics_log.h" |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/file_version_info.h" | 8 #include "base/file_version_info.h" |
9 #include "base/md5.h" | 9 #include "base/md5.h" |
10 #include "base/scoped_ptr.h" | 10 #include "base/scoped_ptr.h" |
11 #include "base/string_util.h" | 11 #include "base/string_util.h" |
12 #include "base/sys_info.h" | 12 #include "base/sys_info.h" |
13 #include "chrome/browser/autocomplete/autocomplete.h" | 13 #include "chrome/browser/autocomplete/autocomplete.h" |
14 #include "chrome/browser/browser_process.h" | 14 #include "chrome/browser/browser_process.h" |
15 #include "chrome/common/env_util.h" | |
16 #include "chrome/common/logging_chrome.h" | 15 #include "chrome/common/logging_chrome.h" |
17 #include "chrome/common/pref_names.h" | 16 #include "chrome/common/pref_names.h" |
18 #include "chrome/common/pref_service.h" | 17 #include "chrome/common/pref_service.h" |
19 #include "googleurl/src/gurl.h" | 18 #include "googleurl/src/gurl.h" |
20 #include "net/base/base64.h" | 19 #include "net/base/base64.h" |
21 | 20 |
22 #define OPEN_ELEMENT_FOR_SCOPE(name) ScopedElement scoped_element(this, name) | 21 #define OPEN_ELEMENT_FOR_SCOPE(name) ScopedElement scoped_element(this, name) |
23 | 22 |
24 // libxml take xmlChar*, which is unsigned char* | 23 // libxml take xmlChar*, which is unsigned char* |
25 inline const unsigned char* UnsignedChar(const char* input) { | 24 inline const unsigned char* UnsignedChar(const char* input) { |
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
440 WriteIntAttribute("buildid", 0); // means that we're using appversion instead | 439 WriteIntAttribute("buildid", 0); // means that we're using appversion instead |
441 WriteAttribute("appversion", GetVersionString()); | 440 WriteAttribute("appversion", GetVersionString()); |
442 EndElement(); | 441 EndElement(); |
443 | 442 |
444 WritePluginList(plugin_list); | 443 WritePluginList(plugin_list); |
445 | 444 |
446 WriteStabilityElement(); | 445 WriteStabilityElement(); |
447 | 446 |
448 { | 447 { |
449 OPEN_ELEMENT_FOR_SCOPE("cpu"); | 448 OPEN_ELEMENT_FOR_SCOPE("cpu"); |
450 WriteAttribute("arch", env_util::GetCPUArchitecture()); | 449 WriteAttribute("arch", base::SysInfo::CPUArchitecture()); |
451 } | 450 } |
452 | 451 |
453 { | 452 { |
454 OPEN_ELEMENT_FOR_SCOPE("security"); | 453 OPEN_ELEMENT_FOR_SCOPE("security"); |
455 WriteIntAttribute("rendereronsboxdesktop", | 454 WriteIntAttribute("rendereronsboxdesktop", |
456 pref->GetInteger(prefs::kSecurityRendererOnSboxDesktop)); | 455 pref->GetInteger(prefs::kSecurityRendererOnSboxDesktop)); |
457 pref->SetInteger(prefs::kSecurityRendererOnSboxDesktop, 0); | 456 pref->SetInteger(prefs::kSecurityRendererOnSboxDesktop, 0); |
458 | 457 |
459 WriteIntAttribute("rendererondefaultdesktop", | 458 WriteIntAttribute("rendererondefaultdesktop", |
460 pref->GetInteger(prefs::kSecurityRendererOnDefaultDesktop)); | 459 pref->GetInteger(prefs::kSecurityRendererOnDefaultDesktop)); |
461 pref->SetInteger(prefs::kSecurityRendererOnDefaultDesktop, 0); | 460 pref->SetInteger(prefs::kSecurityRendererOnDefaultDesktop, 0); |
462 } | 461 } |
463 | 462 |
464 { | 463 { |
465 OPEN_ELEMENT_FOR_SCOPE("memory"); | 464 OPEN_ELEMENT_FOR_SCOPE("memory"); |
466 WriteIntAttribute("mb", base::SysInfo::AmountOfPhysicalMemoryMB()); | 465 WriteIntAttribute("mb", base::SysInfo::AmountOfPhysicalMemoryMB()); |
467 } | 466 } |
468 | 467 |
469 { | 468 { |
470 OPEN_ELEMENT_FOR_SCOPE("os"); | 469 OPEN_ELEMENT_FOR_SCOPE("os"); |
471 WriteAttribute("name", | 470 WriteAttribute("name", |
472 env_util::GetOperatingSystemName()); | 471 base::SysInfo::OperatingSystemName()); |
473 WriteAttribute("version", | 472 WriteAttribute("version", |
474 env_util::GetOperatingSystemVersion()); | 473 base::SysInfo::OperatingSystemVersion()); |
475 } | 474 } |
476 | 475 |
477 { | 476 { |
478 OPEN_ELEMENT_FOR_SCOPE("display"); | 477 OPEN_ELEMENT_FOR_SCOPE("display"); |
479 int width = 0; | 478 int width = 0; |
480 int height = 0; | 479 int height = 0; |
481 env_util::GetPrimaryDisplayDimensions(&width, &height); | 480 base::SysInfo::GetPrimaryDisplayDimensions(&width, &height); |
482 WriteIntAttribute("xsize", width); | 481 WriteIntAttribute("xsize", width); |
483 WriteIntAttribute("ysize", height); | 482 WriteIntAttribute("ysize", height); |
484 WriteIntAttribute("screens", env_util::GetDisplayCount()); | 483 WriteIntAttribute("screens", base::SysInfo::DisplayCount()); |
485 } | 484 } |
486 | 485 |
487 { | 486 { |
488 OPEN_ELEMENT_FOR_SCOPE("bookmarks"); | 487 OPEN_ELEMENT_FOR_SCOPE("bookmarks"); |
489 int num_bookmarks_on_bookmark_bar = | 488 int num_bookmarks_on_bookmark_bar = |
490 pref->GetInteger(prefs::kNumBookmarksOnBookmarkBar); | 489 pref->GetInteger(prefs::kNumBookmarksOnBookmarkBar); |
491 int num_folders_on_bookmark_bar = | 490 int num_folders_on_bookmark_bar = |
492 pref->GetInteger(prefs::kNumFoldersOnBookmarkBar); | 491 pref->GetInteger(prefs::kNumFoldersOnBookmarkBar); |
493 int num_bookmarks_in_other_bookmarks_folder = | 492 int num_bookmarks_in_other_bookmarks_folder = |
494 pref->GetInteger(prefs::kNumBookmarksInOtherBookmarkFolder); | 493 pref->GetInteger(prefs::kNumBookmarksInOtherBookmarkFolder); |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
638 for (size_t i = 0; i < histogram.bucket_count(); i++) { | 637 for (size_t i = 0; i < histogram.bucket_count(); i++) { |
639 if (snapshot.counts(i)) { | 638 if (snapshot.counts(i)) { |
640 OPEN_ELEMENT_FOR_SCOPE("histogrambucket"); | 639 OPEN_ELEMENT_FOR_SCOPE("histogrambucket"); |
641 WriteIntAttribute("min", histogram.ranges(i)); | 640 WriteIntAttribute("min", histogram.ranges(i)); |
642 WriteIntAttribute("max", histogram.ranges(i + 1)); | 641 WriteIntAttribute("max", histogram.ranges(i + 1)); |
643 WriteIntAttribute("count", snapshot.counts(i)); | 642 WriteIntAttribute("count", snapshot.counts(i)); |
644 } | 643 } |
645 } | 644 } |
646 } | 645 } |
647 | 646 |
OLD | NEW |