| 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 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 373 return PairedDevice::DEVICE_MOUSE; | 374 return PairedDevice::DEVICE_MOUSE; |
| 374 case device::BluetoothDevice::DEVICE_TABLET: | 375 case device::BluetoothDevice::DEVICE_TABLET: |
| 375 return PairedDevice::DEVICE_TABLET; | 376 return PairedDevice::DEVICE_TABLET; |
| 376 case device::BluetoothDevice::DEVICE_KEYBOARD_MOUSE_COMBO: | 377 case device::BluetoothDevice::DEVICE_KEYBOARD_MOUSE_COMBO: |
| 377 return PairedDevice::DEVICE_KEYBOARD_MOUSE_COMBO; | 378 return PairedDevice::DEVICE_KEYBOARD_MOUSE_COMBO; |
| 378 } | 379 } |
| 379 | 380 |
| 380 NOTREACHED(); | 381 NOTREACHED(); |
| 381 return PairedDevice::DEVICE_UNKNOWN; | 382 return PairedDevice::DEVICE_UNKNOWN; |
| 382 } | 383 } |
| 384 |
| 385 void WriteTouchscreensProto(SystemProfileProto::Hardware* hardware) { |
| 386 std::set<std::pair<int, int> > touchscreen_ids = |
| 387 ui::TouchFactory::GetInstance()->GetTouchscreenIds(); |
| 388 std::set<std::pair<int, int> >::iterator it; |
| 389 for (it = touchscreen_ids.begin(); it != touchscreen_ids.end(); ++it) { |
| 390 SystemProfileProto::Hardware::TouchScreen* touchscreen = |
| 391 hardware->add_external_touchscreen(); |
| 392 touchscreen->set_vendor_id(it->first); |
| 393 touchscreen->set_product_id(it->second); |
| 394 } |
| 395 } |
| 383 #endif // defined(OS_CHROMEOS) | 396 #endif // defined(OS_CHROMEOS) |
| 384 | 397 |
| 385 // Round a timestamp measured in seconds since epoch to one with a granularity | 398 // 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 | 399 // of an hour. This can be used before uploaded potentially sensitive |
| 387 // timestamps. | 400 // timestamps. |
| 388 int64 RoundSecondsToHour(int64 time_in_seconds) { | 401 int64 RoundSecondsToHour(int64 time_in_seconds) { |
| 389 return 3600 * (time_in_seconds / 3600); | 402 return 3600 * (time_in_seconds / 3600); |
| 390 } | 403 } |
| 391 | 404 |
| 392 } // namespace | 405 } // namespace |
| (...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 799 if (perf_provider_.GetPerfData(&perf_data_proto)) | 812 if (perf_provider_.GetPerfData(&perf_data_proto)) |
| 800 uma_proto()->add_perf_data()->Swap(&perf_data_proto); | 813 uma_proto()->add_perf_data()->Swap(&perf_data_proto); |
| 801 | 814 |
| 802 // BluetoothAdapterFactory::GetAdapter is synchronous on Chrome OS; if that | 815 // BluetoothAdapterFactory::GetAdapter is synchronous on Chrome OS; if that |
| 803 // changes this will fail at the DCHECK(). | 816 // changes this will fail at the DCHECK(). |
| 804 device::BluetoothAdapterFactory::GetAdapter( | 817 device::BluetoothAdapterFactory::GetAdapter( |
| 805 base::Bind(&MetricsLog::SetBluetoothAdapter, | 818 base::Bind(&MetricsLog::SetBluetoothAdapter, |
| 806 base::Unretained(this))); | 819 base::Unretained(this))); |
| 807 DCHECK(adapter_.get()); | 820 DCHECK(adapter_.get()); |
| 808 WriteBluetoothProto(hardware); | 821 WriteBluetoothProto(hardware); |
| 822 WriteTouchscreensProto(hardware); |
| 809 UpdateMultiProfileUserCount(); | 823 UpdateMultiProfileUserCount(); |
| 810 #endif | 824 #endif |
| 811 | 825 |
| 812 std::string serialied_system_profile; | 826 std::string serialied_system_profile; |
| 813 std::string base64_system_profile; | 827 std::string base64_system_profile; |
| 814 if (system_profile->SerializeToString(&serialied_system_profile)) { | 828 if (system_profile->SerializeToString(&serialied_system_profile)) { |
| 815 base::Base64Encode(serialied_system_profile, &base64_system_profile); | 829 base::Base64Encode(serialied_system_profile, &base64_system_profile); |
| 816 PrefService* local_state = GetPrefService(); | 830 PrefService* local_state = GetPrefService(); |
| 817 local_state->SetString(prefs::kStabilitySavedSystemProfile, | 831 local_state->SetString(prefs::kStabilitySavedSystemProfile, |
| 818 base64_system_profile); | 832 base64_system_profile); |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1003 | 1017 |
| 1004 // We invalidate the user count if it changed while the log was open. | 1018 // We invalidate the user count if it changed while the log was open. |
| 1005 if (system_profile->has_multi_profile_user_count() && | 1019 if (system_profile->has_multi_profile_user_count() && |
| 1006 user_count != system_profile->multi_profile_user_count()) | 1020 user_count != system_profile->multi_profile_user_count()) |
| 1007 user_count = 0; | 1021 user_count = 0; |
| 1008 | 1022 |
| 1009 system_profile->set_multi_profile_user_count(user_count); | 1023 system_profile->set_multi_profile_user_count(user_count); |
| 1010 } | 1024 } |
| 1011 } | 1025 } |
| 1012 #endif | 1026 #endif |
| OLD | NEW |