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 <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 #include "content/public/browser/content_browser_client.h" | 40 #include "content/public/browser/content_browser_client.h" |
41 #include "content/public/browser/gpu_data_manager.h" | 41 #include "content/public/browser/gpu_data_manager.h" |
42 #include "content/public/common/content_client.h" | 42 #include "content/public/common/content_client.h" |
43 #include "content/public/common/gpu_info.h" | 43 #include "content/public/common/gpu_info.h" |
44 #include "googleurl/src/gurl.h" | 44 #include "googleurl/src/gurl.h" |
45 #include "ui/gfx/screen.h" | 45 #include "ui/gfx/screen.h" |
46 #include "webkit/plugins/webplugininfo.h" | 46 #include "webkit/plugins/webplugininfo.h" |
47 | 47 |
48 #define OPEN_ELEMENT_FOR_SCOPE(name) ScopedElement scoped_element(this, name) | 48 #define OPEN_ELEMENT_FOR_SCOPE(name) ScopedElement scoped_element(this, name) |
49 | 49 |
| 50 #if defined(OS_WIN) |
| 51 #include "base/win/metro.h" |
| 52 |
50 // http://blogs.msdn.com/oldnewthing/archive/2004/10/25/247180.aspx | 53 // http://blogs.msdn.com/oldnewthing/archive/2004/10/25/247180.aspx |
51 #if defined(OS_WIN) | |
52 extern "C" IMAGE_DOS_HEADER __ImageBase; | 54 extern "C" IMAGE_DOS_HEADER __ImageBase; |
53 #endif | 55 #endif |
54 | 56 |
55 using content::GpuDataManager; | 57 using content::GpuDataManager; |
56 using metrics::OmniboxEventProto; | 58 using metrics::OmniboxEventProto; |
57 using metrics::ProfilerEventProto; | 59 using metrics::ProfilerEventProto; |
58 using metrics::SystemProfileProto; | 60 using metrics::SystemProfileProto; |
59 using tracked_objects::ProcessDataSnapshot; | 61 using tracked_objects::ProcessDataSnapshot; |
60 typedef experiments_helper::SelectedGroupId SelectedGroupId; | 62 typedef experiments_helper::SelectedGroupId SelectedGroupId; |
61 typedef SystemProfileProto::GoogleUpdate::ProductInfo ProductInfo; | 63 typedef SystemProfileProto::GoogleUpdate::ProductInfo ProductInfo; |
(...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
749 content::GetContentClient()->browser()->GetApplicationLocale()); | 751 content::GetContentClient()->browser()->GetApplicationLocale()); |
750 | 752 |
751 SystemProfileProto::Hardware* hardware = system_profile->mutable_hardware(); | 753 SystemProfileProto::Hardware* hardware = system_profile->mutable_hardware(); |
752 hardware->set_cpu_architecture(base::SysInfo::CPUArchitecture()); | 754 hardware->set_cpu_architecture(base::SysInfo::CPUArchitecture()); |
753 hardware->set_system_ram_mb(base::SysInfo::AmountOfPhysicalMemoryMB()); | 755 hardware->set_system_ram_mb(base::SysInfo::AmountOfPhysicalMemoryMB()); |
754 #if defined(OS_WIN) | 756 #if defined(OS_WIN) |
755 hardware->set_dll_base(reinterpret_cast<uint64>(&__ImageBase)); | 757 hardware->set_dll_base(reinterpret_cast<uint64>(&__ImageBase)); |
756 #endif | 758 #endif |
757 | 759 |
758 SystemProfileProto::OS* os = system_profile->mutable_os(); | 760 SystemProfileProto::OS* os = system_profile->mutable_os(); |
759 os->set_name(base::SysInfo::OperatingSystemName()); | 761 std::string os_name = base::SysInfo::OperatingSystemName(); |
| 762 #if defined(OS_WIN) |
| 763 // TODO(mad): This only checks whether the main process is a Metro process at |
| 764 // upload time; not whether the collected metrics were all gathered from |
| 765 // Metro. This is ok as an approximation for now, since users will rarely be |
| 766 // switching from Metro to Desktop mode; but we should re-evaluate whether we |
| 767 // can distinguish metrics more cleanly in the future: http://crbug.com/140568 |
| 768 if (base::win::IsMetroProcess()) |
| 769 os_name += " (Metro)"; |
| 770 #endif |
| 771 os->set_name(os_name); |
760 os->set_version(base::SysInfo::OperatingSystemVersion()); | 772 os->set_version(base::SysInfo::OperatingSystemVersion()); |
761 | 773 |
762 const content::GPUInfo& gpu_info = | 774 const content::GPUInfo& gpu_info = |
763 GpuDataManager::GetInstance()->GetGPUInfo(); | 775 GpuDataManager::GetInstance()->GetGPUInfo(); |
764 SystemProfileProto::Hardware::Graphics* gpu = hardware->mutable_gpu(); | 776 SystemProfileProto::Hardware::Graphics* gpu = hardware->mutable_gpu(); |
765 gpu->set_vendor_id(gpu_info.gpu.vendor_id); | 777 gpu->set_vendor_id(gpu_info.gpu.vendor_id); |
766 gpu->set_device_id(gpu_info.gpu.device_id); | 778 gpu->set_device_id(gpu_info.gpu.device_id); |
767 gpu->set_driver_version(gpu_info.driver_version); | 779 gpu->set_driver_version(gpu_info.driver_version); |
768 gpu->set_driver_date(gpu_info.driver_date); | 780 gpu->set_driver_date(gpu_info.driver_date); |
769 SystemProfileProto::Hardware::Graphics::PerformanceStatistics* | 781 SystemProfileProto::Hardware::Graphics::PerformanceStatistics* |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
988 ProductDataToProto(google_update_metrics.google_update_data, | 1000 ProductDataToProto(google_update_metrics.google_update_data, |
989 google_update->mutable_google_update_status()); | 1001 google_update->mutable_google_update_status()); |
990 } | 1002 } |
991 | 1003 |
992 if (!google_update_metrics.product_data.version.empty()) { | 1004 if (!google_update_metrics.product_data.version.empty()) { |
993 ProductDataToProto(google_update_metrics.product_data, | 1005 ProductDataToProto(google_update_metrics.product_data, |
994 google_update->mutable_client_status()); | 1006 google_update->mutable_client_status()); |
995 } | 1007 } |
996 #endif // defined(GOOGLE_CHROME_BUILD) && defined(OS_WIN) | 1008 #endif // defined(GOOGLE_CHROME_BUILD) && defined(OS_WIN) |
997 } | 1009 } |
OLD | NEW |