| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 454 | 454 |
| 455 virtual bool CanSetCookie(net::URLRequest* request, | 455 virtual bool CanSetCookie(net::URLRequest* request, |
| 456 const std::string& cookie_line, | 456 const std::string& cookie_line, |
| 457 net::CookieOptions* options) { | 457 net::CookieOptions* options) { |
| 458 StaticCookiePolicy::Type policy_type = g_accept_all_cookies ? | 458 StaticCookiePolicy::Type policy_type = g_accept_all_cookies ? |
| 459 StaticCookiePolicy::ALLOW_ALL_COOKIES : | 459 StaticCookiePolicy::ALLOW_ALL_COOKIES : |
| 460 StaticCookiePolicy::BLOCK_SETTING_THIRD_PARTY_COOKIES; | 460 StaticCookiePolicy::BLOCK_SETTING_THIRD_PARTY_COOKIES; |
| 461 | 461 |
| 462 StaticCookiePolicy policy(policy_type); | 462 StaticCookiePolicy policy(policy_type); |
| 463 int rv = policy.CanSetCookie( | 463 int rv = policy.CanSetCookie( |
| 464 request->url(), request->first_party_for_cookies(), cookie_line); | 464 request->url(), request->first_party_for_cookies()); |
| 465 return rv == net::OK; | 465 return rv == net::OK; |
| 466 } | 466 } |
| 467 | 467 |
| 468 virtual void OnReadCompleted(net::URLRequest* request, int bytes_read) { | 468 virtual void OnReadCompleted(net::URLRequest* request, int bytes_read) { |
| 469 if (request->status().is_success() && bytes_read > 0) { | 469 if (request->status().is_success() && bytes_read > 0) { |
| 470 OnReceivedData(bytes_read); | 470 OnReceivedData(bytes_read); |
| 471 } else { | 471 } else { |
| 472 Done(); | 472 Done(); |
| 473 } | 473 } |
| 474 } | 474 } |
| (...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 913 | 913 |
| 914 // static | 914 // static |
| 915 scoped_refptr<base::MessageLoopProxy> | 915 scoped_refptr<base::MessageLoopProxy> |
| 916 SimpleResourceLoaderBridge::GetIoThread() { | 916 SimpleResourceLoaderBridge::GetIoThread() { |
| 917 if (!EnsureIOThread()) { | 917 if (!EnsureIOThread()) { |
| 918 LOG(DFATAL) << "Failed to create IO thread."; | 918 LOG(DFATAL) << "Failed to create IO thread."; |
| 919 return NULL; | 919 return NULL; |
| 920 } | 920 } |
| 921 return g_io_thread->message_loop_proxy(); | 921 return g_io_thread->message_loop_proxy(); |
| 922 } | 922 } |
| OLD | NEW |