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 <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 #include "chrome/browser/autocomplete/autocomplete_log.h" | 24 #include "chrome/browser/autocomplete/autocomplete_log.h" |
25 #include "chrome/browser/autocomplete/autocomplete_match.h" | 25 #include "chrome/browser/autocomplete/autocomplete_match.h" |
26 #include "chrome/browser/autocomplete/autocomplete_provider.h" | 26 #include "chrome/browser/autocomplete/autocomplete_provider.h" |
27 #include "chrome/browser/autocomplete/autocomplete_result.h" | 27 #include "chrome/browser/autocomplete/autocomplete_result.h" |
28 #include "chrome/browser/browser_process.h" | 28 #include "chrome/browser/browser_process.h" |
29 #include "chrome/browser/plugin_prefs.h" | 29 #include "chrome/browser/plugin_prefs.h" |
30 #include "chrome/browser/prefs/pref_service.h" | 30 #include "chrome/browser/prefs/pref_service.h" |
31 #include "chrome/browser/profiles/profile_manager.h" | 31 #include "chrome/browser/profiles/profile_manager.h" |
32 #include "chrome/common/chrome_version_info.h" | 32 #include "chrome/common/chrome_version_info.h" |
33 #include "chrome/common/logging_chrome.h" | 33 #include "chrome/common/logging_chrome.h" |
34 #include "chrome/common/metrics/experiments_helper.h" | |
35 #include "chrome/common/metrics/proto/omnibox_event.pb.h" | 34 #include "chrome/common/metrics/proto/omnibox_event.pb.h" |
36 #include "chrome/common/metrics/proto/profiler_event.pb.h" | 35 #include "chrome/common/metrics/proto/profiler_event.pb.h" |
37 #include "chrome/common/metrics/proto/system_profile.pb.h" | 36 #include "chrome/common/metrics/proto/system_profile.pb.h" |
| 37 #include "chrome/common/metrics/variations_util.h" |
38 #include "chrome/common/pref_names.h" | 38 #include "chrome/common/pref_names.h" |
39 #include "chrome/installer/util/google_update_settings.h" | 39 #include "chrome/installer/util/google_update_settings.h" |
40 #include "content/public/browser/content_browser_client.h" | 40 #include "content/public/browser/content_browser_client.h" |
41 #include "content/public/browser/gpu_data_manager.h" | 41 #include "content/public/browser/gpu_data_manager.h" |
42 #include "content/public/common/content_client.h" | 42 #include "content/public/common/content_client.h" |
43 #include "content/public/common/gpu_info.h" | 43 #include "content/public/common/gpu_info.h" |
44 #include "googleurl/src/gurl.h" | 44 #include "googleurl/src/gurl.h" |
45 #include "ui/gfx/screen.h" | 45 #include "ui/gfx/screen.h" |
46 #include "webkit/plugins/webplugininfo.h" | 46 #include "webkit/plugins/webplugininfo.h" |
47 | 47 |
48 #define OPEN_ELEMENT_FOR_SCOPE(name) ScopedElement scoped_element(this, name) | 48 #define OPEN_ELEMENT_FOR_SCOPE(name) ScopedElement scoped_element(this, name) |
49 | 49 |
50 #if defined(OS_WIN) | 50 #if defined(OS_WIN) |
51 #include "base/win/metro.h" | 51 #include "base/win/metro.h" |
52 | 52 |
53 // http://blogs.msdn.com/oldnewthing/archive/2004/10/25/247180.aspx | 53 // http://blogs.msdn.com/oldnewthing/archive/2004/10/25/247180.aspx |
54 extern "C" IMAGE_DOS_HEADER __ImageBase; | 54 extern "C" IMAGE_DOS_HEADER __ImageBase; |
55 #endif | 55 #endif |
56 | 56 |
57 using content::GpuDataManager; | 57 using content::GpuDataManager; |
58 using metrics::OmniboxEventProto; | 58 using metrics::OmniboxEventProto; |
59 using metrics::ProfilerEventProto; | 59 using metrics::ProfilerEventProto; |
60 using metrics::SystemProfileProto; | 60 using metrics::SystemProfileProto; |
61 using tracked_objects::ProcessDataSnapshot; | 61 using tracked_objects::ProcessDataSnapshot; |
62 typedef experiments_helper::SelectedGroupId SelectedGroupId; | 62 typedef chrome_variations::SelectedGroupId SelectedGroupId; |
63 typedef SystemProfileProto::GoogleUpdate::ProductInfo ProductInfo; | 63 typedef SystemProfileProto::GoogleUpdate::ProductInfo ProductInfo; |
64 | 64 |
65 namespace { | 65 namespace { |
66 | 66 |
67 // Returns the date at which the current metrics client ID was created as | 67 // Returns the date at which the current metrics client ID was created as |
68 // a string containing milliseconds since the epoch, or "0" if none was found. | 68 // a string containing milliseconds since the epoch, or "0" if none was found. |
69 std::string GetInstallDate(PrefService* pref) { | 69 std::string GetInstallDate(PrefService* pref) { |
70 if (!pref) { | 70 if (!pref) { |
71 NOTREACHED(); | 71 NOTREACHED(); |
72 return "0"; | 72 return "0"; |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 gfx::Size MetricsLog::GetScreenSize() const { | 342 gfx::Size MetricsLog::GetScreenSize() const { |
343 return gfx::Screen::GetPrimaryDisplay().GetSizeInPixel(); | 343 return gfx::Screen::GetPrimaryDisplay().GetSizeInPixel(); |
344 } | 344 } |
345 | 345 |
346 int MetricsLog::GetScreenCount() const { | 346 int MetricsLog::GetScreenCount() const { |
347 return gfx::Screen::GetNumDisplays(); | 347 return gfx::Screen::GetNumDisplays(); |
348 } | 348 } |
349 | 349 |
350 void MetricsLog::GetFieldTrialIds( | 350 void MetricsLog::GetFieldTrialIds( |
351 std::vector<SelectedGroupId>* field_trial_ids) const { | 351 std::vector<SelectedGroupId>* field_trial_ids) const { |
352 experiments_helper::GetFieldTrialSelectedGroupIds(field_trial_ids); | 352 chrome_variations::GetFieldTrialSelectedGroupIds(field_trial_ids); |
353 } | 353 } |
354 | 354 |
355 void MetricsLog::WriteStabilityElement( | 355 void MetricsLog::WriteStabilityElement( |
356 const std::vector<webkit::WebPluginInfo>& plugin_list, | 356 const std::vector<webkit::WebPluginInfo>& plugin_list, |
357 PrefService* pref) { | 357 PrefService* pref) { |
358 DCHECK(!locked()); | 358 DCHECK(!locked()); |
359 | 359 |
360 // Get stability attributes out of Local State, zeroing out stored values. | 360 // Get stability attributes out of Local State, zeroing out stored values. |
361 // NOTE: This could lead to some data loss if this report isn't successfully | 361 // NOTE: This could lead to some data loss if this report isn't successfully |
362 // sent, but that's true for all the metrics. | 362 // sent, but that's true for all the metrics. |
(...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1000 ProductDataToProto(google_update_metrics.google_update_data, | 1000 ProductDataToProto(google_update_metrics.google_update_data, |
1001 google_update->mutable_google_update_status()); | 1001 google_update->mutable_google_update_status()); |
1002 } | 1002 } |
1003 | 1003 |
1004 if (!google_update_metrics.product_data.version.empty()) { | 1004 if (!google_update_metrics.product_data.version.empty()) { |
1005 ProductDataToProto(google_update_metrics.product_data, | 1005 ProductDataToProto(google_update_metrics.product_data, |
1006 google_update->mutable_client_status()); | 1006 google_update->mutable_client_status()); |
1007 } | 1007 } |
1008 #endif // defined(GOOGLE_CHROME_BUILD) && defined(OS_WIN) | 1008 #endif // defined(GOOGLE_CHROME_BUILD) && defined(OS_WIN) |
1009 } | 1009 } |
OLD | NEW |