| 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_contents.h" | 5 #include "chrome/browser/prerender/prerender_contents.h" |
| 6 | 6 |
| 7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
| 8 #include "chrome/browser/background_contents_service.h" | 8 #include "chrome/browser/background_contents_service.h" |
| 9 #include "chrome/browser/browsing_instance.h" | 9 #include "chrome/browser/browsing_instance.h" |
| 10 #include "chrome/browser/prerender/prerender_manager.h" | 10 #include "chrome/browser/prerender/prerender_manager.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 #include "gfx/rect.h" | 21 #include "gfx/rect.h" |
| 22 | 22 |
| 23 PrerenderContents::PrerenderContents(PrerenderManager* prerender_manager, | 23 PrerenderContents::PrerenderContents(PrerenderManager* prerender_manager, |
| 24 Profile* profile, | 24 Profile* profile, |
| 25 const GURL& url, | 25 const GURL& url, |
| 26 const std::vector<GURL>& alias_urls) | 26 const std::vector<GURL>& alias_urls) |
| 27 : prerender_manager_(prerender_manager), | 27 : prerender_manager_(prerender_manager), |
| 28 render_view_host_(NULL), | 28 render_view_host_(NULL), |
| 29 prerender_url_(url), | 29 prerender_url_(url), |
| 30 profile_(profile), | 30 profile_(profile), |
| 31 page_id_(0) { | 31 page_id_(0), |
| 32 has_stopped_loading_(false) { |
| 32 DCHECK(prerender_manager != NULL); | 33 DCHECK(prerender_manager != NULL); |
| 33 AddAliasURL(prerender_url_); | 34 AddAliasURL(prerender_url_); |
| 34 for (std::vector<GURL>::const_iterator it = alias_urls.begin(); | 35 for (std::vector<GURL>::const_iterator it = alias_urls.begin(); |
| 35 it != alias_urls.end(); | 36 it != alias_urls.end(); |
| 36 ++it) { | 37 ++it) { |
| 37 AddAliasURL(*it); | 38 AddAliasURL(*it); |
| 38 } | 39 } |
| 39 } | 40 } |
| 40 | 41 |
| 41 void PrerenderContents::StartPrerendering() { | 42 void PrerenderContents::StartPrerendering() { |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 } | 259 } |
| 259 | 260 |
| 260 void PrerenderContents::AddAliasURL(const GURL& url) { | 261 void PrerenderContents::AddAliasURL(const GURL& url) { |
| 261 alias_urls_.push_back(url); | 262 alias_urls_.push_back(url); |
| 262 } | 263 } |
| 263 | 264 |
| 264 bool PrerenderContents::MatchesURL(const GURL& url) const { | 265 bool PrerenderContents::MatchesURL(const GURL& url) const { |
| 265 return std::find(alias_urls_.begin(), alias_urls_.end(), url) | 266 return std::find(alias_urls_.begin(), alias_urls_.end(), url) |
| 266 != alias_urls_.end(); | 267 != alias_urls_.end(); |
| 267 } | 268 } |
| 269 |
| 270 void PrerenderContents::DidStopLoading() { |
| 271 has_stopped_loading_ = true; |
| 272 } |
| OLD | NEW |