| 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 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/process_util.h" | 10 #include "base/process_util.h" |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 | 81 |
| 82 // TabContentsDelegateImpl ----------------------------------------------------- | 82 // TabContentsDelegateImpl ----------------------------------------------------- |
| 83 | 83 |
| 84 class PrerenderContents::TabContentsDelegateImpl | 84 class PrerenderContents::TabContentsDelegateImpl |
| 85 : public TabContentsDelegate { | 85 : public TabContentsDelegate { |
| 86 public: | 86 public: |
| 87 explicit TabContentsDelegateImpl(PrerenderContents* prerender_contents) : | 87 explicit TabContentsDelegateImpl(PrerenderContents* prerender_contents) : |
| 88 prerender_contents_(prerender_contents) { | 88 prerender_contents_(prerender_contents) { |
| 89 } | 89 } |
| 90 | 90 |
| 91 virtual TabContents* OpenURLFromTab(TabContents* source, |
| 92 const OpenURLParams& params) OVERRIDE { |
| 93 // |OpenURLFromTab| is typically called when a frame performs a navigation |
| 94 // that requires the browser to perform the transition instead of WebKit. |
| 95 // Examples include prerendering a site that redirects to an app URL, |
| 96 // or if --enable-strict-site-isolation is specified and the prerendered |
| 97 // frame redirects to a different origin. |
| 98 // TODO(cbentzel): Consider supporting this is if it is a common case |
| 99 // during prerenders. |
| 100 prerender_contents_->Destroy(FINAL_STATUS_OPEN_URL); |
| 101 return NULL; |
| 102 } |
| 103 |
| 91 // TabContentsDelegate implementation: | 104 // TabContentsDelegate implementation: |
| 92 virtual bool ShouldAddNavigationToHistory( | 105 virtual bool ShouldAddNavigationToHistory( |
| 93 const history::HistoryAddPageArgs& add_page_args, | 106 const history::HistoryAddPageArgs& add_page_args, |
| 94 content::NavigationType navigation_type) OVERRIDE { | 107 content::NavigationType navigation_type) OVERRIDE { |
| 95 add_page_vector_.push_back( | 108 add_page_vector_.push_back( |
| 96 scoped_refptr<history::HistoryAddPageArgs>(add_page_args.Clone())); | 109 scoped_refptr<history::HistoryAddPageArgs>(add_page_args.Clone())); |
| 97 return false; | 110 return false; |
| 98 } | 111 } |
| 99 | 112 |
| 100 virtual bool CanDownload(TabContents* source, int request_id) OVERRIDE { | 113 virtual bool CanDownload(TabContents* source, int request_id) OVERRIDE { |
| (...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 676 bool PrerenderContents::IsCrossSiteNavigationPending() const { | 689 bool PrerenderContents::IsCrossSiteNavigationPending() const { |
| 677 if (!prerender_contents_.get() || !prerender_contents_->tab_contents()) | 690 if (!prerender_contents_.get() || !prerender_contents_->tab_contents()) |
| 678 return false; | 691 return false; |
| 679 const TabContents* tab_contents = prerender_contents_->tab_contents(); | 692 const TabContents* tab_contents = prerender_contents_->tab_contents(); |
| 680 return (tab_contents->GetSiteInstance() != | 693 return (tab_contents->GetSiteInstance() != |
| 681 tab_contents->GetPendingSiteInstance()); | 694 tab_contents->GetPendingSiteInstance()); |
| 682 } | 695 } |
| 683 | 696 |
| 684 | 697 |
| 685 } // namespace prerender | 698 } // namespace prerender |
| OLD | NEW |