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_contents.h" | 5 #include "chrome/browser/prerender/prerender_contents.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/process_util.h" | 9 #include "base/process_util.h" |
10 #include "base/task.h" | 10 #include "base/task.h" |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
307 *route_id = prerender_contents_->render_view_host()->routing_id(); | 307 *route_id = prerender_contents_->render_view_host()->routing_id(); |
308 return true; | 308 return true; |
309 } | 309 } |
310 if (render_view_host_) { | 310 if (render_view_host_) { |
311 *route_id = render_view_host_->routing_id(); | 311 *route_id = render_view_host_->routing_id(); |
312 return true; | 312 return true; |
313 } | 313 } |
314 return false; | 314 return false; |
315 } | 315 } |
316 | 316 |
317 void PrerenderContents::set_final_status(FinalStatus final_status) { | 317 void PrerenderContents::set_final_status(FinalStatus final_status) { |
cbentzel
2011/05/04 17:10:15
This is going to need to be modified to allow tran
Shishir
2011/05/05 23:09:54
As discussed we will throw away the prerendered pa
| |
318 DCHECK(final_status >= FINAL_STATUS_USED && final_status < FINAL_STATUS_MAX); | 318 DCHECK(final_status >= FINAL_STATUS_USED && final_status < FINAL_STATUS_MAX); |
319 DCHECK(final_status_ == FINAL_STATUS_MAX || | 319 DCHECK(final_status_ == FINAL_STATUS_MAX || |
320 final_status_ == FINAL_STATUS_CONTROL_GROUP); | 320 final_status_ == FINAL_STATUS_CONTROL_GROUP); |
321 | 321 |
322 // Don't override final_status_ if it's FINAL_STATUS_CONTROL_GROUP, | 322 // Don't override final_status_ if it's FINAL_STATUS_CONTROL_GROUP, |
323 // otherwise data will be collected in the Prerender.FinalStatus histogram. | 323 // otherwise data will be collected in the Prerender.FinalStatus histogram. |
324 if (final_status_ == FINAL_STATUS_CONTROL_GROUP) | 324 if (final_status_ == FINAL_STATUS_CONTROL_GROUP) |
325 return; | 325 return; |
326 | 326 |
327 final_status_ = final_status; | 327 final_status_ = final_status; |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
592 OnMaybeCancelPrerenderForHTML5Media) | 592 OnMaybeCancelPrerenderForHTML5Media) |
593 IPC_MESSAGE_HANDLER(ViewHostMsg_JSOutOfMemory, OnJSOutOfMemory) | 593 IPC_MESSAGE_HANDLER(ViewHostMsg_JSOutOfMemory, OnJSOutOfMemory) |
594 IPC_MESSAGE_UNHANDLED(handled = false) | 594 IPC_MESSAGE_UNHANDLED(handled = false) |
595 IPC_END_MESSAGE_MAP_EX() | 595 IPC_END_MESSAGE_MAP_EX() |
596 | 596 |
597 return handled; | 597 return handled; |
598 } | 598 } |
599 | 599 |
600 void PrerenderContents::OnDidStartProvisionalLoadForFrame(int64 frame_id, | 600 void PrerenderContents::OnDidStartProvisionalLoadForFrame(int64 frame_id, |
601 bool is_main_frame, | 601 bool is_main_frame, |
602 bool has_opener_set, | |
602 const GURL& url) { | 603 const GURL& url) { |
603 if (is_main_frame) { | 604 if (is_main_frame) { |
604 if (!AddAliasURL(url)) | 605 if (!AddAliasURL(url)) |
605 return; | 606 return; |
606 | 607 |
607 // Usually, this event fires if the user clicks or enters a new URL. | 608 // Usually, this event fires if the user clicks or enters a new URL. |
608 // Neither of these can happen in the case of an invisible prerender. | 609 // Neither of these can happen in the case of an invisible prerender. |
609 // So the cause is: Some JavaScript caused a new URL to be loaded. In that | 610 // So the cause is: Some JavaScript caused a new URL to be loaded. In that |
610 // case, the spinner would start again in the browser, so we must reset | 611 // case, the spinner would start again in the browser, so we must reset |
611 // has_stopped_loading_ so that the spinner won't be stopped. | 612 // has_stopped_loading_ so that the spinner won't be stopped. |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
727 // used. | 728 // used. |
728 if (UseTabContents()) { | 729 if (UseTabContents()) { |
729 if (!prerender_contents_.get()) | 730 if (!prerender_contents_.get()) |
730 return NULL; | 731 return NULL; |
731 return prerender_contents_->render_view_host(); | 732 return prerender_contents_->render_view_host(); |
732 } | 733 } |
733 return render_view_host_; | 734 return render_view_host_; |
734 } | 735 } |
735 | 736 |
736 } // namespace prerender | 737 } // namespace prerender |
OLD | NEW |