OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc
e-loading | 5 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc
e-loading |
6 | 6 |
7 #include "chrome/browser/renderer_host/resource_dispatcher_host.h" | 7 #include "chrome/browser/renderer_host/resource_dispatcher_host.h" |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 1061 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1072 } | 1072 } |
1073 | 1073 |
1074 void ResourceDispatcherHost::OnSSLCertificateError( | 1074 void ResourceDispatcherHost::OnSSLCertificateError( |
1075 net::URLRequest* request, | 1075 net::URLRequest* request, |
1076 int cert_error, | 1076 int cert_error, |
1077 net::X509Certificate* cert) { | 1077 net::X509Certificate* cert) { |
1078 DCHECK(request); | 1078 DCHECK(request); |
1079 SSLManager::OnSSLCertificateError(this, request, cert_error, cert); | 1079 SSLManager::OnSSLCertificateError(this, request, cert_error, cert); |
1080 } | 1080 } |
1081 | 1081 |
| 1082 void ResourceDispatcherHost::OnGetCookies( |
| 1083 net::URLRequest* request, |
| 1084 bool blocked_by_policy) { |
| 1085 VLOG(1) << "OnGetCookies: " << request->url().spec(); |
| 1086 |
| 1087 int render_process_id, render_view_id; |
| 1088 if (!RenderViewForRequest(request, &render_process_id, &render_view_id)) |
| 1089 return; |
| 1090 |
| 1091 ChromeURLRequestContext* context = |
| 1092 static_cast<ChromeURLRequestContext*>(request->context()); |
| 1093 if (context->IsExternal()) |
| 1094 return; |
| 1095 |
| 1096 net::CookieMonster* cookie_monster = |
| 1097 context->cookie_store()->GetCookieMonster(); |
| 1098 net::CookieList cookie_list = |
| 1099 cookie_monster->GetAllCookiesForURL(request->url()); |
| 1100 CallRenderViewHostContentSettingsDelegate( |
| 1101 render_process_id, render_view_id, |
| 1102 &RenderViewHostDelegate::ContentSettings::OnCookiesRead, |
| 1103 request->url(), cookie_list, blocked_by_policy); |
| 1104 } |
| 1105 |
1082 void ResourceDispatcherHost::OnSetCookie(net::URLRequest* request, | 1106 void ResourceDispatcherHost::OnSetCookie(net::URLRequest* request, |
1083 const std::string& cookie_line, | 1107 const std::string& cookie_line, |
1084 const net::CookieOptions& options, | 1108 const net::CookieOptions& options, |
1085 bool blocked_by_policy) { | 1109 bool blocked_by_policy) { |
1086 VLOG(1) << "OnSetCookie: " << request->url().spec(); | 1110 VLOG(1) << "OnSetCookie: " << request->url().spec(); |
1087 | 1111 |
1088 int render_process_id, render_view_id; | 1112 int render_process_id, render_view_id; |
1089 if (!RenderViewForRequest(request, &render_process_id, &render_view_id)) | 1113 if (!RenderViewForRequest(request, &render_process_id, &render_view_id)) |
1090 return; | 1114 return; |
1091 | 1115 |
1092 CallRenderViewHostContentSettingsDelegate( | 1116 CallRenderViewHostContentSettingsDelegate( |
1093 render_process_id, render_view_id, | 1117 render_process_id, render_view_id, |
1094 &RenderViewHostDelegate::ContentSettings::OnCookieAccessed, | 1118 &RenderViewHostDelegate::ContentSettings::OnCookieChanged, |
1095 request->url(), cookie_line, options, blocked_by_policy); | 1119 request->url(), cookie_line, options, blocked_by_policy); |
1096 } | 1120 } |
1097 | 1121 |
1098 void ResourceDispatcherHost::OnResponseStarted(net::URLRequest* request) { | 1122 void ResourceDispatcherHost::OnResponseStarted(net::URLRequest* request) { |
1099 VLOG(1) << "OnResponseStarted: " << request->url().spec(); | 1123 VLOG(1) << "OnResponseStarted: " << request->url().spec(); |
1100 ResourceDispatcherHostRequestInfo* info = InfoForRequest(request); | 1124 ResourceDispatcherHostRequestInfo* info = InfoForRequest(request); |
1101 if (PauseRequestIfNeeded(info)) { | 1125 if (PauseRequestIfNeeded(info)) { |
1102 VLOG(1) << "OnResponseStarted pausing: " << request->url().spec(); | 1126 VLOG(1) << "OnResponseStarted pausing: " << request->url().spec(); |
1103 return; | 1127 return; |
1104 } | 1128 } |
(...skipping 829 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1934 return is_prefetch_enabled_; | 1958 return is_prefetch_enabled_; |
1935 } | 1959 } |
1936 | 1960 |
1937 // static | 1961 // static |
1938 void ResourceDispatcherHost::set_is_prefetch_enabled(bool value) { | 1962 void ResourceDispatcherHost::set_is_prefetch_enabled(bool value) { |
1939 is_prefetch_enabled_ = value; | 1963 is_prefetch_enabled_ = value; |
1940 } | 1964 } |
1941 | 1965 |
1942 // static | 1966 // static |
1943 bool ResourceDispatcherHost::is_prefetch_enabled_ = false; | 1967 bool ResourceDispatcherHost::is_prefetch_enabled_ = false; |
OLD | NEW |