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/prerender/prerender_contents.h" | 5 #include "chrome/browser/prerender/prerender_contents.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <functional> |
8 #include <utility> | 9 #include <utility> |
9 | 10 |
10 #include "base/process_util.h" | 11 #include "base/process_util.h" |
11 #include "base/utf_string_conversions.h" | 12 #include "base/utf_string_conversions.h" |
12 #include "chrome/browser/history/history_tab_helper.h" | 13 #include "chrome/browser/history/history_tab_helper.h" |
13 #include "chrome/browser/history/history_types.h" | 14 #include "chrome/browser/history/history_types.h" |
14 #include "chrome/browser/prerender/prerender_final_status.h" | 15 #include "chrome/browser/prerender/prerender_final_status.h" |
| 16 #include "chrome/browser/prerender/prerender_handle.h" |
15 #include "chrome/browser/prerender/prerender_manager.h" | 17 #include "chrome/browser/prerender/prerender_manager.h" |
16 #include "chrome/browser/prerender/prerender_render_view_host_observer.h" | 18 #include "chrome/browser/prerender/prerender_render_view_host_observer.h" |
17 #include "chrome/browser/prerender/prerender_tracker.h" | 19 #include "chrome/browser/prerender/prerender_tracker.h" |
18 #include "chrome/browser/profiles/profile.h" | 20 #include "chrome/browser/profiles/profile.h" |
19 #include "chrome/browser/ui/tab_contents/tab_contents.h" | 21 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
20 #include "chrome/common/chrome_notification_types.h" | 22 #include "chrome/common/chrome_notification_types.h" |
21 #include "chrome/common/icon_messages.h" | 23 #include "chrome/common/icon_messages.h" |
22 #include "chrome/common/prerender_messages.h" | 24 #include "chrome/common/prerender_messages.h" |
23 #include "chrome/common/url_constants.h" | 25 #include "chrome/common/url_constants.h" |
24 #include "content/public/browser/resource_request_details.h" | 26 #include "content/public/browser/resource_request_details.h" |
25 #include "content/public/browser/browser_child_process_host.h" | 27 #include "content/public/browser/browser_child_process_host.h" |
26 #include "content/public/browser/notification_service.h" | 28 #include "content/public/browser/notification_service.h" |
27 #include "content/public/browser/render_process_host.h" | 29 #include "content/public/browser/render_process_host.h" |
28 #include "content/public/browser/render_view_host.h" | 30 #include "content/public/browser/render_view_host.h" |
| 31 #include "content/public/browser/session_storage_namespace.h" |
29 #include "content/public/browser/web_contents.h" | 32 #include "content/public/browser/web_contents.h" |
30 #include "content/public/browser/web_contents_delegate.h" | 33 #include "content/public/browser/web_contents_delegate.h" |
31 #include "content/public/browser/web_contents_view.h" | 34 #include "content/public/browser/web_contents_view.h" |
32 #include "ui/gfx/rect.h" | 35 #include "ui/gfx/rect.h" |
33 | 36 |
34 using content::DownloadItem; | 37 using content::DownloadItem; |
35 using content::OpenURLParams; | 38 using content::OpenURLParams; |
36 using content::RenderViewHost; | 39 using content::RenderViewHost; |
37 using content::ResourceRedirectDetails; | 40 using content::ResourceRedirectDetails; |
| 41 using content::SessionStorageNamespace; |
38 using content::WebContents; | 42 using content::WebContents; |
39 | 43 |
40 namespace prerender { | 44 namespace prerender { |
41 | 45 |
42 namespace { | 46 namespace { |
43 | 47 |
44 // Compares URLs ignoring any ref for the purposes of matching URLs when | |
45 // prerendering. | |
46 struct PrerenderURLPredicate { | |
47 explicit PrerenderURLPredicate(const GURL& url) | |
48 : url_(url) { | |
49 } | |
50 | |
51 bool operator()(const GURL& url) const { | |
52 return url.scheme() == url_.scheme() && | |
53 url.host() == url_.host() && | |
54 url.port() == url_.port() && | |
55 url.path() == url_.path() && | |
56 url.query() == url_.query(); | |
57 } | |
58 GURL url_; | |
59 }; | |
60 | |
61 // Tells the render process at |child_id| whether |url| is a new prerendered | 48 // Tells the render process at |child_id| whether |url| is a new prerendered |
62 // page, or whether |url| is being removed as a prerendered page. Currently | 49 // page, or whether |url| is being removed as a prerendered page. Currently |
63 // this will only inform the render process that created the prerendered page | 50 // this will only inform the render process that created the prerendered page |
64 // with <link rel="prerender"> tags about it. This means that if the user | 51 // with <link rel="prerender"> tags about it. This means that if the user |
65 // clicks on a link for a prerendered URL in a different page, the prerender | 52 // clicks on a link for a prerendered URL in a different page, the prerender |
66 // will not be swapped in. | 53 // will not be swapped in. |
67 void InformRenderProcessAboutPrerender(const GURL& url, | 54 void InformRenderProcessAboutPrerender(const GURL& url, |
68 bool is_add, | 55 bool is_add, |
69 int child_id) { | 56 int child_id) { |
70 if (child_id < 0) | 57 if (child_id < 0) |
(...skipping 16 matching lines...) Expand all Loading... |
87 public: | 74 public: |
88 virtual PrerenderContents* CreatePrerenderContents( | 75 virtual PrerenderContents* CreatePrerenderContents( |
89 PrerenderManager* prerender_manager, PrerenderTracker* prerender_tracker, | 76 PrerenderManager* prerender_manager, PrerenderTracker* prerender_tracker, |
90 Profile* profile, const GURL& url, const content::Referrer& referrer, | 77 Profile* profile, const GURL& url, const content::Referrer& referrer, |
91 Origin origin, uint8 experiment_id) OVERRIDE { | 78 Origin origin, uint8 experiment_id) OVERRIDE { |
92 return new PrerenderContents(prerender_manager, prerender_tracker, profile, | 79 return new PrerenderContents(prerender_manager, prerender_tracker, profile, |
93 url, referrer, origin, experiment_id); | 80 url, referrer, origin, experiment_id); |
94 } | 81 } |
95 }; | 82 }; |
96 | 83 |
97 struct PrerenderContents::PendingPrerenderInfo { | |
98 PendingPrerenderInfo(const GURL& url, | |
99 const content::Referrer& referrer, | |
100 const gfx::Size& size); | |
101 const GURL url; | |
102 const content::Referrer referrer; | |
103 const gfx::Size size; | |
104 }; | |
105 | |
106 PrerenderContents::PendingPrerenderInfo::PendingPrerenderInfo( | |
107 const GURL& url, | |
108 const content::Referrer& referrer, | |
109 const gfx::Size& size) | |
110 : url(url), | |
111 referrer(referrer), | |
112 size(size) { | |
113 } | |
114 | |
115 // TabContentsDelegateImpl ----------------------------------------------------- | 84 // TabContentsDelegateImpl ----------------------------------------------------- |
116 | 85 |
117 class PrerenderContents::TabContentsDelegateImpl | 86 class PrerenderContents::TabContentsDelegateImpl |
118 : public content::WebContentsDelegate { | 87 : public content::WebContentsDelegate { |
119 public: | 88 public: |
120 explicit TabContentsDelegateImpl(PrerenderContents* prerender_contents) : | 89 explicit TabContentsDelegateImpl(PrerenderContents* prerender_contents) : |
121 prerender_contents_(prerender_contents) { | 90 prerender_contents_(prerender_contents) { |
122 } | 91 } |
123 | 92 |
124 // content::WebContentsDelegate implementation: | 93 // content::WebContentsDelegate implementation: |
125 virtual WebContents* OpenURLFromTab(WebContents* source, | 94 virtual WebContents* OpenURLFromTab(WebContents* source, |
126 const OpenURLParams& params) OVERRIDE { | 95 const OpenURLParams& params) OVERRIDE { |
127 // |OpenURLFromTab| is typically called when a frame performs a navigation | 96 // |OpenURLFromTab| is typically called when a frame performs a navigation |
128 // that requires the browser to perform the transition instead of WebKit. | 97 // that requires the browser to perform the transition instead of WebKit. |
129 // Examples include prerendering a site that redirects to an app URL, | 98 // Examples include prerendering a site that redirects to an app URL, |
130 // or if --enable-strict-site-isolation is specified and the prerendered | 99 // or if --enable-strict-site-isolation is specified and the prerendered |
131 // frame redirects to a different origin. | 100 // frame redirects to a different origin. |
132 // TODO(cbentzel): Consider supporting this if it is a common case during | 101 // TODO(cbentzel): Consider supporting this if it is a common case during |
133 // prerenders. | 102 // prerenders. |
134 prerender_contents_->Destroy(FINAL_STATUS_OPEN_URL); | 103 prerender_contents_->Destroy(FINAL_STATUS_OPEN_URL); |
135 return NULL; | 104 return NULL; |
136 } | 105 } |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 private: | 181 private: |
213 typedef std::vector<scoped_refptr<history::HistoryAddPageArgs> > | 182 typedef std::vector<scoped_refptr<history::HistoryAddPageArgs> > |
214 AddPageVector; | 183 AddPageVector; |
215 | 184 |
216 // Caches pages to be added to the history. | 185 // Caches pages to be added to the history. |
217 AddPageVector add_page_vector_; | 186 AddPageVector add_page_vector_; |
218 | 187 |
219 PrerenderContents* prerender_contents_; | 188 PrerenderContents* prerender_contents_; |
220 }; | 189 }; |
221 | 190 |
222 void PrerenderContents::AddPendingPrerender(const GURL& url, | 191 void PrerenderContents::AddPendingPrerender( |
223 const content::Referrer& referrer, | 192 const base::WeakPtr<PrerenderHandle> weak_prerender_handle, |
224 const gfx::Size& size) { | 193 const GURL& url, |
225 pending_prerender_list_.push_back(PendingPrerenderInfo(url, referrer, size)); | 194 const content::Referrer& referrer, |
| 195 const gfx::Size& size) { |
| 196 pending_prerenders_.push_back( |
| 197 PendingPrerenderInfo(weak_prerender_handle, url, referrer, size)); |
226 } | 198 } |
227 | 199 |
228 bool PrerenderContents::IsPendingEntry(const GURL& url) const { | 200 bool PrerenderContents::IsPendingEntry( |
229 for (PendingPrerenderList::const_iterator it = | 201 const PrerenderHandle& prerender_handle) const { |
230 pending_prerender_list_.begin(); | 202 for (std::vector<PendingPrerenderInfo>::const_iterator it = |
231 it != pending_prerender_list_.end(); | 203 pending_prerenders_.begin(); |
| 204 it != pending_prerenders_.end(); |
232 ++it) { | 205 ++it) { |
233 if (it->url == url) | 206 if (it->weak_prerender_handle.get() == &prerender_handle) |
234 return true; | 207 return true; |
235 } | 208 } |
236 return false; | 209 return false; |
237 } | 210 } |
238 | 211 |
239 void PrerenderContents::StartPendingPrerenders() { | 212 void PrerenderContents::StartPendingPrerenders() { |
240 PendingPrerenderList pending_prerender_list; | 213 SessionStorageNamespace* session_storage_namespace = NULL; |
241 pending_prerender_list.swap(pending_prerender_list_); | 214 if (RenderViewHost* render_view_host = GetRenderViewHostMutable()) |
242 for (PendingPrerenderList::iterator it = pending_prerender_list.begin(); | 215 session_storage_namespace = render_view_host->GetSessionStorageNamespace(); |
| 216 DCHECK(child_id_ == -1 || session_storage_namespace); |
| 217 |
| 218 std::vector<PendingPrerenderInfo> pending_prerender_list; |
| 219 pending_prerender_list.swap(pending_prerenders_); |
| 220 for (std::vector<PendingPrerenderInfo>::iterator it = |
| 221 pending_prerender_list.begin(); |
243 it != pending_prerender_list.end(); | 222 it != pending_prerender_list.end(); |
244 ++it) { | 223 ++it) { |
245 prerender_manager_->AddPrerenderFromLinkRelPrerender( | 224 if (it->weak_prerender_handle && it->weak_prerender_handle->IsValid()) { |
246 child_id_, route_id_, it->url, it->referrer, it->size); | 225 prerender_manager_->StartPendingPrerender( |
| 226 it->weak_prerender_handle.get(), ORIGIN_LINK_REL_PRERENDER, child_id_, |
| 227 it->url, it->referrer, it->size, session_storage_namespace); |
| 228 } |
247 } | 229 } |
248 } | 230 } |
249 | 231 |
| 232 PrerenderContents::PendingPrerenderInfo::PendingPrerenderInfo( |
| 233 const base::WeakPtr<PrerenderHandle> weak_prerender_handle, |
| 234 const GURL& url, |
| 235 const content::Referrer& referrer, |
| 236 const gfx::Size& size) |
| 237 : weak_prerender_handle(weak_prerender_handle), |
| 238 url(url), |
| 239 referrer(referrer), |
| 240 size(size) { |
| 241 } |
| 242 |
| 243 PrerenderContents::PendingPrerenderInfo::~PendingPrerenderInfo() { |
| 244 } |
| 245 |
250 PrerenderContents::PrerenderContents( | 246 PrerenderContents::PrerenderContents( |
251 PrerenderManager* prerender_manager, | 247 PrerenderManager* prerender_manager, |
252 PrerenderTracker* prerender_tracker, | 248 PrerenderTracker* prerender_tracker, |
253 Profile* profile, | 249 Profile* profile, |
254 const GURL& url, | 250 const GURL& url, |
255 const content::Referrer& referrer, | 251 const content::Referrer& referrer, |
256 Origin origin, | 252 Origin origin, |
257 uint8 experiment_id) | 253 uint8 experiment_id) |
258 : prerendering_has_started_(false), | 254 : prerendering_has_started_(false), |
259 prerender_manager_(prerender_manager), | 255 prerender_manager_(prerender_manager), |
260 prerender_tracker_(prerender_tracker), | 256 prerender_tracker_(prerender_tracker), |
261 prerender_url_(url), | 257 prerender_url_(url), |
262 referrer_(referrer), | 258 referrer_(referrer), |
263 profile_(profile), | 259 profile_(profile), |
264 page_id_(0), | 260 page_id_(0), |
| 261 session_storage_namespace_id_(-1), |
265 has_stopped_loading_(false), | 262 has_stopped_loading_(false), |
266 has_finished_loading_(false), | 263 has_finished_loading_(false), |
267 final_status_(FINAL_STATUS_MAX), | 264 final_status_(FINAL_STATUS_MAX), |
268 match_complete_status_(MATCH_COMPLETE_DEFAULT), | 265 match_complete_status_(MATCH_COMPLETE_DEFAULT), |
269 prerendering_has_been_cancelled_(false), | 266 prerendering_has_been_cancelled_(false), |
270 child_id_(-1), | 267 child_id_(-1), |
271 route_id_(-1), | 268 route_id_(-1), |
272 origin_(origin), | 269 origin_(origin), |
273 experiment_id_(experiment_id), | 270 experiment_id_(experiment_id), |
274 creator_child_id_(-1) { | 271 creator_child_id_(-1) { |
275 DCHECK(prerender_manager != NULL); | 272 DCHECK(prerender_manager != NULL); |
276 } | 273 } |
277 | 274 |
| 275 void PrerenderContents::MakeIntoDummyReplacementOf( |
| 276 const PrerenderContents* original_prerender_contents) { |
| 277 load_start_time_ = original_prerender_contents->load_start_time_; |
| 278 session_storage_namespace_id_ = |
| 279 original_prerender_contents->session_storage_namespace_id_; |
| 280 } |
| 281 |
278 bool PrerenderContents::Init() { | 282 bool PrerenderContents::Init() { |
279 return AddAliasURL(prerender_url_); | 283 return AddAliasURL(prerender_url_); |
280 } | 284 } |
281 | 285 |
282 // static | 286 // static |
283 PrerenderContents::Factory* PrerenderContents::CreateFactory() { | 287 PrerenderContents::Factory* PrerenderContents::CreateFactory() { |
284 return new PrerenderContentsFactoryImpl(); | 288 return new PrerenderContentsFactoryImpl(); |
285 } | 289 } |
286 | 290 |
287 void PrerenderContents::StartPrerendering( | 291 void PrerenderContents::StartPrerendering( |
288 int creator_child_id, | 292 int creator_child_id, |
289 const gfx::Size& size, | 293 const gfx::Size& size, |
290 content::SessionStorageNamespace* session_storage_namespace, | 294 SessionStorageNamespace* session_storage_namespace, |
291 bool is_control_group) { | 295 bool is_control_group) { |
292 DCHECK(profile_ != NULL); | 296 DCHECK(profile_ != NULL); |
293 DCHECK(!size.IsEmpty()); | 297 DCHECK(!size.IsEmpty()); |
294 DCHECK(!prerendering_has_started_); | 298 DCHECK(!prerendering_has_started_); |
295 DCHECK(prerender_contents_.get() == NULL); | 299 DCHECK(prerender_contents_.get() == NULL); |
296 DCHECK_EQ(-1, creator_child_id_); | 300 DCHECK_EQ(-1, creator_child_id_); |
297 DCHECK(size_.IsEmpty()); | 301 DCHECK(size_.IsEmpty()); |
298 DCHECK_EQ(1U, alias_urls_.size()); | 302 DCHECK_EQ(1U, alias_urls_.size()); |
299 | 303 |
300 creator_child_id_ = creator_child_id; | 304 creator_child_id_ = creator_child_id; |
| 305 session_storage_namespace_id_ = session_storage_namespace->id(); |
301 size_ = size; | 306 size_ = size; |
302 | 307 |
303 InformRenderProcessAboutPrerender(prerender_url_, true, | 308 InformRenderProcessAboutPrerender(prerender_url_, true, |
304 creator_child_id_); | 309 creator_child_id_); |
305 | 310 |
| 311 DCHECK(load_start_time_.is_null()); |
| 312 load_start_time_ = base::TimeTicks::Now(); |
| 313 |
306 // Everything after this point sets up the WebContents object and associated | 314 // Everything after this point sets up the WebContents object and associated |
307 // RenderView for the prerender page. Don't do this for members of the | 315 // RenderView for the prerender page. Don't do this for members of the |
308 // control group. | 316 // control group. |
309 if (is_control_group) | 317 if (is_control_group) |
310 return; | 318 return; |
311 | 319 |
312 prerendering_has_started_ = true; | 320 prerendering_has_started_ = true; |
313 | 321 |
314 WebContents* new_contents = CreateWebContents(session_storage_namespace); | 322 WebContents* new_contents = CreateWebContents(session_storage_namespace); |
315 prerender_contents_.reset(new TabContents(new_contents)); | 323 prerender_contents_.reset(new TabContents(new_contents)); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 // Register to inform new RenderViews that we're prerendering. | 359 // Register to inform new RenderViews that we're prerendering. |
352 notification_registrar_.Add( | 360 notification_registrar_.Add( |
353 this, content::NOTIFICATION_RENDER_VIEW_HOST_CREATED_FOR_TAB, | 361 this, content::NOTIFICATION_RENDER_VIEW_HOST_CREATED_FOR_TAB, |
354 content::Source<WebContents>(new_contents)); | 362 content::Source<WebContents>(new_contents)); |
355 | 363 |
356 // Register for redirect notifications sourced from |this|. | 364 // Register for redirect notifications sourced from |this|. |
357 notification_registrar_.Add( | 365 notification_registrar_.Add( |
358 this, content::NOTIFICATION_RESOURCE_RECEIVED_REDIRECT, | 366 this, content::NOTIFICATION_RESOURCE_RECEIVED_REDIRECT, |
359 content::Source<WebContents>(GetWebContents())); | 367 content::Source<WebContents>(GetWebContents())); |
360 | 368 |
361 DCHECK(load_start_time_.is_null()); | |
362 load_start_time_ = base::TimeTicks::Now(); | |
363 | |
364 // Transfer over the user agent override. | 369 // Transfer over the user agent override. |
365 new_contents->SetUserAgentOverride( | 370 new_contents->SetUserAgentOverride( |
366 prerender_manager_->config().user_agent_override); | 371 prerender_manager_->config().user_agent_override); |
367 | 372 |
368 new_contents->GetController().LoadURLWithUserAgentOverride( | 373 new_contents->GetController().LoadURLWithUserAgentOverride( |
369 prerender_url_, | 374 prerender_url_, |
370 referrer_, | 375 referrer_, |
371 (origin_ == ORIGIN_OMNIBOX ? content::PAGE_TRANSITION_TYPED : | 376 (origin_ == ORIGIN_OMNIBOX ? content::PAGE_TRANSITION_TYPED : |
372 content::PAGE_TRANSITION_LINK), | 377 content::PAGE_TRANSITION_LINK), |
373 false, | 378 false, |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
487 NOTREACHED() << "Unexpected notification sent."; | 492 NOTREACHED() << "Unexpected notification sent."; |
488 break; | 493 break; |
489 } | 494 } |
490 } | 495 } |
491 | 496 |
492 void PrerenderContents::OnRenderViewHostCreated( | 497 void PrerenderContents::OnRenderViewHostCreated( |
493 RenderViewHost* new_render_view_host) { | 498 RenderViewHost* new_render_view_host) { |
494 } | 499 } |
495 | 500 |
496 WebContents* PrerenderContents::CreateWebContents( | 501 WebContents* PrerenderContents::CreateWebContents( |
497 content::SessionStorageNamespace* session_storage_namespace) { | 502 SessionStorageNamespace* session_storage_namespace) { |
498 return WebContents::Create(profile_, NULL, MSG_ROUTING_NONE, NULL, | 503 return WebContents::Create(profile_, NULL, MSG_ROUTING_NONE, NULL, |
499 session_storage_namespace); | 504 session_storage_namespace); |
500 } | 505 } |
501 | 506 |
502 void PrerenderContents::OnUpdateFaviconURL( | 507 void PrerenderContents::OnUpdateFaviconURL( |
503 int32 page_id, | 508 int32 page_id, |
504 const std::vector<FaviconURL>& urls) { | 509 const std::vector<FaviconURL>& urls) { |
505 VLOG(1) << "PrerenderContents::OnUpdateFaviconURL" << icon_url_; | 510 VLOG(1) << "PrerenderContents::OnUpdateFaviconURL" << icon_url_; |
506 for (std::vector<FaviconURL>::const_iterator it = urls.begin(); | 511 for (std::vector<FaviconURL>::const_iterator it = urls.begin(); |
507 it != urls.end(); ++it) { | 512 it != urls.end(); ++it) { |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
539 | 544 |
540 void PrerenderContents::AddAliasURLsFromOtherPrerenderContents( | 545 void PrerenderContents::AddAliasURLsFromOtherPrerenderContents( |
541 PrerenderContents* other_pc) { | 546 PrerenderContents* other_pc) { |
542 for (std::vector<GURL>::const_iterator it = other_pc->alias_urls_.begin(); | 547 for (std::vector<GURL>::const_iterator it = other_pc->alias_urls_.begin(); |
543 it != other_pc->alias_urls_.end(); | 548 it != other_pc->alias_urls_.end(); |
544 ++it) { | 549 ++it) { |
545 alias_urls_.push_back(*it); | 550 alias_urls_.push_back(*it); |
546 } | 551 } |
547 } | 552 } |
548 | 553 |
549 bool PrerenderContents::MatchesURL(const GURL& url, GURL* matching_url) const { | 554 bool PrerenderContents::Matches( |
550 std::vector<GURL>::const_iterator matching_url_iterator = | 555 const GURL& url, |
551 std::find_if(alias_urls_.begin(), | 556 const SessionStorageNamespace* session_storage_namespace) const { |
552 alias_urls_.end(), | 557 DCHECK(child_id_ == -1 || session_storage_namespace); |
553 PrerenderURLPredicate(url)); | 558 if (session_storage_namespace && |
554 if (matching_url_iterator != alias_urls_.end()) { | 559 session_storage_namespace_id_ != session_storage_namespace->id()) |
555 if (matching_url) | 560 return false; |
556 *matching_url = *matching_url_iterator; | 561 return std::count_if(alias_urls_.begin(), alias_urls_.end(), |
557 return true; | 562 std::bind2nd(std::equal_to<GURL>(), url)) != 0; |
558 } | |
559 return false; | |
560 } | 563 } |
561 | 564 |
562 void PrerenderContents::RenderViewGone(base::TerminationStatus status) { | 565 void PrerenderContents::RenderViewGone(base::TerminationStatus status) { |
563 Destroy(FINAL_STATUS_RENDERER_CRASHED); | 566 Destroy(FINAL_STATUS_RENDERER_CRASHED); |
564 } | 567 } |
565 | 568 |
566 void PrerenderContents::DidStopLoading() { | 569 void PrerenderContents::DidStopLoading() { |
567 has_stopped_loading_ = true; | 570 has_stopped_loading_ = true; |
568 } | 571 } |
569 | 572 |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
702 bool PrerenderContents::IsCrossSiteNavigationPending() const { | 705 bool PrerenderContents::IsCrossSiteNavigationPending() const { |
703 if (!prerender_contents_.get() || !prerender_contents_->web_contents()) | 706 if (!prerender_contents_.get() || !prerender_contents_->web_contents()) |
704 return false; | 707 return false; |
705 const WebContents* web_contents = prerender_contents_->web_contents(); | 708 const WebContents* web_contents = prerender_contents_->web_contents(); |
706 return (web_contents->GetSiteInstance() != | 709 return (web_contents->GetSiteInstance() != |
707 web_contents->GetPendingSiteInstance()); | 710 web_contents->GetPendingSiteInstance()); |
708 } | 711 } |
709 | 712 |
710 | 713 |
711 } // namespace prerender | 714 } // namespace prerender |
OLD | NEW |