Chromium Code Reviews| 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 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 578 const content::LoadCommittedDetails& details, | 578 const content::LoadCommittedDetails& details, |
| 579 const content::FrameNavigateParams& params) { | 579 const content::FrameNavigateParams& params) { |
| 580 // If the prerender made a second navigation entry, abort the prerender. This | 580 // If the prerender made a second navigation entry, abort the prerender. This |
| 581 // avoids having to correctly implement a complex history merging case (this | 581 // avoids having to correctly implement a complex history merging case (this |
| 582 // interacts with location.replace) and correctly synchronize with the | 582 // interacts with location.replace) and correctly synchronize with the |
| 583 // renderer. The final status may be monitored to see we need to revisit this | 583 // 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 | 584 // decision. This does not affect client redirects as those do not push new |
| 585 // history entries. (Calls to location.replace, navigations before onload, and | 585 // history entries. (Calls to location.replace, navigations before onload, and |
| 586 // <meta http-equiv=refresh> with timeouts under 1 second do not create | 586 // <meta http-equiv=refresh> with timeouts under 1 second do not create |
| 587 // entries in Blink.) | 587 // entries in Blink.) |
| 588 if (prerender_contents_->GetController().GetEntryCount() > 1) { | 588 if (origin() != ORIGIN_OFFLINE && |
| 589 prerender_contents_->GetController().GetEntryCount() > 1) { | |
| 589 Destroy(FINAL_STATUS_NEW_NAVIGATION_ENTRY); | 590 Destroy(FINAL_STATUS_NEW_NAVIGATION_ENTRY); |
| 590 return; | 591 return; |
| 591 } | 592 } |
| 592 | 593 |
| 593 // Add each redirect as an alias. |params.url| is included in | 594 // Add each redirect as an alias. |params.url| is included in |
| 594 // |params.redirects|. | 595 // |params.redirects|. |
| 595 // | 596 // |
| 596 // TODO(davidben): We do not correctly patch up history for renderer-initated | 597 // TODO(davidben): We do not correctly patch up history for renderer-initated |
| 597 // navigations which add history entries. http://crbug.com/305660. | 598 // navigations which add history entries. http://crbug.com/305660. |
| 598 for (size_t i = 0; i < params.redirects.size(); i++) { | 599 for (size_t i = 0; i < params.redirects.size(); i++) { |
|
pasko
2017/01/24 19:43:38
sending these IPCs to the renderer is not needed f
dougarnett
2017/01/24 21:14:03
Done.
| |
| 599 if (!AddAliasURL(params.redirects[i])) | 600 if (!AddAliasURL(params.redirects[i])) |
| 600 return; | 601 return; |
| 601 } | 602 } |
| 602 } | 603 } |
| 603 | 604 |
| 604 void PrerenderContents::DidGetRedirectForResourceRequest( | 605 void PrerenderContents::DidGetRedirectForResourceRequest( |
| 605 const content::ResourceRedirectDetails& details) { | 606 const content::ResourceRedirectDetails& details) { |
| 606 // DidGetRedirectForResourceRequest can come for any resource on a page. If | 607 // DidGetRedirectForResourceRequest can come for any resource on a page. If |
| 607 // it's a redirect on the top-level resource, the name needs to be remembered | 608 // it's a redirect on the top-level resource, the name needs to be remembered |
| 608 // for future matching, and if it redirects to an https resource, it needs to | 609 // for future matching, and if it redirects to an https resource, it needs to |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 746 void PrerenderContents::AddResourceThrottle( | 747 void PrerenderContents::AddResourceThrottle( |
| 747 const base::WeakPtr<PrerenderResourceThrottle>& throttle) { | 748 const base::WeakPtr<PrerenderResourceThrottle>& throttle) { |
| 748 resource_throttles_.push_back(throttle); | 749 resource_throttles_.push_back(throttle); |
| 749 } | 750 } |
| 750 | 751 |
| 751 void PrerenderContents::AddNetworkBytes(int64_t bytes) { | 752 void PrerenderContents::AddNetworkBytes(int64_t bytes) { |
| 752 network_bytes_ += bytes; | 753 network_bytes_ += bytes; |
| 753 } | 754 } |
| 754 | 755 |
| 755 } // namespace prerender | 756 } // namespace prerender |
| OLD | NEW |