| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 URLRequest, meaning it is a "simple" version | 6 // The class is implemented using URLRequest, meaning it is a "simple" version |
| 7 // that directly issues requests. The more complicated one used in the | 7 // that directly issues requests. The more complicated one used in the |
| 8 // browser uses IPC. | 8 // browser uses IPC. |
| 9 // | 9 // |
| 10 // Because URLRequest only provides an asynchronous resource loading API, this | 10 // Because URLRequest only provides an asynchronous resource loading API, this |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 if (request->status().is_success()) { | 306 if (request->status().is_success()) { |
| 307 ResourceLoaderBridge::ResponseInfo info; | 307 ResourceLoaderBridge::ResponseInfo info; |
| 308 PopulateResponseInfo(request, &info); | 308 PopulateResponseInfo(request, &info); |
| 309 OnReceivedResponse(info, false); | 309 OnReceivedResponse(info, false); |
| 310 AsyncReadData(); // start reading | 310 AsyncReadData(); // start reading |
| 311 } else { | 311 } else { |
| 312 Done(); | 312 Done(); |
| 313 } | 313 } |
| 314 } | 314 } |
| 315 | 315 |
| 316 virtual void OnSSLCertificateError(URLRequest* request, |
| 317 int cert_error, |
| 318 net::X509Certificate* cert) { |
| 319 // Allow all certificate errors. |
| 320 request->ContinueDespiteLastError(); |
| 321 } |
| 322 |
| 316 virtual void OnReadCompleted(URLRequest* request, int bytes_read) { | 323 virtual void OnReadCompleted(URLRequest* request, int bytes_read) { |
| 317 if (request->status().is_success() && bytes_read > 0) { | 324 if (request->status().is_success() && bytes_read > 0) { |
| 318 OnReceivedData(bytes_read); | 325 OnReceivedData(bytes_read); |
| 319 } else { | 326 } else { |
| 320 Done(); | 327 Done(); |
| 321 } | 328 } |
| 322 } | 329 } |
| 323 | 330 |
| 324 // -------------------------------------------------------------------------- | 331 // -------------------------------------------------------------------------- |
| 325 // Helpers and data: | 332 // Helpers and data: |
| (...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 715 options.message_loop_type = MessageLoop::TYPE_IO; | 722 options.message_loop_type = MessageLoop::TYPE_IO; |
| 716 return io_thread->StartWithOptions(options); | 723 return io_thread->StartWithOptions(options); |
| 717 } | 724 } |
| 718 | 725 |
| 719 // static | 726 // static |
| 720 void SimpleResourceLoaderBridge::SetAcceptAllCookies(bool accept_all_cookies) { | 727 void SimpleResourceLoaderBridge::SetAcceptAllCookies(bool accept_all_cookies) { |
| 721 CookiePolicy::Type policy_type = accept_all_cookies ? | 728 CookiePolicy::Type policy_type = accept_all_cookies ? |
| 722 CookiePolicy::ALLOW_ALL_COOKIES : CookiePolicy::BLOCK_THIRD_PARTY_COOKIES; | 729 CookiePolicy::ALLOW_ALL_COOKIES : CookiePolicy::BLOCK_THIRD_PARTY_COOKIES; |
| 723 request_context->cookie_policy()->set_type(policy_type); | 730 request_context->cookie_policy()->set_type(policy_type); |
| 724 } | 731 } |
| OLD | NEW |