| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/prerender/prerender_tab_helper.h" | 5 #include "chrome/browser/prerender/prerender_tab_helper.h" |
| 6 | 6 |
| 7 #include "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
| 8 #include "base/string_number_conversions.h" | 8 #include "base/string_number_conversions.h" |
| 9 #include "base/time.h" | 9 #include "base/time.h" |
| 10 #include "chrome/browser/prerender/prerender_manager.h" | 10 #include "chrome/browser/prerender/prerender_manager.h" |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 | 218 |
| 219 // Reset the PPLT metric. | 219 // Reset the PPLT metric. |
| 220 pplt_load_start_ = base::TimeTicks(); | 220 pplt_load_start_ = base::TimeTicks(); |
| 221 } | 221 } |
| 222 | 222 |
| 223 void PrerenderTabHelper::DidStartProvisionalLoadForFrame( | 223 void PrerenderTabHelper::DidStartProvisionalLoadForFrame( |
| 224 int64 frame_id, | 224 int64 frame_id, |
| 225 bool is_main_frame, | 225 bool is_main_frame, |
| 226 const GURL& validated_url, | 226 const GURL& validated_url, |
| 227 bool is_error_page, | 227 bool is_error_page, |
| 228 RenderViewHost* render_view_host) { | 228 content::RenderViewHost* render_view_host) { |
| 229 if (is_main_frame) { | 229 if (is_main_frame) { |
| 230 RecordPageviewEvent(PAGEVIEW_EVENT_LOAD_START); | 230 RecordPageviewEvent(PAGEVIEW_EVENT_LOAD_START); |
| 231 if (IsTopSite(validated_url)) | 231 if (IsTopSite(validated_url)) |
| 232 RecordPageviewEvent(PAGEVIEW_EVENT_TOP_SITE_LOAD_START); | 232 RecordPageviewEvent(PAGEVIEW_EVENT_TOP_SITE_LOAD_START); |
| 233 | 233 |
| 234 // Record the beginning of a new PPLT navigation. | 234 // Record the beginning of a new PPLT navigation. |
| 235 pplt_load_start_ = base::TimeTicks::Now(); | 235 pplt_load_start_ = base::TimeTicks::Now(); |
| 236 | 236 |
| 237 // Update hover stats. | 237 // Update hover stats. |
| 238 for (int i = 0; i < kNumHoverThresholds; i++) | 238 for (int i = 0; i < kNumHoverThresholds; i++) |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 | 302 |
| 303 current_hover_url_ = GURL(); | 303 current_hover_url_ = GURL(); |
| 304 } | 304 } |
| 305 | 305 |
| 306 bool PrerenderTabHelper::IsTopSite(const GURL& url) { | 306 bool PrerenderTabHelper::IsTopSite(const GURL& url) { |
| 307 PrerenderManager* pm = MaybeGetPrerenderManager(); | 307 PrerenderManager* pm = MaybeGetPrerenderManager(); |
| 308 return (pm && pm->IsTopSite(url)); | 308 return (pm && pm->IsTopSite(url)); |
| 309 } | 309 } |
| 310 | 310 |
| 311 } // namespace prerender | 311 } // namespace prerender |
| OLD | NEW |