| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/ui/webui/ntp/ntp_user_data_logger.h" | 5 #include "chrome/browser/ui/webui/ntp/ntp_user_data_logger.h" |
| 6 | 6 |
| 7 #include "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
| 8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "base/time/time.h" |
| 10 #include "chrome/browser/search/most_visited_iframe_source.h" | 11 #include "chrome/browser/search/most_visited_iframe_source.h" |
| 11 #include "chrome/browser/search/search.h" | 12 #include "chrome/browser/search/search.h" |
| 12 #include "chrome/common/search_urls.h" | 13 #include "chrome/common/search_urls.h" |
| 13 #include "chrome/common/url_constants.h" | 14 #include "chrome/common/url_constants.h" |
| 14 #include "content/public/browser/navigation_details.h" | 15 #include "content/public/browser/navigation_details.h" |
| 15 #include "content/public/browser/navigation_entry.h" | 16 #include "content/public/browser/navigation_entry.h" |
| 16 #include "content/public/browser/user_metrics.h" | 17 #include "content/public/browser/user_metrics.h" |
| 17 #include "content/public/browser/web_contents.h" | 18 #include "content/public/browser/web_contents.h" |
| 18 | 19 |
| 19 // Macro to log UMA statistics related to the 8 tiles shown on the NTP. | 20 // Macro to log UMA statistics related to the 8 tiles shown on the NTP. |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 number_of_thumbnail_errors_ = 0; | 121 number_of_thumbnail_errors_ = 0; |
| 121 UMA_HISTOGRAM_NTP_TILES("NewTabPage.NumberOfGrayTileFallbacks", | 122 UMA_HISTOGRAM_NTP_TILES("NewTabPage.NumberOfGrayTileFallbacks", |
| 122 number_of_gray_tile_fallbacks_); | 123 number_of_gray_tile_fallbacks_); |
| 123 number_of_gray_tile_fallbacks_ = 0; | 124 number_of_gray_tile_fallbacks_ = 0; |
| 124 UMA_HISTOGRAM_NTP_TILES("NewTabPage.NumberOfExternalTileFallbacks", | 125 UMA_HISTOGRAM_NTP_TILES("NewTabPage.NumberOfExternalTileFallbacks", |
| 125 number_of_external_tile_fallbacks_); | 126 number_of_external_tile_fallbacks_); |
| 126 number_of_external_tile_fallbacks_ = 0; | 127 number_of_external_tile_fallbacks_ = 0; |
| 127 } | 128 } |
| 128 } | 129 } |
| 129 | 130 |
| 130 void NTPUserDataLogger::LogEvent(NTPLoggingEventType event) { | 131 void NTPUserDataLogger::LogEvent(NTPLoggingEventType event, int64 time) { |
| 131 switch (event) { | 132 switch (event) { |
| 132 case NTP_SERVER_SIDE_SUGGESTION: | 133 case NTP_SERVER_SIDE_SUGGESTION: |
| 133 has_server_side_suggestions_ = true; | 134 has_server_side_suggestions_ = true; |
| 134 break; | 135 break; |
| 135 case NTP_CLIENT_SIDE_SUGGESTION: | 136 case NTP_CLIENT_SIDE_SUGGESTION: |
| 136 // We should never get a mix of server and client side suggestions, | 137 // We should never get a mix of server and client side suggestions, |
| 137 // otherwise there could be a race condition depending on the order in | 138 // otherwise there could be a race condition depending on the order in |
| 138 // which the iframes call this method. | 139 // which the iframes call this method. |
| 139 DCHECK(!has_server_side_suggestions_); | 140 DCHECK(!has_server_side_suggestions_); |
| 140 break; | 141 break; |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 NTPUserDataLogger::NTPUserDataLogger(content::WebContents* contents) | 230 NTPUserDataLogger::NTPUserDataLogger(content::WebContents* contents) |
| 230 : content::WebContentsObserver(contents), | 231 : content::WebContentsObserver(contents), |
| 231 has_server_side_suggestions_(false), | 232 has_server_side_suggestions_(false), |
| 232 number_of_tiles_(0), | 233 number_of_tiles_(0), |
| 233 number_of_thumbnail_tiles_(0), | 234 number_of_thumbnail_tiles_(0), |
| 234 number_of_gray_tiles_(0), | 235 number_of_gray_tiles_(0), |
| 235 number_of_external_tiles_(0), | 236 number_of_external_tiles_(0), |
| 236 number_of_thumbnail_errors_(0), | 237 number_of_thumbnail_errors_(0), |
| 237 number_of_gray_tile_fallbacks_(0), | 238 number_of_gray_tile_fallbacks_(0), |
| 238 number_of_external_tile_fallbacks_(0), | 239 number_of_external_tile_fallbacks_(0), |
| 239 number_of_mouseovers_(0) { | 240 number_of_mouseovers_(0), |
| 241 load_time_(0) { |
| 240 } | 242 } |
| OLD | NEW |