Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_manager.h" | 5 #include "chrome/browser/prerender/prerender_manager.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | |
| 7 #include "base/logging.h" | 8 #include "base/logging.h" |
| 8 #include "base/time.h" | 9 #include "base/time.h" |
| 9 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| 10 #include "chrome/browser/prerender/prerender_contents.h" | 11 #include "chrome/browser/prerender/prerender_contents.h" |
| 11 #include "chrome/browser/renderer_host/render_view_host.h" | 12 #include "chrome/browser/renderer_host/render_view_host.h" |
| 12 #include "chrome/browser/tab_contents/tab_contents.h" | 13 #include "chrome/browser/tab_contents/tab_contents.h" |
| 13 #include "chrome/browser/tab_contents/render_view_host_manager.h" | 14 #include "chrome/browser/tab_contents/render_view_host_manager.h" |
| 15 #include "chrome/common/chrome_switches.h" | |
| 14 #include "chrome/common/render_messages.h" | 16 #include "chrome/common/render_messages.h" |
| 15 | 17 |
| 18 // static | |
| 19 PrerenderManager::SessionType PrerenderManager::GetSessionType() { | |
| 20 if (CommandLine::ForCurrentProcess()->HasSwitch( | |
| 21 switches::kEnablePagePrerender)) | |
|
jar (doing other things)
2011/01/26 21:31:32
nit: (I think) indent only 4 spaces from previous
gavinp
2011/01/27 04:29:29
jar & I followed up on this: brettw said that inde
| |
| 22 return PRERENDERING_ON; | |
| 23 return PRERENDERING_OFF; | |
| 24 } | |
| 25 | |
| 16 struct PrerenderManager::PrerenderContentsData { | 26 struct PrerenderManager::PrerenderContentsData { |
| 17 PrerenderContents* contents_; | 27 PrerenderContents* contents_; |
| 18 base::Time start_time_; | 28 base::Time start_time_; |
| 19 GURL url_; | 29 GURL url_; |
| 20 PrerenderContentsData(PrerenderContents* contents, | 30 PrerenderContentsData(PrerenderContents* contents, |
| 21 base::Time start_time, | 31 base::Time start_time, |
| 22 GURL url) | 32 GURL url) |
| 23 : contents_(contents), | 33 : contents_(contents), |
| 24 start_time_(start_time), | 34 start_time_(start_time), |
| 25 url_(url) { | 35 url_(url) { |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 132 bool PrerenderManager::IsPrerenderElementFresh(const base::Time start) const { | 142 bool PrerenderManager::IsPrerenderElementFresh(const base::Time start) const { |
| 133 base::Time now = GetCurrentTime(); | 143 base::Time now = GetCurrentTime(); |
| 134 return (now - start < max_prerender_age_); | 144 return (now - start < max_prerender_age_); |
| 135 } | 145 } |
| 136 | 146 |
| 137 PrerenderContents* PrerenderManager::CreatePrerenderContents( | 147 PrerenderContents* PrerenderManager::CreatePrerenderContents( |
| 138 const GURL& url, | 148 const GURL& url, |
| 139 const std::vector<GURL>& alias_urls) { | 149 const std::vector<GURL>& alias_urls) { |
| 140 return new PrerenderContents(this, profile_, url, alias_urls); | 150 return new PrerenderContents(this, profile_, url, alias_urls); |
| 141 } | 151 } |
| OLD | NEW |