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" | |
54 #include "ui/gfx/screen.h" | 53 #include "ui/gfx/screen.h" |
55 #include "url/gurl.h" | 54 #include "url/gurl.h" |
56 | 55 |
57 #if defined(OS_ANDROID) | 56 #if defined(OS_ANDROID) |
58 #include "base/android/build_info.h" | 57 #include "base/android/build_info.h" |
59 #endif | 58 #endif |
60 | 59 |
61 #if defined(OS_WIN) | 60 #if defined(OS_WIN) |
62 #include "base/win/metro.h" | 61 #include "base/win/metro.h" |
63 | 62 |
64 // http://blogs.msdn.com/oldnewthing/archive/2004/10/25/247180.aspx | 63 // http://blogs.msdn.com/oldnewthing/archive/2004/10/25/247180.aspx |
65 extern "C" IMAGE_DOS_HEADER __ImageBase; | 64 extern "C" IMAGE_DOS_HEADER __ImageBase; |
66 #endif | 65 #endif |
67 | 66 |
68 #if defined(OS_CHROMEOS) | 67 #if defined(OS_CHROMEOS) |
69 #include "chrome/browser/chromeos/login/user_manager.h" | 68 #include "chrome/browser/chromeos/login/user_manager.h" |
70 #include "ui/events/x/touch_factory_x11.h" | |
71 #endif | 69 #endif |
72 | 70 |
73 using content::GpuDataManager; | 71 using content::GpuDataManager; |
74 using metrics::OmniboxEventProto; | 72 using metrics::OmniboxEventProto; |
75 using metrics::PerfDataProto; | 73 using metrics::PerfDataProto; |
76 using metrics::ProfilerEventProto; | 74 using metrics::ProfilerEventProto; |
77 using metrics::SystemProfileProto; | 75 using metrics::SystemProfileProto; |
78 using tracked_objects::ProcessDataSnapshot; | 76 using tracked_objects::ProcessDataSnapshot; |
79 typedef chrome_variations::ActiveGroupId ActiveGroupId; | 77 typedef chrome_variations::ActiveGroupId ActiveGroupId; |
80 typedef SystemProfileProto::GoogleUpdate::ProductInfo ProductInfo; | 78 typedef SystemProfileProto::GoogleUpdate::ProductInfo ProductInfo; |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
375 return PairedDevice::DEVICE_MOUSE; | 373 return PairedDevice::DEVICE_MOUSE; |
376 case device::BluetoothDevice::DEVICE_TABLET: | 374 case device::BluetoothDevice::DEVICE_TABLET: |
377 return PairedDevice::DEVICE_TABLET; | 375 return PairedDevice::DEVICE_TABLET; |
378 case device::BluetoothDevice::DEVICE_KEYBOARD_MOUSE_COMBO: | 376 case device::BluetoothDevice::DEVICE_KEYBOARD_MOUSE_COMBO: |
379 return PairedDevice::DEVICE_KEYBOARD_MOUSE_COMBO; | 377 return PairedDevice::DEVICE_KEYBOARD_MOUSE_COMBO; |
380 } | 378 } |
381 | 379 |
382 NOTREACHED(); | 380 NOTREACHED(); |
383 return PairedDevice::DEVICE_UNKNOWN; | 381 return PairedDevice::DEVICE_UNKNOWN; |
384 } | 382 } |
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 } | |
398 #endif // defined(OS_CHROMEOS) | 383 #endif // defined(OS_CHROMEOS) |
399 | 384 |
400 // Round a timestamp measured in seconds since epoch to one with a granularity | 385 // Round a timestamp measured in seconds since epoch to one with a granularity |
401 // of an hour. This can be used before uploaded potentially sensitive | 386 // of an hour. This can be used before uploaded potentially sensitive |
402 // timestamps. | 387 // timestamps. |
403 int64 RoundSecondsToHour(int64 time_in_seconds) { | 388 int64 RoundSecondsToHour(int64 time_in_seconds) { |
404 return 3600 * (time_in_seconds / 3600); | 389 return 3600 * (time_in_seconds / 3600); |
405 } | 390 } |
406 | 391 |
407 } // namespace | 392 } // namespace |
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
809 GetFieldTrialIds(&field_trial_ids); | 794 GetFieldTrialIds(&field_trial_ids); |
810 WriteFieldTrials(field_trial_ids, system_profile); | 795 WriteFieldTrials(field_trial_ids, system_profile); |
811 WriteFieldTrials(synthetic_trials, system_profile); | 796 WriteFieldTrials(synthetic_trials, system_profile); |
812 | 797 |
813 #if defined(OS_CHROMEOS) | 798 #if defined(OS_CHROMEOS) |
814 PerfDataProto perf_data_proto; | 799 PerfDataProto perf_data_proto; |
815 if (perf_provider_.GetPerfData(&perf_data_proto)) | 800 if (perf_provider_.GetPerfData(&perf_data_proto)) |
816 uma_proto()->add_perf_data()->Swap(&perf_data_proto); | 801 uma_proto()->add_perf_data()->Swap(&perf_data_proto); |
817 | 802 |
818 WriteBluetoothProto(hardware); | 803 WriteBluetoothProto(hardware); |
819 hardware->set_internal_display_supports_touch( | |
820 ui::InternalDisplaySupportsTouch()); | |
821 WriteExternalTouchscreensProto(hardware); | |
822 UpdateMultiProfileUserCount(); | 804 UpdateMultiProfileUserCount(); |
823 #endif | 805 #endif |
824 | 806 |
825 std::string serialied_system_profile; | 807 std::string serialied_system_profile; |
826 std::string base64_system_profile; | 808 std::string base64_system_profile; |
827 if (system_profile->SerializeToString(&serialied_system_profile)) { | 809 if (system_profile->SerializeToString(&serialied_system_profile)) { |
828 base::Base64Encode(serialied_system_profile, &base64_system_profile); | 810 base::Base64Encode(serialied_system_profile, &base64_system_profile); |
829 PrefService* local_state = GetPrefService(); | 811 PrefService* local_state = GetPrefService(); |
830 local_state->SetString(prefs::kStabilitySavedSystemProfile, | 812 local_state->SetString(prefs::kStabilitySavedSystemProfile, |
831 base64_system_profile); | 813 base64_system_profile); |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1023 | 1005 |
1024 // We invalidate the user count if it changed while the log was open. | 1006 // We invalidate the user count if it changed while the log was open. |
1025 if (system_profile->has_multi_profile_user_count() && | 1007 if (system_profile->has_multi_profile_user_count() && |
1026 user_count != system_profile->multi_profile_user_count()) | 1008 user_count != system_profile->multi_profile_user_count()) |
1027 user_count = 0; | 1009 user_count = 0; |
1028 | 1010 |
1029 system_profile->set_multi_profile_user_count(user_count); | 1011 system_profile->set_multi_profile_user_count(user_count); |
1030 } | 1012 } |
1031 } | 1013 } |
1032 #endif | 1014 #endif |
OLD | NEW |