| 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 } | 78 } |
| 79 | 79 |
| 80 virtual bool CanDownload(RenderViewHost* render_view_host, | 80 virtual bool CanDownload(RenderViewHost* render_view_host, |
| 81 int request_id, | 81 int request_id, |
| 82 const std::string& request_method) OVERRIDE { | 82 const std::string& request_method) OVERRIDE { |
| 83 prerender_contents_->Destroy(FINAL_STATUS_DOWNLOAD); | 83 prerender_contents_->Destroy(FINAL_STATUS_DOWNLOAD); |
| 84 // Cancel the download. | 84 // Cancel the download. |
| 85 return false; | 85 return false; |
| 86 } | 86 } |
| 87 | 87 |
| 88 virtual void OnStartDownload(WebContents* source, | |
| 89 DownloadItem* download) OVERRIDE { | |
| 90 // Prerendered pages should never be able to download files. | |
| 91 NOTREACHED(); | |
| 92 } | |
| 93 | |
| 94 virtual bool ShouldCreateWebContents( | 88 virtual bool ShouldCreateWebContents( |
| 95 WebContents* web_contents, | 89 WebContents* web_contents, |
| 96 int route_id, | 90 int route_id, |
| 97 WindowContainerType window_container_type, | 91 WindowContainerType window_container_type, |
| 98 const string16& frame_name, | 92 const string16& frame_name, |
| 99 const GURL& target_url) OVERRIDE { | 93 const GURL& target_url) OVERRIDE { |
| 100 // Since we don't want to permit child windows that would have a | 94 // Since we don't want to permit child windows that would have a |
| 101 // window.opener property, terminate prerendering. | 95 // window.opener property, terminate prerendering. |
| 102 prerender_contents_->Destroy(FINAL_STATUS_CREATE_NEW_WINDOW); | 96 prerender_contents_->Destroy(FINAL_STATUS_CREATE_NEW_WINDOW); |
| 103 // Cancel the popup. | 97 // Cancel the popup. |
| (...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 686 | 680 |
| 687 bool PrerenderContents::IsCrossSiteNavigationPending() const { | 681 bool PrerenderContents::IsCrossSiteNavigationPending() const { |
| 688 if (!prerender_contents_) | 682 if (!prerender_contents_) |
| 689 return false; | 683 return false; |
| 690 return (prerender_contents_->GetSiteInstance() != | 684 return (prerender_contents_->GetSiteInstance() != |
| 691 prerender_contents_->GetPendingSiteInstance()); | 685 prerender_contents_->GetPendingSiteInstance()); |
| 692 } | 686 } |
| 693 | 687 |
| 694 | 688 |
| 695 } // namespace prerender | 689 } // namespace prerender |
| OLD | NEW |