| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 #include "chrome/common/pref_names.h" | 43 #include "chrome/common/pref_names.h" |
| 44 #include "chrome/installer/util/google_update_settings.h" | 44 #include "chrome/installer/util/google_update_settings.h" |
| 45 #include "components/nacl/common/nacl_process_type.h" | 45 #include "components/nacl/common/nacl_process_type.h" |
| 46 #include "content/public/browser/gpu_data_manager.h" | 46 #include "content/public/browser/gpu_data_manager.h" |
| 47 #include "content/public/common/content_client.h" | 47 #include "content/public/common/content_client.h" |
| 48 #include "content/public/common/webplugininfo.h" | 48 #include "content/public/common/webplugininfo.h" |
| 49 #include "device/bluetooth/bluetooth_adapter.h" | 49 #include "device/bluetooth/bluetooth_adapter.h" |
| 50 #include "device/bluetooth/bluetooth_adapter_factory.h" | 50 #include "device/bluetooth/bluetooth_adapter_factory.h" |
| 51 #include "device/bluetooth/bluetooth_device.h" | 51 #include "device/bluetooth/bluetooth_device.h" |
| 52 #include "gpu/config/gpu_info.h" | 52 #include "gpu/config/gpu_info.h" |
| 53 #include "ui/events/event_utils.h" |
| 53 #include "ui/gfx/screen.h" | 54 #include "ui/gfx/screen.h" |
| 54 #include "url/gurl.h" | 55 #include "url/gurl.h" |
| 55 | 56 |
| 56 #if defined(OS_ANDROID) | 57 #if defined(OS_ANDROID) |
| 57 #include "base/android/build_info.h" | 58 #include "base/android/build_info.h" |
| 58 #endif | 59 #endif |
| 59 | 60 |
| 60 #if defined(OS_WIN) | 61 #if defined(OS_WIN) |
| 61 #include "base/win/metro.h" | 62 #include "base/win/metro.h" |
| 62 | 63 |
| 63 // http://blogs.msdn.com/oldnewthing/archive/2004/10/25/247180.aspx | 64 // http://blogs.msdn.com/oldnewthing/archive/2004/10/25/247180.aspx |
| 64 extern "C" IMAGE_DOS_HEADER __ImageBase; | 65 extern "C" IMAGE_DOS_HEADER __ImageBase; |
| 65 #endif | 66 #endif |
| 66 | 67 |
| 67 #if defined(OS_CHROMEOS) | 68 #if defined(OS_CHROMEOS) |
| 68 #include "chrome/browser/chromeos/login/user_manager.h" | 69 #include "chrome/browser/chromeos/login/user_manager.h" |
| 70 #include "ui/events/x/touch_factory_x11.h" |
| 69 #endif | 71 #endif |
| 70 | 72 |
| 71 using content::GpuDataManager; | 73 using content::GpuDataManager; |
| 72 using metrics::OmniboxEventProto; | 74 using metrics::OmniboxEventProto; |
| 73 using metrics::PerfDataProto; | 75 using metrics::PerfDataProto; |
| 74 using metrics::ProfilerEventProto; | 76 using metrics::ProfilerEventProto; |
| 75 using metrics::SystemProfileProto; | 77 using metrics::SystemProfileProto; |
| 76 using tracked_objects::ProcessDataSnapshot; | 78 using tracked_objects::ProcessDataSnapshot; |
| 77 typedef chrome_variations::ActiveGroupId ActiveGroupId; | 79 typedef chrome_variations::ActiveGroupId ActiveGroupId; |
| 78 typedef SystemProfileProto::GoogleUpdate::ProductInfo ProductInfo; | 80 typedef SystemProfileProto::GoogleUpdate::ProductInfo ProductInfo; |
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 373 return PairedDevice::DEVICE_MOUSE; | 375 return PairedDevice::DEVICE_MOUSE; |
| 374 case device::BluetoothDevice::DEVICE_TABLET: | 376 case device::BluetoothDevice::DEVICE_TABLET: |
| 375 return PairedDevice::DEVICE_TABLET; | 377 return PairedDevice::DEVICE_TABLET; |
| 376 case device::BluetoothDevice::DEVICE_KEYBOARD_MOUSE_COMBO: | 378 case device::BluetoothDevice::DEVICE_KEYBOARD_MOUSE_COMBO: |
| 377 return PairedDevice::DEVICE_KEYBOARD_MOUSE_COMBO; | 379 return PairedDevice::DEVICE_KEYBOARD_MOUSE_COMBO; |
| 378 } | 380 } |
| 379 | 381 |
| 380 NOTREACHED(); | 382 NOTREACHED(); |
| 381 return PairedDevice::DEVICE_UNKNOWN; | 383 return PairedDevice::DEVICE_UNKNOWN; |
| 382 } | 384 } |
| 385 |
| 386 void WriteExternalTouchscreensProto(SystemProfileProto::Hardware* hardware) { |
| 387 std::set<std::pair<int, int> > touchscreen_ids = |
| 388 ui::TouchFactory::GetInstance()->GetTouchscreenIds(); |
| 389 for (std::set<std::pair<int, int> >::iterator it = touchscreen_ids.begin(); |
| 390 it != touchscreen_ids.end(); |
| 391 ++it) { |
| 392 SystemProfileProto::Hardware::TouchScreen* touchscreen = |
| 393 hardware->add_external_touchscreen(); |
| 394 touchscreen->set_vendor_id(it->first); |
| 395 touchscreen->set_product_id(it->second); |
| 396 } |
| 397 } |
| 383 #endif // defined(OS_CHROMEOS) | 398 #endif // defined(OS_CHROMEOS) |
| 384 | 399 |
| 385 // Round a timestamp measured in seconds since epoch to one with a granularity | 400 // Round a timestamp measured in seconds since epoch to one with a granularity |
| 386 // of an hour. This can be used before uploaded potentially sensitive | 401 // of an hour. This can be used before uploaded potentially sensitive |
| 387 // timestamps. | 402 // timestamps. |
| 388 int64 RoundSecondsToHour(int64 time_in_seconds) { | 403 int64 RoundSecondsToHour(int64 time_in_seconds) { |
| 389 return 3600 * (time_in_seconds / 3600); | 404 return 3600 * (time_in_seconds / 3600); |
| 390 } | 405 } |
| 391 | 406 |
| 392 } // namespace | 407 } // namespace |
| (...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 799 if (perf_provider_.GetPerfData(&perf_data_proto)) | 814 if (perf_provider_.GetPerfData(&perf_data_proto)) |
| 800 uma_proto()->add_perf_data()->Swap(&perf_data_proto); | 815 uma_proto()->add_perf_data()->Swap(&perf_data_proto); |
| 801 | 816 |
| 802 // BluetoothAdapterFactory::GetAdapter is synchronous on Chrome OS; if that | 817 // BluetoothAdapterFactory::GetAdapter is synchronous on Chrome OS; if that |
| 803 // changes this will fail at the DCHECK(). | 818 // changes this will fail at the DCHECK(). |
| 804 device::BluetoothAdapterFactory::GetAdapter( | 819 device::BluetoothAdapterFactory::GetAdapter( |
| 805 base::Bind(&MetricsLog::SetBluetoothAdapter, | 820 base::Bind(&MetricsLog::SetBluetoothAdapter, |
| 806 base::Unretained(this))); | 821 base::Unretained(this))); |
| 807 DCHECK(adapter_.get()); | 822 DCHECK(adapter_.get()); |
| 808 WriteBluetoothProto(hardware); | 823 WriteBluetoothProto(hardware); |
| 824 hardware->set_internal_display_supports_touch( |
| 825 ui::InternalDisplaySupportsTouch()); |
| 826 WriteExternalTouchscreensProto(hardware); |
| 809 UpdateMultiProfileUserCount(); | 827 UpdateMultiProfileUserCount(); |
| 810 #endif | 828 #endif |
| 811 | 829 |
| 812 std::string serialied_system_profile; | 830 std::string serialied_system_profile; |
| 813 std::string base64_system_profile; | 831 std::string base64_system_profile; |
| 814 if (system_profile->SerializeToString(&serialied_system_profile)) { | 832 if (system_profile->SerializeToString(&serialied_system_profile)) { |
| 815 base::Base64Encode(serialied_system_profile, &base64_system_profile); | 833 base::Base64Encode(serialied_system_profile, &base64_system_profile); |
| 816 PrefService* local_state = GetPrefService(); | 834 PrefService* local_state = GetPrefService(); |
| 817 local_state->SetString(prefs::kStabilitySavedSystemProfile, | 835 local_state->SetString(prefs::kStabilitySavedSystemProfile, |
| 818 base64_system_profile); | 836 base64_system_profile); |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1003 | 1021 |
| 1004 // We invalidate the user count if it changed while the log was open. | 1022 // We invalidate the user count if it changed while the log was open. |
| 1005 if (system_profile->has_multi_profile_user_count() && | 1023 if (system_profile->has_multi_profile_user_count() && |
| 1006 user_count != system_profile->multi_profile_user_count()) | 1024 user_count != system_profile->multi_profile_user_count()) |
| 1007 user_count = 0; | 1025 user_count = 0; |
| 1008 | 1026 |
| 1009 system_profile->set_multi_profile_user_count(user_count); | 1027 system_profile->set_multi_profile_user_count(user_count); |
| 1010 } | 1028 } |
| 1011 } | 1029 } |
| 1012 #endif | 1030 #endif |
| OLD | NEW |