| 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 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 794 GetFieldTrialIds(&field_trial_ids); | 809 GetFieldTrialIds(&field_trial_ids); |
| 795 WriteFieldTrials(field_trial_ids, system_profile); | 810 WriteFieldTrials(field_trial_ids, system_profile); |
| 796 WriteFieldTrials(synthetic_trials, system_profile); | 811 WriteFieldTrials(synthetic_trials, system_profile); |
| 797 | 812 |
| 798 #if defined(OS_CHROMEOS) | 813 #if defined(OS_CHROMEOS) |
| 799 PerfDataProto perf_data_proto; | 814 PerfDataProto perf_data_proto; |
| 800 if (perf_provider_.GetPerfData(&perf_data_proto)) | 815 if (perf_provider_.GetPerfData(&perf_data_proto)) |
| 801 uma_proto()->add_perf_data()->Swap(&perf_data_proto); | 816 uma_proto()->add_perf_data()->Swap(&perf_data_proto); |
| 802 | 817 |
| 803 WriteBluetoothProto(hardware); | 818 WriteBluetoothProto(hardware); |
| 819 hardware->set_internal_display_supports_touch( |
| 820 ui::InternalDisplaySupportsTouch()); |
| 821 WriteExternalTouchscreensProto(hardware); |
| 804 UpdateMultiProfileUserCount(); | 822 UpdateMultiProfileUserCount(); |
| 805 #endif | 823 #endif |
| 806 | 824 |
| 807 std::string serialied_system_profile; | 825 std::string serialied_system_profile; |
| 808 std::string base64_system_profile; | 826 std::string base64_system_profile; |
| 809 if (system_profile->SerializeToString(&serialied_system_profile)) { | 827 if (system_profile->SerializeToString(&serialied_system_profile)) { |
| 810 base::Base64Encode(serialied_system_profile, &base64_system_profile); | 828 base::Base64Encode(serialied_system_profile, &base64_system_profile); |
| 811 PrefService* local_state = GetPrefService(); | 829 PrefService* local_state = GetPrefService(); |
| 812 local_state->SetString(prefs::kStabilitySavedSystemProfile, | 830 local_state->SetString(prefs::kStabilitySavedSystemProfile, |
| 813 base64_system_profile); | 831 base64_system_profile); |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1005 | 1023 |
| 1006 // We invalidate the user count if it changed while the log was open. | 1024 // We invalidate the user count if it changed while the log was open. |
| 1007 if (system_profile->has_multi_profile_user_count() && | 1025 if (system_profile->has_multi_profile_user_count() && |
| 1008 user_count != system_profile->multi_profile_user_count()) | 1026 user_count != system_profile->multi_profile_user_count()) |
| 1009 user_count = 0; | 1027 user_count = 0; |
| 1010 | 1028 |
| 1011 system_profile->set_multi_profile_user_count(user_count); | 1029 system_profile->set_multi_profile_user_count(user_count); |
| 1012 } | 1030 } |
| 1013 } | 1031 } |
| 1014 #endif | 1032 #endif |
| OLD | NEW |