Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(41)

Side by Side Diff: android_webview/browser/net/aw_url_request_context_getter.cc

Issue 10918279: Provide mutable members of UrlRequestContext via pure-virtual interface (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Disable test for chrome_frame_net_tests Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/automation/url_request_automation_job.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "android_webview/browser/net/aw_url_request_context_getter.h" 5 #include "android_webview/browser/net/aw_url_request_context_getter.h"
6 6
7 #include "android_webview/browser/aw_browser_context.h" 7 #include "android_webview/browser/aw_browser_context.h"
8 #include "android_webview/browser/aw_request_interceptor.h" 8 #include "android_webview/browser/aw_request_interceptor.h"
9 #include "android_webview/browser/net/aw_network_delegate.h" 9 #include "android_webview/browser/net/aw_network_delegate.h"
10 #include "android_webview/browser/net/aw_url_request_job_factory.h" 10 #include "android_webview/browser/net/aw_url_request_job_factory.h"
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 } 77 }
78 78
79 void AwURLRequestContextGetter::Init() { 79 void AwURLRequestContextGetter::Init() {
80 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 80 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
81 81
82 net::URLRequestContextBuilder builder; 82 net::URLRequestContextBuilder builder;
83 builder.set_user_agent(content::GetUserAgent(GURL())); 83 builder.set_user_agent(content::GetUserAgent(GURL()));
84 builder.set_network_delegate(new AwNetworkDelegate()); 84 builder.set_network_delegate(new AwNetworkDelegate());
85 builder.set_ftp_enabled(false); // Android WebView does not support ftp yet. 85 builder.set_ftp_enabled(false); // Android WebView does not support ftp yet.
86 builder.set_proxy_config_service(proxy_config_service_.release()); 86 builder.set_proxy_config_service(proxy_config_service_.release());
87 builder.set_accept_language(net::HttpUtil::GenerateAcceptLanguageHeader(
88 content::GetContentClient()->browser()->GetAcceptLangs(
89 browser_context_)));
90
91 // TODO(boliu): Values from chrome/app/resources/locale_settings_en-GB.xtb
92 builder.set_accept_charset(
93 net::HttpUtil::GenerateAcceptCharsetHeader("ISO-8859-1"));
87 94
88 net::URLRequestContextBuilder::HttpCacheParams cache_params; 95 net::URLRequestContextBuilder::HttpCacheParams cache_params;
89 cache_params.type = net::URLRequestContextBuilder::HttpCacheParams::DISK; 96 cache_params.type = net::URLRequestContextBuilder::HttpCacheParams::DISK;
90 cache_params.max_size = 10 * 1024 * 1024; // 10M 97 cache_params.max_size = 10 * 1024 * 1024; // 10M
91 cache_params.path = 98 cache_params.path =
92 browser_context_->GetPath().Append(FILE_PATH_LITERAL("Cache")), 99 browser_context_->GetPath().Append(FILE_PATH_LITERAL("Cache")),
93 builder.EnableHttpCache(cache_params); 100 builder.EnableHttpCache(cache_params);
94 101
95 url_request_context_.reset(builder.Build()); 102 url_request_context_.reset(builder.Build());
96 103
97 url_request_context_->set_accept_language(
98 net::HttpUtil::GenerateAcceptLanguageHeader(
99 content::GetContentClient()->browser()->GetAcceptLangs(
100 browser_context_)));
101
102 // TODO(boliu): Values from chrome/app/resources/locale_settings_en-GB.xtb
103 url_request_context_->set_accept_charset(
104 net::HttpUtil::GenerateAcceptCharsetHeader("ISO-8859-1"));
105
106 job_factory_.reset(new AwURLRequestJobFactory); 104 job_factory_.reset(new AwURLRequestJobFactory);
107 bool set_protocol = job_factory_->SetProtocolHandler( 105 bool set_protocol = job_factory_->SetProtocolHandler(
108 chrome::kFileScheme, new net::FileProtocolHandler()); 106 chrome::kFileScheme, new net::FileProtocolHandler());
109 DCHECK(set_protocol); 107 DCHECK(set_protocol);
110 set_protocol = job_factory_->SetProtocolHandler( 108 set_protocol = job_factory_->SetProtocolHandler(
111 chrome::kDataScheme, new net::DataProtocolHandler()); 109 chrome::kDataScheme, new net::DataProtocolHandler());
112 DCHECK(set_protocol); 110 DCHECK(set_protocol);
113 job_factory_->AddInterceptor(new AwRequestInterceptor()); 111 job_factory_->AddInterceptor(new AwRequestInterceptor());
114 url_request_context_->set_job_factory(job_factory_.get()); 112 url_request_context_->set_job_factory(job_factory_.get());
115 113
(...skipping 12 matching lines...) Expand all
128 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 126 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
129 return url_request_context_.get(); 127 return url_request_context_.get();
130 } 128 }
131 129
132 scoped_refptr<base::SingleThreadTaskRunner> 130 scoped_refptr<base::SingleThreadTaskRunner>
133 AwURLRequestContextGetter::GetNetworkTaskRunner() const { 131 AwURLRequestContextGetter::GetNetworkTaskRunner() const {
134 return BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO); 132 return BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO);
135 } 133 }
136 134
137 } // namespace android_webview 135 } // namespace android_webview
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/automation/url_request_automation_job.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698