| Index: chrome/browser/net/chrome_url_request_context.cc
|
| diff --git a/chrome/browser/net/chrome_url_request_context.cc b/chrome/browser/net/chrome_url_request_context.cc
|
| index 212b2f6c0621648e0f1cbb649d40de63b4928a05..2983222f931bd8e85594643664cf09d39674997b 100644
|
| --- a/chrome/browser/net/chrome_url_request_context.cc
|
| +++ b/chrome/browser/net/chrome_url_request_context.cc
|
| @@ -11,17 +11,10 @@
|
| #include "chrome/browser/browser_process.h"
|
| #include "chrome/browser/io_thread.h"
|
| #include "chrome/browser/net/load_time_stats.h"
|
| -#include "chrome/browser/prefs/pref_service.h"
|
| #include "chrome/browser/profiles/profile.h"
|
| #include "chrome/browser/profiles/profile_io_data.h"
|
| -#include "chrome/common/chrome_notification_types.h"
|
| -#include "chrome/common/pref_names.h"
|
| #include "content/public/browser/browser_thread.h"
|
| -#include "content/public/browser/notification_details.h"
|
| -#include "content/public/browser/notification_source.h"
|
| -#include "content/public/common/content_client.h"
|
| #include "net/cookies/cookie_store.h"
|
| -#include "net/http/http_util.h"
|
|
|
| using content::BrowserThread;
|
|
|
| @@ -154,19 +147,12 @@ class FactoryForMedia : public ChromeURLRequestContextFactory {
|
| // ----------------------------------------------------------------------------
|
|
|
| ChromeURLRequestContextGetter::ChromeURLRequestContextGetter(
|
| - Profile* profile,
|
| ChromeURLRequestContextFactory* factory)
|
| : factory_(factory) {
|
| DCHECK(factory);
|
| - DCHECK(profile);
|
| - RegisterPrefsObserver(profile);
|
| }
|
|
|
| -ChromeURLRequestContextGetter::~ChromeURLRequestContextGetter() {
|
| - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
|
| -
|
| - DCHECK(registrar_.IsEmpty()) << "Probably didn't call CleanupOnUIThread";
|
| -}
|
| +ChromeURLRequestContextGetter::~ChromeURLRequestContextGetter() {}
|
|
|
| // Lazily create a ChromeURLRequestContext using our factory.
|
| net::URLRequestContext* ChromeURLRequestContextGetter::GetURLRequestContext() {
|
| @@ -196,7 +182,6 @@ ChromeURLRequestContextGetter* ChromeURLRequestContextGetter::CreateOriginal(
|
| const ProfileIOData* profile_io_data) {
|
| DCHECK(!profile->IsOffTheRecord());
|
| return new ChromeURLRequestContextGetter(
|
| - profile,
|
| new FactoryForMain(profile_io_data));
|
| }
|
|
|
| @@ -206,7 +191,6 @@ ChromeURLRequestContextGetter::CreateOriginalForMedia(
|
| Profile* profile, const ProfileIOData* profile_io_data) {
|
| DCHECK(!profile->IsOffTheRecord());
|
| return new ChromeURLRequestContextGetter(
|
| - profile,
|
| new FactoryForMedia(profile_io_data));
|
| }
|
|
|
| @@ -216,7 +200,6 @@ ChromeURLRequestContextGetter::CreateOriginalForExtensions(
|
| Profile* profile, const ProfileIOData* profile_io_data) {
|
| DCHECK(!profile->IsOffTheRecord());
|
| return new ChromeURLRequestContextGetter(
|
| - profile,
|
| new FactoryForExtensions(profile_io_data));
|
| }
|
|
|
| @@ -232,7 +215,6 @@ ChromeURLRequestContextGetter::CreateOriginalForIsolatedApp(
|
| ChromeURLRequestContextGetter* main_context =
|
| static_cast<ChromeURLRequestContextGetter*>(profile->GetRequestContext());
|
| return new ChromeURLRequestContextGetter(
|
| - profile,
|
| new FactoryForIsolatedApp(profile_io_data, app_id, main_context,
|
| protocol_handler_interceptor.Pass()));
|
| }
|
| @@ -246,7 +228,6 @@ ChromeURLRequestContextGetter::CreateOriginalForIsolatedMedia(
|
| const std::string& app_id) {
|
| DCHECK(!profile->IsOffTheRecord());
|
| return new ChromeURLRequestContextGetter(
|
| - profile,
|
| new FactoryForIsolatedMedia(profile_io_data, app_id, app_context));
|
| }
|
|
|
| @@ -256,7 +237,7 @@ ChromeURLRequestContextGetter::CreateOffTheRecord(
|
| Profile* profile, const ProfileIOData* profile_io_data) {
|
| DCHECK(profile->IsOffTheRecord());
|
| return new ChromeURLRequestContextGetter(
|
| - profile, new FactoryForMain(profile_io_data));
|
| + new FactoryForMain(profile_io_data));
|
| }
|
|
|
| // static
|
| @@ -265,7 +246,7 @@ ChromeURLRequestContextGetter::CreateOffTheRecordForExtensions(
|
| Profile* profile, const ProfileIOData* profile_io_data) {
|
| DCHECK(profile->IsOffTheRecord());
|
| return new ChromeURLRequestContextGetter(
|
| - profile, new FactoryForExtensions(profile_io_data));
|
| + new FactoryForExtensions(profile_io_data));
|
| }
|
|
|
| // static
|
| @@ -280,70 +261,10 @@ ChromeURLRequestContextGetter::CreateOffTheRecordForIsolatedApp(
|
| ChromeURLRequestContextGetter* main_context =
|
| static_cast<ChromeURLRequestContextGetter*>(profile->GetRequestContext());
|
| return new ChromeURLRequestContextGetter(
|
| - profile,
|
| new FactoryForIsolatedApp(profile_io_data, app_id, main_context,
|
| protocol_handler_interceptor.Pass()));
|
| }
|
|
|
| -void ChromeURLRequestContextGetter::CleanupOnUIThread() {
|
| - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
| - // Unregister for pref notifications.
|
| - DCHECK(!registrar_.IsEmpty()) << "Called more than once!";
|
| - registrar_.RemoveAll();
|
| -}
|
| -
|
| -// content::NotificationObserver implementation.
|
| -void ChromeURLRequestContextGetter::Observe(
|
| - int type,
|
| - const content::NotificationSource& source,
|
| - const content::NotificationDetails& details) {
|
| - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
| -
|
| - if (chrome::NOTIFICATION_PREF_CHANGED == type) {
|
| - std::string* pref_name_in = content::Details<std::string>(details).ptr();
|
| - PrefService* prefs = content::Source<PrefService>(source).ptr();
|
| - DCHECK(pref_name_in && prefs);
|
| - if (*pref_name_in == prefs::kAcceptLanguages) {
|
| - std::string accept_language =
|
| - prefs->GetString(prefs::kAcceptLanguages);
|
| - BrowserThread::PostTask(
|
| - BrowserThread::IO, FROM_HERE,
|
| - base::Bind(
|
| - &ChromeURLRequestContextGetter::OnAcceptLanguageChange,
|
| - this,
|
| - accept_language));
|
| - } else if (*pref_name_in == prefs::kDefaultCharset) {
|
| - std::string default_charset = prefs->GetString(prefs::kDefaultCharset);
|
| - BrowserThread::PostTask(
|
| - BrowserThread::IO, FROM_HERE,
|
| - base::Bind(
|
| - &ChromeURLRequestContextGetter::OnDefaultCharsetChange,
|
| - this,
|
| - default_charset));
|
| - }
|
| - } else {
|
| - NOTREACHED();
|
| - }
|
| -}
|
| -
|
| -void ChromeURLRequestContextGetter::RegisterPrefsObserver(Profile* profile) {
|
| - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
| -
|
| - registrar_.Init(profile->GetPrefs());
|
| - registrar_.Add(prefs::kAcceptLanguages, this);
|
| - registrar_.Add(prefs::kDefaultCharset, this);
|
| -}
|
| -
|
| -void ChromeURLRequestContextGetter::OnAcceptLanguageChange(
|
| - const std::string& accept_language) {
|
| - GetIOContext()->OnAcceptLanguageChange(accept_language);
|
| -}
|
| -
|
| -void ChromeURLRequestContextGetter::OnDefaultCharsetChange(
|
| - const std::string& default_charset) {
|
| - GetIOContext()->OnDefaultCharsetChange(default_charset);
|
| -}
|
| -
|
| // ----------------------------------------------------------------------------
|
| // ChromeURLRequestContext
|
| // ----------------------------------------------------------------------------
|
| @@ -384,23 +305,3 @@ void ChromeURLRequestContext::set_chrome_url_data_manager_backend(
|
| DCHECK(backend);
|
| chrome_url_data_manager_backend_ = backend;
|
| }
|
| -
|
| -const std::string& ChromeURLRequestContext::GetUserAgent(
|
| - const GURL& url) const {
|
| - return content::GetUserAgent(url);
|
| -}
|
| -
|
| -void ChromeURLRequestContext::OnAcceptLanguageChange(
|
| - const std::string& accept_language) {
|
| - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
|
| - set_accept_language(
|
| - net::HttpUtil::GenerateAcceptLanguageHeader(accept_language));
|
| -}
|
| -
|
| -void ChromeURLRequestContext::OnDefaultCharsetChange(
|
| - const std::string& default_charset) {
|
| - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
|
| - set_referrer_charset(default_charset);
|
| - set_accept_charset(
|
| - net::HttpUtil::GenerateAcceptCharsetHeader(default_charset));
|
| -}
|
|
|