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 |
11 #include "ash/shell.h" | |
Alexei Svitkine (slow)
2014/01/28 16:01:06
Is this header valid to include on all platforms?
| |
11 #include "base/base64.h" | 12 #include "base/base64.h" |
12 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
13 #include "base/bind.h" | 14 #include "base/bind.h" |
14 #include "base/cpu.h" | 15 #include "base/cpu.h" |
15 #include "base/lazy_instance.h" | 16 #include "base/lazy_instance.h" |
16 #include "base/memory/scoped_ptr.h" | 17 #include "base/memory/scoped_ptr.h" |
17 #include "base/prefs/pref_registry_simple.h" | 18 #include "base/prefs/pref_registry_simple.h" |
18 #include "base/prefs/pref_service.h" | 19 #include "base/prefs/pref_service.h" |
19 #include "base/profiler/alternate_timer.h" | 20 #include "base/profiler/alternate_timer.h" |
20 #include "base/sha1.h" | 21 #include "base/sha1.h" |
(...skipping 22 matching lines...) Expand all Loading... | |
43 #include "chrome/common/pref_names.h" | 44 #include "chrome/common/pref_names.h" |
44 #include "chrome/installer/util/google_update_settings.h" | 45 #include "chrome/installer/util/google_update_settings.h" |
45 #include "components/nacl/common/nacl_process_type.h" | 46 #include "components/nacl/common/nacl_process_type.h" |
46 #include "content/public/browser/gpu_data_manager.h" | 47 #include "content/public/browser/gpu_data_manager.h" |
47 #include "content/public/common/content_client.h" | 48 #include "content/public/common/content_client.h" |
48 #include "content/public/common/webplugininfo.h" | 49 #include "content/public/common/webplugininfo.h" |
49 #include "device/bluetooth/bluetooth_adapter.h" | 50 #include "device/bluetooth/bluetooth_adapter.h" |
50 #include "device/bluetooth/bluetooth_adapter_factory.h" | 51 #include "device/bluetooth/bluetooth_adapter_factory.h" |
51 #include "device/bluetooth/bluetooth_device.h" | 52 #include "device/bluetooth/bluetooth_device.h" |
52 #include "gpu/config/gpu_info.h" | 53 #include "gpu/config/gpu_info.h" |
54 #include "ui/events/event_utils.h" | |
53 #include "ui/gfx/screen.h" | 55 #include "ui/gfx/screen.h" |
54 #include "url/gurl.h" | 56 #include "url/gurl.h" |
55 | 57 |
56 #if defined(OS_ANDROID) | 58 #if defined(OS_ANDROID) |
57 #include "base/android/build_info.h" | 59 #include "base/android/build_info.h" |
58 #endif | 60 #endif |
59 | 61 |
60 #if defined(OS_WIN) | 62 #if defined(OS_WIN) |
61 #include "base/win/metro.h" | 63 #include "base/win/metro.h" |
62 | 64 |
63 // http://blogs.msdn.com/oldnewthing/archive/2004/10/25/247180.aspx | 65 // http://blogs.msdn.com/oldnewthing/archive/2004/10/25/247180.aspx |
64 extern "C" IMAGE_DOS_HEADER __ImageBase; | 66 extern "C" IMAGE_DOS_HEADER __ImageBase; |
65 #endif | 67 #endif |
66 | 68 |
67 #if defined(OS_CHROMEOS) | 69 #if defined(OS_CHROMEOS) |
68 #include "chrome/browser/chromeos/login/user_manager.h" | 70 #include "chrome/browser/chromeos/login/user_manager.h" |
71 #include "ui/events/x/touch_factory_x11.h" | |
69 #endif | 72 #endif |
70 | 73 |
71 using content::GpuDataManager; | 74 using content::GpuDataManager; |
72 using metrics::OmniboxEventProto; | 75 using metrics::OmniboxEventProto; |
73 using metrics::PerfDataProto; | 76 using metrics::PerfDataProto; |
74 using metrics::ProfilerEventProto; | 77 using metrics::ProfilerEventProto; |
75 using metrics::SystemProfileProto; | 78 using metrics::SystemProfileProto; |
76 using tracked_objects::ProcessDataSnapshot; | 79 using tracked_objects::ProcessDataSnapshot; |
77 typedef chrome_variations::ActiveGroupId ActiveGroupId; | 80 typedef chrome_variations::ActiveGroupId ActiveGroupId; |
78 typedef SystemProfileProto::GoogleUpdate::ProductInfo ProductInfo; | 81 typedef SystemProfileProto::GoogleUpdate::ProductInfo ProductInfo; |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
373 return PairedDevice::DEVICE_MOUSE; | 376 return PairedDevice::DEVICE_MOUSE; |
374 case device::BluetoothDevice::DEVICE_TABLET: | 377 case device::BluetoothDevice::DEVICE_TABLET: |
375 return PairedDevice::DEVICE_TABLET; | 378 return PairedDevice::DEVICE_TABLET; |
376 case device::BluetoothDevice::DEVICE_KEYBOARD_MOUSE_COMBO: | 379 case device::BluetoothDevice::DEVICE_KEYBOARD_MOUSE_COMBO: |
377 return PairedDevice::DEVICE_KEYBOARD_MOUSE_COMBO; | 380 return PairedDevice::DEVICE_KEYBOARD_MOUSE_COMBO; |
378 } | 381 } |
379 | 382 |
380 NOTREACHED(); | 383 NOTREACHED(); |
381 return PairedDevice::DEVICE_UNKNOWN; | 384 return PairedDevice::DEVICE_UNKNOWN; |
382 } | 385 } |
386 | |
387 void WriteExternalTouchscreensProto(SystemProfileProto::Hardware* hardware) { | |
388 std::set<std::pair<int, int> > touchscreen_ids = | |
389 ui::TouchFactory::GetInstance()->GetTouchscreenIds(); | |
390 for (std::set<std::pair<int, int> >::iterator it = touchscreen_ids.begin(); | |
391 it != touchscreen_ids.end(); | |
392 ++it) { | |
393 SystemProfileProto::Hardware::TouchScreen* touchscreen = | |
394 hardware->add_external_touchscreen(); | |
395 touchscreen->set_vendor_id(it->first); | |
396 touchscreen->set_product_id(it->second); | |
397 } | |
398 } | |
383 #endif // defined(OS_CHROMEOS) | 399 #endif // defined(OS_CHROMEOS) |
384 | 400 |
385 // Round a timestamp measured in seconds since epoch to one with a granularity | 401 // 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 | 402 // of an hour. This can be used before uploaded potentially sensitive |
387 // timestamps. | 403 // timestamps. |
388 int64 RoundSecondsToHour(int64 time_in_seconds) { | 404 int64 RoundSecondsToHour(int64 time_in_seconds) { |
389 return 3600 * (time_in_seconds / 3600); | 405 return 3600 * (time_in_seconds / 3600); |
390 } | 406 } |
391 | 407 |
392 } // namespace | 408 } // namespace |
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
794 GetFieldTrialIds(&field_trial_ids); | 810 GetFieldTrialIds(&field_trial_ids); |
795 WriteFieldTrials(field_trial_ids, system_profile); | 811 WriteFieldTrials(field_trial_ids, system_profile); |
796 WriteFieldTrials(synthetic_trials, system_profile); | 812 WriteFieldTrials(synthetic_trials, system_profile); |
797 | 813 |
798 #if defined(OS_CHROMEOS) | 814 #if defined(OS_CHROMEOS) |
799 PerfDataProto perf_data_proto; | 815 PerfDataProto perf_data_proto; |
800 if (perf_provider_.GetPerfData(&perf_data_proto)) | 816 if (perf_provider_.GetPerfData(&perf_data_proto)) |
801 uma_proto()->add_perf_data()->Swap(&perf_data_proto); | 817 uma_proto()->add_perf_data()->Swap(&perf_data_proto); |
802 | 818 |
803 WriteBluetoothProto(hardware); | 819 WriteBluetoothProto(hardware); |
820 gfx::Display::TouchSupport has_touch = ui::GetInternalDisplayTouchSupport(); | |
Alexei Svitkine (slow)
2014/01/28 16:01:06
I think this ChromeOS-specific code in this class
| |
821 if (has_touch == gfx::Display::TOUCH_SUPPORT_AVAILABLE) | |
822 hardware->set_internal_display_supports_touch(true); | |
823 else if (has_touch == gfx::Display::TOUCH_SUPPORT_UNAVAILABLE) | |
824 hardware->set_internal_display_supports_touch(false); | |
825 WriteExternalTouchscreensProto(hardware); | |
804 UpdateMultiProfileUserCount(); | 826 UpdateMultiProfileUserCount(); |
805 #endif | 827 #endif |
806 | 828 |
807 std::string serialied_system_profile; | 829 std::string serialied_system_profile; |
808 std::string base64_system_profile; | 830 std::string base64_system_profile; |
809 if (system_profile->SerializeToString(&serialied_system_profile)) { | 831 if (system_profile->SerializeToString(&serialied_system_profile)) { |
810 base::Base64Encode(serialied_system_profile, &base64_system_profile); | 832 base::Base64Encode(serialied_system_profile, &base64_system_profile); |
811 PrefService* local_state = GetPrefService(); | 833 PrefService* local_state = GetPrefService(); |
812 local_state->SetString(prefs::kStabilitySavedSystemProfile, | 834 local_state->SetString(prefs::kStabilitySavedSystemProfile, |
813 base64_system_profile); | 835 base64_system_profile); |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1005 | 1027 |
1006 // We invalidate the user count if it changed while the log was open. | 1028 // We invalidate the user count if it changed while the log was open. |
1007 if (system_profile->has_multi_profile_user_count() && | 1029 if (system_profile->has_multi_profile_user_count() && |
1008 user_count != system_profile->multi_profile_user_count()) | 1030 user_count != system_profile->multi_profile_user_count()) |
1009 user_count = 0; | 1031 user_count = 0; |
1010 | 1032 |
1011 system_profile->set_multi_profile_user_count(user_count); | 1033 system_profile->set_multi_profile_user_count(user_count); |
1012 } | 1034 } |
1013 } | 1035 } |
1014 #endif | 1036 #endif |
OLD | NEW |