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 "components/navigation_interception/intercept_navigation_resource_throt tle.h" | 5 #include "components/navigation_interception/intercept_navigation_resource_throt tle.h" |
6 | 6 |
7 #include "components/navigation_interception/navigation_params.h" | 7 #include "components/navigation_interception/navigation_params.h" |
8 #include "content/public/browser/browser_thread.h" | 8 #include "content/public/browser/browser_thread.h" |
9 #include "content/public/browser/child_process_security_policy.h" | 9 #include "content/public/browser/child_process_security_policy.h" |
10 #include "content/public/browser/render_frame_host.h" | 10 #include "content/public/browser/render_frame_host.h" |
11 #include "content/public/browser/render_process_host.h" | 11 #include "content/public/browser/render_process_host.h" |
12 #include "content/public/browser/resource_context.h" | |
12 #include "content/public/browser/resource_controller.h" | 13 #include "content/public/browser/resource_controller.h" |
13 #include "content/public/browser/resource_request_info.h" | 14 #include "content/public/browser/resource_request_info.h" |
14 #include "content/public/browser/web_contents.h" | 15 #include "content/public/browser/web_contents.h" |
15 #include "content/public/common/referrer.h" | 16 #include "content/public/common/referrer.h" |
16 #include "net/http/http_response_headers.h" | 17 #include "net/http/http_response_headers.h" |
18 #include "net/url_request/url_request_context.h" | |
19 #include "net/url_request/url_request_job_factory.h" | |
17 #include "net/url_request/url_request.h" | 20 #include "net/url_request/url_request.h" |
18 #include "ui/base/page_transition_types.h" | 21 #include "ui/base/page_transition_types.h" |
19 | 22 |
20 using content::BrowserThread; | 23 using content::BrowserThread; |
21 using content::ChildProcessSecurityPolicy; | 24 using content::ChildProcessSecurityPolicy; |
22 using ui::PageTransition; | 25 using ui::PageTransition; |
23 using content::Referrer; | 26 using content::Referrer; |
24 using content::RenderProcessHost; | 27 using content::RenderProcessHost; |
25 using content::ResourceRequestInfo; | 28 using content::ResourceRequestInfo; |
26 | 29 |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
103 const std::string& method, | 106 const std::string& method, |
104 bool is_redirect) { | 107 bool is_redirect) { |
105 const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request_); | 108 const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request_); |
106 if (!info) | 109 if (!info) |
107 return false; | 110 return false; |
108 | 111 |
109 int render_process_id, render_frame_id; | 112 int render_process_id, render_frame_id; |
110 if (!info->GetAssociatedRenderFrame(&render_process_id, &render_frame_id)) | 113 if (!info->GetAssociatedRenderFrame(&render_process_id, &render_frame_id)) |
111 return false; | 114 return false; |
112 | 115 |
113 NavigationParams navigation_params(url, | 116 bool is_external_protocol = |
114 Referrer(GURL(request_->referrer()), | 117 !info->GetContext()->GetRequestContext()->job_factory()->IsHandledURL( |
115 info->GetReferrerPolicy()), | 118 url); |
116 info->HasUserGesture(), | 119 NavigationParams navigation_params( |
mnaganov (inactive)
2015/01/28 17:06:47
nit: Was this formatting done by clang-format?
| |
117 method == "POST", | 120 url, Referrer(GURL(request_->referrer()), info->GetReferrerPolicy()), |
118 info->GetPageTransition(), | 121 info->HasUserGesture(), method == "POST", info->GetPageTransition(), |
119 is_redirect); | 122 is_redirect, is_external_protocol); |
120 | 123 |
121 BrowserThread::PostTask( | 124 BrowserThread::PostTask( |
122 BrowserThread::UI, | 125 BrowserThread::UI, |
123 FROM_HERE, | 126 FROM_HERE, |
124 base::Bind( | 127 base::Bind( |
125 &CheckIfShouldIgnoreNavigationOnUIThread, | 128 &CheckIfShouldIgnoreNavigationOnUIThread, |
126 render_process_id, | 129 render_process_id, |
127 render_frame_id, | 130 render_frame_id, |
128 navigation_params, | 131 navigation_params, |
129 should_ignore_callback_, | 132 should_ignore_callback_, |
(...skipping 11 matching lines...) Expand all Loading... | |
141 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 144 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
142 | 145 |
143 if (should_ignore_navigation) { | 146 if (should_ignore_navigation) { |
144 controller()->CancelAndIgnore(); | 147 controller()->CancelAndIgnore(); |
145 } else { | 148 } else { |
146 controller()->Resume(); | 149 controller()->Resume(); |
147 } | 150 } |
148 } | 151 } |
149 | 152 |
150 } // namespace navigation_interception | 153 } // namespace navigation_interception |
OLD | NEW |