| 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 | 59 |
| 60 #if defined(OS_WIN) | 60 #if defined(OS_WIN) |
| 61 #include "base/win/metro.h" | 61 #include "base/win/metro.h" |
| 62 | 62 |
| 63 // http://blogs.msdn.com/oldnewthing/archive/2004/10/25/247180.aspx | 63 // http://blogs.msdn.com/oldnewthing/archive/2004/10/25/247180.aspx |
| 64 extern "C" IMAGE_DOS_HEADER __ImageBase; | 64 extern "C" IMAGE_DOS_HEADER __ImageBase; |
| 65 #endif | 65 #endif |
| 66 | 66 |
| 67 #if defined(OS_CHROMEOS) | 67 #if defined(OS_CHROMEOS) |
| 68 #include "chrome/browser/chromeos/login/user_manager.h" | 68 #include "chrome/browser/chromeos/login/user_manager.h" |
| 69 #include "ui/events/x/touch_factory_x11.h" |
| 69 #endif | 70 #endif |
| 70 | 71 |
| 71 using content::GpuDataManager; | 72 using content::GpuDataManager; |
| 72 using metrics::OmniboxEventProto; | 73 using metrics::OmniboxEventProto; |
| 73 using metrics::PerfDataProto; | 74 using metrics::PerfDataProto; |
| 74 using metrics::ProfilerEventProto; | 75 using metrics::ProfilerEventProto; |
| 75 using metrics::SystemProfileProto; | 76 using metrics::SystemProfileProto; |
| 76 using tracked_objects::ProcessDataSnapshot; | 77 using tracked_objects::ProcessDataSnapshot; |
| 77 typedef chrome_variations::ActiveGroupId ActiveGroupId; | 78 typedef chrome_variations::ActiveGroupId ActiveGroupId; |
| 78 typedef SystemProfileProto::GoogleUpdate::ProductInfo ProductInfo; | 79 typedef SystemProfileProto::GoogleUpdate::ProductInfo ProductInfo; |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 365 return PairedDevice::DEVICE_MOUSE; | 366 return PairedDevice::DEVICE_MOUSE; |
| 366 case device::BluetoothDevice::DEVICE_TABLET: | 367 case device::BluetoothDevice::DEVICE_TABLET: |
| 367 return PairedDevice::DEVICE_TABLET; | 368 return PairedDevice::DEVICE_TABLET; |
| 368 case device::BluetoothDevice::DEVICE_KEYBOARD_MOUSE_COMBO: | 369 case device::BluetoothDevice::DEVICE_KEYBOARD_MOUSE_COMBO: |
| 369 return PairedDevice::DEVICE_KEYBOARD_MOUSE_COMBO; | 370 return PairedDevice::DEVICE_KEYBOARD_MOUSE_COMBO; |
| 370 } | 371 } |
| 371 | 372 |
| 372 NOTREACHED(); | 373 NOTREACHED(); |
| 373 return PairedDevice::DEVICE_UNKNOWN; | 374 return PairedDevice::DEVICE_UNKNOWN; |
| 374 } | 375 } |
| 376 |
| 377 void WriteTouchscreensProto(SystemProfileProto::Hardware* hardware) { |
| 378 std::set<std::pair<int, int> > touchscreen_ids = |
| 379 ui::TouchFactory::GetInstance()->GetTouchscreenIds(); |
| 380 std::set<std::pair<int, int> >::iterator it; |
| 381 for (it = touchscreen_ids.begin(); it != touchscreen_ids.end(); ++it) { |
| 382 SystemProfileProto::Hardware::TouchScreen* touchscreen = |
| 383 hardware->add_external_touchscreen(); |
| 384 touchscreen->set_vendor_id(it->first); |
| 385 touchscreen->set_product_id(it->second); |
| 386 } |
| 387 } |
| 375 #endif // defined(OS_CHROMEOS) | 388 #endif // defined(OS_CHROMEOS) |
| 376 | 389 |
| 377 // Round a timestamp measured in seconds since epoch to one with a granularity | 390 // Round a timestamp measured in seconds since epoch to one with a granularity |
| 378 // of an hour. This can be used before uploaded potentially sensitive | 391 // of an hour. This can be used before uploaded potentially sensitive |
| 379 // timestamps. | 392 // timestamps. |
| 380 int64 RoundSecondsToHour(int64 time_in_seconds) { | 393 int64 RoundSecondsToHour(int64 time_in_seconds) { |
| 381 return 3600 * (time_in_seconds / 3600); | 394 return 3600 * (time_in_seconds / 3600); |
| 382 } | 395 } |
| 383 | 396 |
| 384 } // namespace | 397 } // namespace |
| (...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 791 if (perf_provider_.GetPerfData(&perf_data_proto)) | 804 if (perf_provider_.GetPerfData(&perf_data_proto)) |
| 792 uma_proto()->add_perf_data()->Swap(&perf_data_proto); | 805 uma_proto()->add_perf_data()->Swap(&perf_data_proto); |
| 793 | 806 |
| 794 // BluetoothAdapterFactory::GetAdapter is synchronous on Chrome OS; if that | 807 // BluetoothAdapterFactory::GetAdapter is synchronous on Chrome OS; if that |
| 795 // changes this will fail at the DCHECK(). | 808 // changes this will fail at the DCHECK(). |
| 796 device::BluetoothAdapterFactory::GetAdapter( | 809 device::BluetoothAdapterFactory::GetAdapter( |
| 797 base::Bind(&MetricsLog::SetBluetoothAdapter, | 810 base::Bind(&MetricsLog::SetBluetoothAdapter, |
| 798 base::Unretained(this))); | 811 base::Unretained(this))); |
| 799 DCHECK(adapter_.get()); | 812 DCHECK(adapter_.get()); |
| 800 WriteBluetoothProto(hardware); | 813 WriteBluetoothProto(hardware); |
| 814 WriteTouchscreensProto(hardware); |
| 801 UpdateMultiProfileUserCount(); | 815 UpdateMultiProfileUserCount(); |
| 802 #endif | 816 #endif |
| 803 | 817 |
| 804 std::string serialied_system_profile; | 818 std::string serialied_system_profile; |
| 805 std::string base64_system_profile; | 819 std::string base64_system_profile; |
| 806 if (system_profile->SerializeToString(&serialied_system_profile)) { | 820 if (system_profile->SerializeToString(&serialied_system_profile)) { |
| 807 base::Base64Encode(serialied_system_profile, &base64_system_profile); | 821 base::Base64Encode(serialied_system_profile, &base64_system_profile); |
| 808 PrefService* local_state = GetPrefService(); | 822 PrefService* local_state = GetPrefService(); |
| 809 local_state->SetString(prefs::kStabilitySavedSystemProfile, | 823 local_state->SetString(prefs::kStabilitySavedSystemProfile, |
| 810 base64_system_profile); | 824 base64_system_profile); |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 995 | 1009 |
| 996 // We invalidate the user count if it changed while the log was open. | 1010 // We invalidate the user count if it changed while the log was open. |
| 997 if (system_profile->has_multi_profile_user_count() && | 1011 if (system_profile->has_multi_profile_user_count() && |
| 998 user_count != system_profile->multi_profile_user_count()) | 1012 user_count != system_profile->multi_profile_user_count()) |
| 999 user_count = 0; | 1013 user_count = 0; |
| 1000 | 1014 |
| 1001 system_profile->set_multi_profile_user_count(user_count); | 1015 system_profile->set_multi_profile_user_count(user_count); |
| 1002 } | 1016 } |
| 1003 } | 1017 } |
| 1004 #endif | 1018 #endif |
| OLD | NEW |