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 <algorithm> | 7 #include <algorithm> |
8 #include <functional> | 8 #include <functional> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 } | 79 } |
80 | 80 |
81 virtual bool CanDownload(RenderViewHost* render_view_host, | 81 virtual bool CanDownload(RenderViewHost* render_view_host, |
82 int request_id, | 82 int request_id, |
83 const std::string& request_method) OVERRIDE { | 83 const std::string& request_method) OVERRIDE { |
84 prerender_contents_->Destroy(FINAL_STATUS_DOWNLOAD); | 84 prerender_contents_->Destroy(FINAL_STATUS_DOWNLOAD); |
85 // Cancel the download. | 85 // Cancel the download. |
86 return false; | 86 return false; |
87 } | 87 } |
88 | 88 |
89 virtual void OnStartDownload(WebContents* source, | |
90 DownloadItem* download) OVERRIDE { | |
91 // Prerendered pages should never be able to download files. | |
92 NOTREACHED(); | |
93 } | |
94 | |
95 virtual bool ShouldCreateWebContents( | 89 virtual bool ShouldCreateWebContents( |
96 WebContents* web_contents, | 90 WebContents* web_contents, |
97 int route_id, | 91 int route_id, |
98 WindowContainerType window_container_type, | 92 WindowContainerType window_container_type, |
99 const string16& frame_name, | 93 const string16& frame_name, |
100 const GURL& target_url) OVERRIDE { | 94 const GURL& target_url) OVERRIDE { |
101 // Since we don't want to permit child windows that would have a | 95 // Since we don't want to permit child windows that would have a |
102 // window.opener property, terminate prerendering. | 96 // window.opener property, terminate prerendering. |
103 prerender_contents_->Destroy(FINAL_STATUS_CREATE_NEW_WINDOW); | 97 prerender_contents_->Destroy(FINAL_STATUS_CREATE_NEW_WINDOW); |
104 // Cancel the popup. | 98 // Cancel the popup. |
(...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
703 | 697 |
704 bool PrerenderContents::IsCrossSiteNavigationPending() const { | 698 bool PrerenderContents::IsCrossSiteNavigationPending() const { |
705 if (!prerender_contents_) | 699 if (!prerender_contents_) |
706 return false; | 700 return false; |
707 return (prerender_contents_->GetSiteInstance() != | 701 return (prerender_contents_->GetSiteInstance() != |
708 prerender_contents_->GetPendingSiteInstance()); | 702 prerender_contents_->GetPendingSiteInstance()); |
709 } | 703 } |
710 | 704 |
711 | 705 |
712 } // namespace prerender | 706 } // namespace prerender |
OLD | NEW |