| 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 virtual void CanDownload( | 85 virtual void CanDownload( |
| 86 RenderViewHost* render_view_host, | 86 RenderViewHost* render_view_host, |
| 87 int request_id, | 87 int request_id, |
| 88 const std::string& request_method, | 88 const std::string& request_method, |
| 89 const base::Callback<void(bool)>& callback) OVERRIDE { | 89 const base::Callback<void(bool)>& callback) OVERRIDE { |
| 90 prerender_contents_->Destroy(FINAL_STATUS_DOWNLOAD); | 90 prerender_contents_->Destroy(FINAL_STATUS_DOWNLOAD); |
| 91 // Cancel the download. | 91 // Cancel the download. |
| 92 callback.Run(false); | 92 callback.Run(false); |
| 93 } | 93 } |
| 94 | 94 |
| 95 virtual bool ShouldCreateWebContents( |
| 96 WebContents* web_contents, |
| 97 int route_id, |
| 98 WindowContainerType window_container_type, |
| 99 const base::string16& frame_name, |
| 100 const GURL& target_url, |
| 101 const std::string& partition_id, |
| 102 SessionStorageNamespace* session_storage_namespace) OVERRIDE { |
| 103 // Since we don't want to permit child windows that would have a |
| 104 // window.opener property, terminate prerendering. |
| 105 prerender_contents_->Destroy(FINAL_STATUS_CREATE_NEW_WINDOW); |
| 106 // Cancel the popup. |
| 107 return false; |
| 108 } |
| 109 |
| 95 virtual bool OnGoToEntryOffset(int offset) OVERRIDE { | 110 virtual bool OnGoToEntryOffset(int offset) OVERRIDE { |
| 96 // This isn't allowed because the history merge operation | 111 // This isn't allowed because the history merge operation |
| 97 // does not work if there are renderer issued challenges. | 112 // does not work if there are renderer issued challenges. |
| 98 // TODO(cbentzel): Cancel in this case? May not need to do | 113 // TODO(cbentzel): Cancel in this case? May not need to do |
| 99 // since render-issued offset navigations are not guaranteed, | 114 // since render-issued offset navigations are not guaranteed, |
| 100 // but indicates that the page cares about the history. | 115 // but indicates that the page cares about the history. |
| 101 return false; | 116 return false; |
| 102 } | 117 } |
| 103 | 118 |
| 104 virtual void JSOutOfMemory(WebContents* tab) OVERRIDE { | 119 virtual void JSOutOfMemory(WebContents* tab) OVERRIDE { |
| (...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 768 return NULL; | 783 return NULL; |
| 769 return prerender_contents()->GetController(). | 784 return prerender_contents()->GetController(). |
| 770 GetDefaultSessionStorageNamespace(); | 785 GetDefaultSessionStorageNamespace(); |
| 771 } | 786 } |
| 772 | 787 |
| 773 void PrerenderContents::OnCancelPrerenderForPrinting() { | 788 void PrerenderContents::OnCancelPrerenderForPrinting() { |
| 774 Destroy(FINAL_STATUS_WINDOW_PRINT); | 789 Destroy(FINAL_STATUS_WINDOW_PRINT); |
| 775 } | 790 } |
| 776 | 791 |
| 777 } // namespace prerender | 792 } // namespace prerender |
| OLD | NEW |