| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <functional> | 10 #include <functional> |
| (...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 570 void PrerenderContents::DidFinishLoad( | 570 void PrerenderContents::DidFinishLoad( |
| 571 content::RenderFrameHost* render_frame_host, | 571 content::RenderFrameHost* render_frame_host, |
| 572 const GURL& validated_url) { | 572 const GURL& validated_url) { |
| 573 if (!render_frame_host->GetParent()) | 573 if (!render_frame_host->GetParent()) |
| 574 has_finished_loading_ = true; | 574 has_finished_loading_ = true; |
| 575 } | 575 } |
| 576 | 576 |
| 577 void PrerenderContents::DidNavigateMainFrame( | 577 void PrerenderContents::DidNavigateMainFrame( |
| 578 const content::LoadCommittedDetails& details, | 578 const content::LoadCommittedDetails& details, |
| 579 const content::FrameNavigateParams& params) { | 579 const content::FrameNavigateParams& params) { |
| 580 // Prevent ORIGIN_OFFLINE prerenders from being destroyed on location.href |
| 581 // change, since the history is never merged for offline prerenders. Also |
| 582 // avoid adding aliases as they may potentially mark other valid requests to |
| 583 // offline as duplicate. |
| 584 if (origin() == ORIGIN_OFFLINE) |
| 585 return; |
| 586 |
| 580 // If the prerender made a second navigation entry, abort the prerender. This | 587 // If the prerender made a second navigation entry, abort the prerender. This |
| 581 // avoids having to correctly implement a complex history merging case (this | 588 // avoids having to correctly implement a complex history merging case (this |
| 582 // interacts with location.replace) and correctly synchronize with the | 589 // interacts with location.replace) and correctly synchronize with the |
| 583 // renderer. The final status may be monitored to see we need to revisit this | 590 // renderer. The final status may be monitored to see we need to revisit this |
| 584 // decision. This does not affect client redirects as those do not push new | 591 // decision. This does not affect client redirects as those do not push new |
| 585 // history entries. (Calls to location.replace, navigations before onload, and | 592 // history entries. (Calls to location.replace, navigations before onload, and |
| 586 // <meta http-equiv=refresh> with timeouts under 1 second do not create | 593 // <meta http-equiv=refresh> with timeouts under 1 second do not create |
| 587 // entries in Blink.) | 594 // entries in Blink.) |
| 588 if (prerender_contents_->GetController().GetEntryCount() > 1) { | 595 if (prerender_contents_->GetController().GetEntryCount() > 1) { |
| 589 Destroy(FINAL_STATUS_NEW_NAVIGATION_ENTRY); | 596 Destroy(FINAL_STATUS_NEW_NAVIGATION_ENTRY); |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 746 void PrerenderContents::AddResourceThrottle( | 753 void PrerenderContents::AddResourceThrottle( |
| 747 const base::WeakPtr<PrerenderResourceThrottle>& throttle) { | 754 const base::WeakPtr<PrerenderResourceThrottle>& throttle) { |
| 748 resource_throttles_.push_back(throttle); | 755 resource_throttles_.push_back(throttle); |
| 749 } | 756 } |
| 750 | 757 |
| 751 void PrerenderContents::AddNetworkBytes(int64_t bytes) { | 758 void PrerenderContents::AddNetworkBytes(int64_t bytes) { |
| 752 network_bytes_ += bytes; | 759 network_bytes_ += bytes; |
| 753 } | 760 } |
| 754 | 761 |
| 755 } // namespace prerender | 762 } // namespace prerender |
| OLD | NEW |