| 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 #include "chrome/browser/net/chrome_url_request_context.h" | 5 #include "chrome/browser/net/chrome_url_request_context.h" |
| 6 | 6 |
| 7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "base/message_loop_proxy.h" | 9 #include "base/message_loop_proxy.h" |
| 10 #include "base/synchronization/waitable_event.h" | 10 #include "base/synchronization/waitable_event.h" |
| 11 #include "chrome/browser/browser_process.h" | 11 #include "chrome/browser/browser_process.h" |
| 12 #include "chrome/browser/io_thread.h" | 12 #include "chrome/browser/io_thread.h" |
| 13 #include "chrome/browser/prefs/pref_service.h" | 13 #include "chrome/browser/prefs/pref_service.h" |
| 14 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
| 15 #include "chrome/browser/profiles/profile_io_data.h" | 15 #include "chrome/browser/profiles/profile_io_data.h" |
| 16 #include "chrome/common/chrome_notification_types.h" | 16 #include "chrome/common/chrome_notification_types.h" |
| 17 #include "chrome/common/pref_names.h" | 17 #include "chrome/common/pref_names.h" |
| 18 #include "content/browser/browser_thread.h" | 18 #include "content/browser/browser_thread.h" |
| 19 #include "content/common/content_client.h" |
| 19 #include "content/common/notification_service.h" | 20 #include "content/common/notification_service.h" |
| 20 #include "net/base/cookie_store.h" | 21 #include "net/base/cookie_store.h" |
| 21 #include "net/http/http_util.h" | 22 #include "net/http/http_util.h" |
| 22 #include "webkit/glue/webkit_glue.h" | |
| 23 | 23 |
| 24 class ChromeURLRequestContextFactory { | 24 class ChromeURLRequestContextFactory { |
| 25 public: | 25 public: |
| 26 ChromeURLRequestContextFactory() {} | 26 ChromeURLRequestContextFactory() {} |
| 27 virtual ~ChromeURLRequestContextFactory() {} | 27 virtual ~ChromeURLRequestContextFactory() {} |
| 28 | 28 |
| 29 // Called to create a new instance (will only be called once). | 29 // Called to create a new instance (will only be called once). |
| 30 virtual scoped_refptr<ChromeURLRequestContext> Create() = 0; | 30 virtual scoped_refptr<ChromeURLRequestContext> Create() = 0; |
| 31 | 31 |
| 32 protected: | 32 protected: |
| (...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 DCHECK(backend); | 360 DCHECK(backend); |
| 361 chrome_url_data_manager_backend_ = backend; | 361 chrome_url_data_manager_backend_ = backend; |
| 362 } | 362 } |
| 363 | 363 |
| 364 ChromeURLRequestContext::~ChromeURLRequestContext() { | 364 ChromeURLRequestContext::~ChromeURLRequestContext() { |
| 365 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 365 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 366 } | 366 } |
| 367 | 367 |
| 368 const std::string& ChromeURLRequestContext::GetUserAgent( | 368 const std::string& ChromeURLRequestContext::GetUserAgent( |
| 369 const GURL& url) const { | 369 const GURL& url) const { |
| 370 return webkit_glue::GetUserAgent(url); | 370 return content::GetUserAgent(url); |
| 371 } | 371 } |
| 372 | 372 |
| 373 void ChromeURLRequestContext::OnAcceptLanguageChange( | 373 void ChromeURLRequestContext::OnAcceptLanguageChange( |
| 374 const std::string& accept_language) { | 374 const std::string& accept_language) { |
| 375 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 375 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 376 set_accept_language( | 376 set_accept_language( |
| 377 net::HttpUtil::GenerateAcceptLanguageHeader(accept_language)); | 377 net::HttpUtil::GenerateAcceptLanguageHeader(accept_language)); |
| 378 } | 378 } |
| 379 | 379 |
| 380 void ChromeURLRequestContext::OnDefaultCharsetChange( | 380 void ChromeURLRequestContext::OnDefaultCharsetChange( |
| 381 const std::string& default_charset) { | 381 const std::string& default_charset) { |
| 382 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 382 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 383 set_referrer_charset(default_charset); | 383 set_referrer_charset(default_charset); |
| 384 set_accept_charset( | 384 set_accept_charset( |
| 385 net::HttpUtil::GenerateAcceptCharsetHeader(default_charset)); | 385 net::HttpUtil::GenerateAcceptCharsetHeader(default_charset)); |
| 386 } | 386 } |
| OLD | NEW |