Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(510)

Side by Side Diff: chrome/browser/metrics/metrics_log.cc

Issue 103893005: Include external touchscreen vid/pid in UMA hardware profile (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address sadrul's comments, add is_touchscreen_present. Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
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 ui::TouchFactory* touch_factory = ui::TouchFactory::GetInstance();
387
388 hardware->set_is_touchscreen_present(touch_factory->IsTouchDevicePresent());
389
390 std::set<std::pair<int, int> > touchscreen_ids =
391 touch_factory->GetTouchscreenIds();
392 std::set<std::pair<int, int> >::iterator it;
Ilya Sherman 2013/12/12 22:49:43 nit: Please declare this within the scope of the f
tdresser 2013/12/13 15:29:00 Done.
393 for (it = touchscreen_ids.begin(); it != touchscreen_ids.end(); ++it) {
394 SystemProfileProto::Hardware::TouchScreen* touchscreen =
395 hardware->add_external_touchscreen();
396 touchscreen->set_vendor_id(it->first);
397 touchscreen->set_product_id(it->second);
398 }
399 }
383 #endif // defined(OS_CHROMEOS) 400 #endif // defined(OS_CHROMEOS)
384 401
385 // Round a timestamp measured in seconds since epoch to one with a granularity 402 // 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 403 // of an hour. This can be used before uploaded potentially sensitive
387 // timestamps. 404 // timestamps.
388 int64 RoundSecondsToHour(int64 time_in_seconds) { 405 int64 RoundSecondsToHour(int64 time_in_seconds) {
389 return 3600 * (time_in_seconds / 3600); 406 return 3600 * (time_in_seconds / 3600);
390 } 407 }
391 408
392 } // namespace 409 } // namespace
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
799 if (perf_provider_.GetPerfData(&perf_data_proto)) 816 if (perf_provider_.GetPerfData(&perf_data_proto))
800 uma_proto()->add_perf_data()->Swap(&perf_data_proto); 817 uma_proto()->add_perf_data()->Swap(&perf_data_proto);
801 818
802 // BluetoothAdapterFactory::GetAdapter is synchronous on Chrome OS; if that 819 // BluetoothAdapterFactory::GetAdapter is synchronous on Chrome OS; if that
803 // changes this will fail at the DCHECK(). 820 // changes this will fail at the DCHECK().
804 device::BluetoothAdapterFactory::GetAdapter( 821 device::BluetoothAdapterFactory::GetAdapter(
805 base::Bind(&MetricsLog::SetBluetoothAdapter, 822 base::Bind(&MetricsLog::SetBluetoothAdapter,
806 base::Unretained(this))); 823 base::Unretained(this)));
807 DCHECK(adapter_.get()); 824 DCHECK(adapter_.get());
808 WriteBluetoothProto(hardware); 825 WriteBluetoothProto(hardware);
826 WriteTouchscreensProto(hardware);
809 UpdateMultiProfileUserCount(); 827 UpdateMultiProfileUserCount();
810 #endif 828 #endif
811 829
812 std::string serialied_system_profile; 830 std::string serialied_system_profile;
813 std::string base64_system_profile; 831 std::string base64_system_profile;
814 if (system_profile->SerializeToString(&serialied_system_profile)) { 832 if (system_profile->SerializeToString(&serialied_system_profile)) {
815 base::Base64Encode(serialied_system_profile, &base64_system_profile); 833 base::Base64Encode(serialied_system_profile, &base64_system_profile);
816 PrefService* local_state = GetPrefService(); 834 PrefService* local_state = GetPrefService();
817 local_state->SetString(prefs::kStabilitySavedSystemProfile, 835 local_state->SetString(prefs::kStabilitySavedSystemProfile,
818 base64_system_profile); 836 base64_system_profile);
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
1003 1021
1004 // We invalidate the user count if it changed while the log was open. 1022 // We invalidate the user count if it changed while the log was open.
1005 if (system_profile->has_multi_profile_user_count() && 1023 if (system_profile->has_multi_profile_user_count() &&
1006 user_count != system_profile->multi_profile_user_count()) 1024 user_count != system_profile->multi_profile_user_count())
1007 user_count = 0; 1025 user_count = 0;
1008 1026
1009 system_profile->set_multi_profile_user_count(user_count); 1027 system_profile->set_multi_profile_user_count(user_count);
1010 } 1028 }
1011 } 1029 }
1012 #endif 1030 #endif
OLDNEW
« no previous file with comments | « no previous file | chrome/common/metrics/proto/system_profile.proto » ('j') | chrome/common/metrics/proto/system_profile.proto » ('J')

Powered by Google App Engine
This is Rietveld 408576698