| 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 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 384 const std::string& ChromeURLRequestContext::GetUserAgent( | 384 const std::string& ChromeURLRequestContext::GetUserAgent( |
| 385 const GURL& url) const { | 385 const GURL& url) const { |
| 386 return webkit_glue::GetUserAgent(url); | 386 return webkit_glue::GetUserAgent(url); |
| 387 } | 387 } |
| 388 | 388 |
| 389 bool ChromeURLRequestContext::interceptCookie(const URLRequest* request, | 389 bool ChromeURLRequestContext::interceptCookie(const URLRequest* request, |
| 390 std::string* cookie) { | 390 std::string* cookie) { |
| 391 const URLRequest::UserData* d = | 391 const URLRequest::UserData* d = |
| 392 request->GetUserData((void*)&Blacklist::kRequestDataKey); | 392 request->GetUserData((void*)&Blacklist::kRequestDataKey); |
| 393 if (d) { | 393 if (d) { |
| 394 const Blacklist::Entry* entry = | 394 const Blacklist::Match* match = static_cast<const Blacklist::Match*>(d); |
| 395 static_cast<const Blacklist::RequestData*>(d)->entry(); | 395 if (match->attributes() & Blacklist::kDontStoreCookies) { |
| 396 if (entry->attributes() & Blacklist::kDontStoreCookies) { | |
| 397 cookie->clear(); | 396 cookie->clear(); |
| 398 return false; | 397 return false; |
| 399 } | 398 } |
| 400 if (entry->attributes() & Blacklist::kDontPersistCookies) { | 399 if (match->attributes() & Blacklist::kDontPersistCookies) { |
| 401 *cookie = Blacklist::StripCookieExpiry(*cookie); | 400 *cookie = Blacklist::StripCookieExpiry(*cookie); |
| 402 } | 401 } |
| 403 } | 402 } |
| 404 return true; | 403 return true; |
| 405 } | 404 } |
| 406 | 405 |
| 407 bool ChromeURLRequestContext::allowSendingCookies(const URLRequest* request) | 406 bool ChromeURLRequestContext::allowSendingCookies(const URLRequest* request) |
| 408 const { | 407 const { |
| 409 const URLRequest::UserData* d = | 408 const URLRequest::UserData* d = |
| 410 request->GetUserData((void*)&Blacklist::kRequestDataKey); | 409 request->GetUserData((void*)&Blacklist::kRequestDataKey); |
| 411 if (d) { | 410 if (d) { |
| 412 const Blacklist::Entry* entry = | 411 const Blacklist::Match* match = static_cast<const Blacklist::Match*>(d); |
| 413 static_cast<const Blacklist::RequestData*>(d)->entry(); | 412 if (match->attributes() & Blacklist::kDontSendCookies) |
| 414 if (entry->attributes() & Blacklist::kDontSendCookies) | |
| 415 return false; | 413 return false; |
| 416 } | 414 } |
| 417 return true; | 415 return true; |
| 418 } | 416 } |
| 419 | 417 |
| 420 void ChromeURLRequestContext::OnAcceptLanguageChange( | 418 void ChromeURLRequestContext::OnAcceptLanguageChange( |
| 421 const std::string& accept_language) { | 419 const std::string& accept_language) { |
| 422 DCHECK(MessageLoop::current() == | 420 DCHECK(MessageLoop::current() == |
| 423 ChromeThread::GetMessageLoop(ChromeThread::IO)); | 421 ChromeThread::GetMessageLoop(ChromeThread::IO)); |
| 424 accept_language_ = | 422 accept_language_ = |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 458 // Do not delete the cookie store in the case of the media context, as it is | 456 // Do not delete the cookie store in the case of the media context, as it is |
| 459 // owned by the original context. | 457 // owned by the original context. |
| 460 if (!is_media_) | 458 if (!is_media_) |
| 461 delete cookie_store_; | 459 delete cookie_store_; |
| 462 | 460 |
| 463 // Do not delete the proxy service in the case of OTR or media contexts, as | 461 // Do not delete the proxy service in the case of OTR or media contexts, as |
| 464 // it is owned by the original URLRequestContext. | 462 // it is owned by the original URLRequestContext. |
| 465 if (!is_off_the_record_ && !is_media_) | 463 if (!is_off_the_record_ && !is_media_) |
| 466 delete proxy_service_; | 464 delete proxy_service_; |
| 467 } | 465 } |
| OLD | NEW |