| 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 #include "chrome/browser/net/chrome_url_request_context.h" | 5 #include "chrome/browser/net/chrome_url_request_context.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
| 10 #include "chrome/browser/privacy_blacklist/blacklist.h" | 10 #include "chrome/browser/privacy_blacklist/blacklist.h" |
| (...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 } | 393 } |
| 394 | 394 |
| 395 const std::string& ChromeURLRequestContext::GetUserAgent( | 395 const std::string& ChromeURLRequestContext::GetUserAgent( |
| 396 const GURL& url) const { | 396 const GURL& url) const { |
| 397 return webkit_glue::GetUserAgent(url); | 397 return webkit_glue::GetUserAgent(url); |
| 398 } | 398 } |
| 399 | 399 |
| 400 bool ChromeURLRequestContext::interceptCookie(const URLRequest* request, | 400 bool ChromeURLRequestContext::interceptCookie(const URLRequest* request, |
| 401 std::string* cookie) { | 401 std::string* cookie) { |
| 402 const URLRequest::UserData* d = | 402 const URLRequest::UserData* d = |
| 403 request->GetUserData((void*)&Blacklist::kRequestDataKey); | 403 request->GetUserData(&Blacklist::kRequestDataKey); |
| 404 if (d) { | 404 if (d) { |
| 405 const Blacklist::Match* match = static_cast<const Blacklist::Match*>(d); | 405 const Blacklist::Match* match = static_cast<const Blacklist::Match*>(d); |
| 406 if (match->attributes() & Blacklist::kDontStoreCookies) { | 406 if (match->attributes() & Blacklist::kDontStoreCookies) { |
| 407 cookie->clear(); | 407 cookie->clear(); |
| 408 return false; | 408 return false; |
| 409 } | 409 } |
| 410 if (match->attributes() & Blacklist::kDontPersistCookies) { | 410 if (match->attributes() & Blacklist::kDontPersistCookies) { |
| 411 *cookie = Blacklist::StripCookieExpiry(*cookie); | 411 *cookie = Blacklist::StripCookieExpiry(*cookie); |
| 412 } | 412 } |
| 413 } | 413 } |
| 414 return true; | 414 return true; |
| 415 } | 415 } |
| 416 | 416 |
| 417 bool ChromeURLRequestContext::allowSendingCookies(const URLRequest* request) | 417 bool ChromeURLRequestContext::allowSendingCookies(const URLRequest* request) |
| 418 const { | 418 const { |
| 419 const URLRequest::UserData* d = | 419 const URLRequest::UserData* d = |
| 420 request->GetUserData((void*)&Blacklist::kRequestDataKey); | 420 request->GetUserData(&Blacklist::kRequestDataKey); |
| 421 if (d) { | 421 if (d) { |
| 422 const Blacklist::Match* match = static_cast<const Blacklist::Match*>(d); | 422 const Blacklist::Match* match = static_cast<const Blacklist::Match*>(d); |
| 423 if (match->attributes() & Blacklist::kDontSendCookies) | 423 if (match->attributes() & Blacklist::kDontSendCookies) |
| 424 return false; | 424 return false; |
| 425 } | 425 } |
| 426 return true; | 426 return true; |
| 427 } | 427 } |
| 428 | 428 |
| 429 void ChromeURLRequestContext::OnAcceptLanguageChange( | 429 void ChromeURLRequestContext::OnAcceptLanguageChange( |
| 430 const std::string& accept_language) { | 430 const std::string& accept_language) { |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 476 // Do not delete the cookie store in the case of the media context, as it is | 476 // Do not delete the cookie store in the case of the media context, as it is |
| 477 // owned by the original context. | 477 // owned by the original context. |
| 478 if (!is_media_) | 478 if (!is_media_) |
| 479 delete cookie_store_; | 479 delete cookie_store_; |
| 480 | 480 |
| 481 // Do not delete the proxy service in the case of OTR or media contexts, as | 481 // Do not delete the proxy service in the case of OTR or media contexts, as |
| 482 // it is owned by the original URLRequestContext. | 482 // it is owned by the original URLRequestContext. |
| 483 if (!is_off_the_record_ && !is_media_) | 483 if (!is_off_the_record_ && !is_media_) |
| 484 delete proxy_service_; | 484 delete proxy_service_; |
| 485 } | 485 } |
| OLD | NEW |