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

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

Issue 25364002: Add multi_profile_user_count field to system_profile proto. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 2 months 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
« no previous file with comments | « chrome/browser/metrics/metrics_log.h ('k') | chrome/browser/metrics/metrics_log_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 #include "base/android/build_info.h" 55 #include "base/android/build_info.h"
56 #endif 56 #endif
57 57
58 #if defined(OS_WIN) 58 #if defined(OS_WIN)
59 #include "base/win/metro.h" 59 #include "base/win/metro.h"
60 60
61 // http://blogs.msdn.com/oldnewthing/archive/2004/10/25/247180.aspx 61 // http://blogs.msdn.com/oldnewthing/archive/2004/10/25/247180.aspx
62 extern "C" IMAGE_DOS_HEADER __ImageBase; 62 extern "C" IMAGE_DOS_HEADER __ImageBase;
63 #endif 63 #endif
64 64
65 #if defined(OS_CHROMEOS)
66 #include "chrome/browser/chromeos/login/user_manager.h"
67 #endif
68
65 using content::GpuDataManager; 69 using content::GpuDataManager;
66 using metrics::OmniboxEventProto; 70 using metrics::OmniboxEventProto;
67 using metrics::PerfDataProto; 71 using metrics::PerfDataProto;
68 using metrics::ProfilerEventProto; 72 using metrics::ProfilerEventProto;
69 using metrics::SystemProfileProto; 73 using metrics::SystemProfileProto;
70 using tracked_objects::ProcessDataSnapshot; 74 using tracked_objects::ProcessDataSnapshot;
71 typedef chrome_variations::ActiveGroupId ActiveGroupId; 75 typedef chrome_variations::ActiveGroupId ActiveGroupId;
72 typedef SystemProfileProto::GoogleUpdate::ProductInfo ProductInfo; 76 typedef SystemProfileProto::GoogleUpdate::ProductInfo ProductInfo;
73 typedef SystemProfileProto::Hardware::Bluetooth::PairedDevice PairedDevice; 77 typedef SystemProfileProto::Hardware::Bluetooth::PairedDevice PairedDevice;
74 78
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 } // namespace 376 } // namespace
373 377
374 GoogleUpdateMetrics::GoogleUpdateMetrics() : is_system_install(false) {} 378 GoogleUpdateMetrics::GoogleUpdateMetrics() : is_system_install(false) {}
375 379
376 GoogleUpdateMetrics::~GoogleUpdateMetrics() {} 380 GoogleUpdateMetrics::~GoogleUpdateMetrics() {}
377 381
378 static base::LazyInstance<std::string>::Leaky 382 static base::LazyInstance<std::string>::Leaky
379 g_version_extension = LAZY_INSTANCE_INITIALIZER; 383 g_version_extension = LAZY_INSTANCE_INITIALIZER;
380 384
381 MetricsLog::MetricsLog(const std::string& client_id, int session_id) 385 MetricsLog::MetricsLog(const std::string& client_id, int session_id)
382 : MetricsLogBase(client_id, session_id, MetricsLog::GetVersionString()) {} 386 : MetricsLogBase(client_id, session_id, MetricsLog::GetVersionString()) {
387 #if defined(OS_CHROMEOS)
388 UpdateMultiProfileUserCount();
389 #endif
390 }
383 391
384 MetricsLog::~MetricsLog() {} 392 MetricsLog::~MetricsLog() {}
385 393
386 // static 394 // static
387 void MetricsLog::RegisterPrefs(PrefRegistrySimple* registry) { 395 void MetricsLog::RegisterPrefs(PrefRegistrySimple* registry) {
388 registry->RegisterListPref(prefs::kStabilityPluginStats); 396 registry->RegisterListPref(prefs::kStabilityPluginStats);
389 } 397 }
390 398
391 // static 399 // static
392 int64 MetricsLog::GetIncrementalUptime(PrefService* pref) { 400 int64 MetricsLog::GetIncrementalUptime(PrefService* pref) {
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after
792 if (perf_provider_.GetPerfData(&perf_data_proto)) 800 if (perf_provider_.GetPerfData(&perf_data_proto))
793 uma_proto()->add_perf_data()->Swap(&perf_data_proto); 801 uma_proto()->add_perf_data()->Swap(&perf_data_proto);
794 802
795 // BluetoothAdapterFactory::GetAdapter is synchronous on Chrome OS; if that 803 // BluetoothAdapterFactory::GetAdapter is synchronous on Chrome OS; if that
796 // changes this will fail at the DCHECK(). 804 // changes this will fail at the DCHECK().
797 device::BluetoothAdapterFactory::GetAdapter( 805 device::BluetoothAdapterFactory::GetAdapter(
798 base::Bind(&MetricsLog::SetBluetoothAdapter, 806 base::Bind(&MetricsLog::SetBluetoothAdapter,
799 base::Unretained(this))); 807 base::Unretained(this)));
800 DCHECK(adapter_.get()); 808 DCHECK(adapter_.get());
801 WriteBluetoothProto(hardware); 809 WriteBluetoothProto(hardware);
810 UpdateMultiProfileUserCount();
802 #endif 811 #endif
803 } 812 }
804 813
805 void MetricsLog::RecordProfilerData( 814 void MetricsLog::RecordProfilerData(
806 const tracked_objects::ProcessDataSnapshot& process_data, 815 const tracked_objects::ProcessDataSnapshot& process_data,
807 int process_type) { 816 int process_type) {
808 DCHECK(!locked()); 817 DCHECK(!locked());
809 818
810 if (tracked_objects::GetTimeSourceType() != 819 if (tracked_objects::GetTimeSourceType() !=
811 tracked_objects::TIME_SOURCE_TYPE_WALL_TIME) { 820 tracked_objects::TIME_SOURCE_TYPE_WALL_TIME) {
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
947 956
948 paired_device->set_vendor_prefix(vendor_prefix); 957 paired_device->set_vendor_prefix(vendor_prefix);
949 } 958 }
950 959
951 paired_device->set_vendor_id(device->GetVendorID()); 960 paired_device->set_vendor_id(device->GetVendorID());
952 paired_device->set_product_id(device->GetProductID()); 961 paired_device->set_product_id(device->GetProductID());
953 paired_device->set_device_id(device->GetDeviceID()); 962 paired_device->set_device_id(device->GetDeviceID());
954 } 963 }
955 #endif // defined(OS_CHROMEOS) 964 #endif // defined(OS_CHROMEOS)
956 } 965 }
966
967 #if defined(OS_CHROMEOS)
968 void MetricsLog::UpdateMultiProfileUserCount() {
969 if (chromeos::UserManager::IsInitialized() &&
970 chromeos::UserManager::Get()->IsMultipleProfilesAllowed()) {
971 uint32 user_count = chromeos::UserManager::Get()
972 ->GetLoggedInUsers().size();
973 SystemProfileProto* system_profile = uma_proto()->mutable_system_profile();
974
975 // We invalidate the user count if it changed while the log was open.
976 if (system_profile->has_multi_profile_user_count() &&
977 user_count != system_profile->multi_profile_user_count())
978 user_count = 0;
979
980 system_profile->set_multi_profile_user_count(user_count);
981 }
982 }
983 #endif
OLDNEW
« no previous file with comments | « chrome/browser/metrics/metrics_log.h ('k') | chrome/browser/metrics/metrics_log_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698