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) { | |
mmenke
2011/12/05 15:28:25
nit: OVERRIDE
cbentzel
2011/12/05 15:30:59
Done.
| |
93 // |OpenURLFromTab| is typicalled called when a frame performs a navigation | |
dominich
2011/12/05 14:40:41
nit: typically called :)
cbentzel
2011/12/05 15:30:21
Done.
| |
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 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
674 bool PrerenderContents::IsCrossSiteNavigationPending() const { | 687 bool PrerenderContents::IsCrossSiteNavigationPending() const { |
675 if (!prerender_contents_.get() || !prerender_contents_->tab_contents()) | 688 if (!prerender_contents_.get() || !prerender_contents_->tab_contents()) |
676 return false; | 689 return false; |
677 const TabContents* tab_contents = prerender_contents_->tab_contents(); | 690 const TabContents* tab_contents = prerender_contents_->tab_contents(); |
678 return (tab_contents->GetSiteInstance() != | 691 return (tab_contents->GetSiteInstance() != |
679 tab_contents->GetPendingSiteInstance()); | 692 tab_contents->GetPendingSiteInstance()); |
680 } | 693 } |
681 | 694 |
682 | 695 |
683 } // namespace prerender | 696 } // namespace prerender |
OLD | NEW |