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 // This file contains an implementation of the ResourceLoaderBridge class. | 5 // This file contains an implementation of the ResourceLoaderBridge class. |
6 // The class is implemented using net::URLRequest, meaning it is a "simple" | 6 // The class is implemented using net::URLRequest, meaning it is a "simple" |
7 // version that directly issues requests. The more complicated one used in the | 7 // version that directly issues requests. The more complicated one used in the |
8 // browser uses IPC. | 8 // browser uses IPC. |
9 // | 9 // |
10 // Because net::URLRequest only provides an asynchronous resource loading API, | 10 // Because net::URLRequest only provides an asynchronous resource loading API, |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 | 170 |
171 StaticCookiePolicy policy(policy_type); | 171 StaticCookiePolicy policy(policy_type); |
172 int rv = policy.CanSetCookie( | 172 int rv = policy.CanSetCookie( |
173 request.url(), request.first_party_for_cookies()); | 173 request.url(), request.first_party_for_cookies()); |
174 return rv == net::OK; | 174 return rv == net::OK; |
175 } | 175 } |
176 virtual bool OnCanAccessFile(const net::URLRequest& request, | 176 virtual bool OnCanAccessFile(const net::URLRequest& request, |
177 const FilePath& path) const OVERRIDE { | 177 const FilePath& path) const OVERRIDE { |
178 return true; | 178 return true; |
179 } | 179 } |
| 180 virtual bool OnCanThrottleRequest( |
| 181 const net::URLRequest& request) const OVERRIDE { |
| 182 return false; |
| 183 } |
| 184 |
180 }; | 185 }; |
181 | 186 |
182 TestShellRequestContextParams* g_request_context_params = NULL; | 187 TestShellRequestContextParams* g_request_context_params = NULL; |
183 TestShellRequestContext* g_request_context = NULL; | 188 TestShellRequestContext* g_request_context = NULL; |
184 TestShellNetworkDelegate* g_network_delegate = NULL; | 189 TestShellNetworkDelegate* g_network_delegate = NULL; |
185 base::Thread* g_cache_thread = NULL; | 190 base::Thread* g_cache_thread = NULL; |
186 | 191 |
187 struct FileOverHTTPParams { | 192 struct FileOverHTTPParams { |
188 FileOverHTTPParams(std::string in_file_path_template, GURL in_http_prefix) | 193 FileOverHTTPParams(std::string in_file_path_template, GURL in_http_prefix) |
189 : file_path_template(in_file_path_template), | 194 : file_path_template(in_file_path_template), |
(...skipping 933 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1123 (http_prefix.SchemeIs("http") || http_prefix.SchemeIs("https"))); | 1128 (http_prefix.SchemeIs("http") || http_prefix.SchemeIs("https"))); |
1124 g_file_over_http_params = new FileOverHTTPParams(file_path_template, | 1129 g_file_over_http_params = new FileOverHTTPParams(file_path_template, |
1125 http_prefix); | 1130 http_prefix); |
1126 } | 1131 } |
1127 | 1132 |
1128 // static | 1133 // static |
1129 webkit_glue::ResourceLoaderBridge* SimpleResourceLoaderBridge::Create( | 1134 webkit_glue::ResourceLoaderBridge* SimpleResourceLoaderBridge::Create( |
1130 const webkit_glue::ResourceLoaderBridge::RequestInfo& request_info) { | 1135 const webkit_glue::ResourceLoaderBridge::RequestInfo& request_info) { |
1131 return new ResourceLoaderBridgeImpl(request_info); | 1136 return new ResourceLoaderBridgeImpl(request_info); |
1132 } | 1137 } |
OLD | NEW |