| 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/renderer_host/intercept_navigation_resource_throttle.h" | 5 #include "chrome/browser/renderer_host/intercept_navigation_resource_throttle.h" |
| 6 | 6 |
| 7 #include "content/public/browser/browser_thread.h" | 7 #include "content/public/browser/browser_thread.h" |
| 8 #include "content/public/browser/child_process_security_policy.h" | 8 #include "content/public/browser/child_process_security_policy.h" |
| 9 #include "content/public/browser/render_view_host.h" | 9 #include "content/public/browser/render_view_host.h" |
| 10 #include "content/public/browser/render_process_host.h" | 10 #include "content/public/browser/render_process_host.h" |
| 11 #include "content/public/browser/resource_request_info.h" | 11 #include "content/public/browser/resource_request_info.h" |
| 12 #include "content/public/browser/resource_controller.h" | 12 #include "content/public/browser/resource_controller.h" |
| 13 #include "content/public/browser/web_contents.h" | |
| 14 #include "content/public/browser/web_contents_delegate.h" | |
| 15 #include "content/public/common/referrer.h" | 13 #include "content/public/common/referrer.h" |
| 16 #include "net/url_request/url_request.h" | 14 #include "net/url_request/url_request.h" |
| 17 | 15 |
| 18 using content::BrowserThread; | 16 using content::BrowserThread; |
| 19 using content::ChildProcessSecurityPolicy; | 17 using content::ChildProcessSecurityPolicy; |
| 20 using content::Referrer; | 18 using content::Referrer; |
| 21 using content::RenderViewHost; | 19 using content::RenderViewHost; |
| 22 using content::ResourceRequestInfo; | 20 using content::ResourceRequestInfo; |
| 23 using content::WebContents; | |
| 24 using content::WebContentsDelegate; | |
| 25 | 21 |
| 26 namespace { | 22 namespace { |
| 27 | 23 |
| 28 void CheckIfShouldIgnoreNavigationOnUIThread( | 24 void CheckIfShouldIgnoreNavigationOnUIThread( |
| 29 int render_process_id, | 25 int render_process_id, |
| 30 int render_view_id, | 26 int render_view_id, |
| 31 const GURL& url, | 27 const GURL& url, |
| 32 const Referrer& referrer, | 28 const Referrer& referrer, |
| 33 bool is_content_initiated, | 29 bool is_content_initiated, |
| 34 InterceptNavigationResourceThrottle::CheckOnUIThreadCallback | 30 InterceptNavigationResourceThrottle::CheckOnUIThreadCallback |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 // Defer request while we wait for the UI thread to check if the navigation | 105 // Defer request while we wait for the UI thread to check if the navigation |
| 110 // should be ignored. | 106 // should be ignored. |
| 111 return true; | 107 return true; |
| 112 } | 108 } |
| 113 | 109 |
| 114 void InterceptNavigationResourceThrottle::OnResultObtained( | 110 void InterceptNavigationResourceThrottle::OnResultObtained( |
| 115 bool should_ignore_navigation) { | 111 bool should_ignore_navigation) { |
| 116 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 112 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 117 | 113 |
| 118 if (should_ignore_navigation) { | 114 if (should_ignore_navigation) { |
| 119 // TODO(mkosiba): Cancel() results in a CANCELLED status but what we really | 115 controller()->CancelAndIgnore(); |
| 120 // want is a HANDLED_EXTERNALLY status. | |
| 121 controller()->Cancel(); | |
| 122 } else { | 116 } else { |
| 123 controller()->Resume(); | 117 controller()->Resume(); |
| 124 } | 118 } |
| 125 } | 119 } |
| OLD | NEW |