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

Side by Side Diff: mojo/loader/url_request_context_getter.cc

Issue 27536014: Teach mojo_shell how to load data URLs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 2 months 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 | « mojo/loader/url_request_context_getter.h ('k') | mojo/mojo.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "mojo/loader/url_request_context_getter.h"
6 #include "net/cookies/cookie_monster.h"
7 #include "net/proxy/proxy_service.h"
8 #include "net/ssl/ssl_config_service_defaults.h"
9 #include "net/url_request/data_protocol_handler.h"
10 #include "net/url_request/url_request_context.h"
11 #include "net/url_request/url_request_job_factory_impl.h"
12
13 namespace mojo {
14 namespace loader {
15
16 URLRequestContextGetter::URLRequestContextGetter()
17 : net_log_(new net::NetLog()) {
18 }
19
20 URLRequestContextGetter::~URLRequestContextGetter() {
21 }
22
23 net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() {
24 if (!url_request_context_) {
25 url_request_context_.reset(new net::URLRequestContext());
26 url_request_context_->set_net_log(net_log_.get());
27
28 storage_.reset(
29 new net::URLRequestContextStorage(url_request_context_.get()));
30
31 storage_->set_cookie_store(new net::CookieMonster(NULL, NULL));
32 storage_->set_proxy_service(net::ProxyService::CreateDirect());
33 storage_->set_ssl_config_service(new net::SSLConfigServiceDefaults);
34 storage_->set_host_resolver(net::HostResolver::CreateDefaultResolver(
35 url_request_context_->net_log()));
36
37 scoped_ptr<net::URLRequestJobFactoryImpl> job_factory(
38 new net::URLRequestJobFactoryImpl());
39
40 bool set_protocol = job_factory->SetProtocolHandler(
41 "data", new net::DataProtocolHandler());
42 CHECK(set_protocol);
43
44 storage_->set_job_factory(job_factory.release());
45 }
46
47 return url_request_context_.get();
48 }
49
50 scoped_refptr<base::SingleThreadTaskRunner>
51 URLRequestContextGetter::GetNetworkTaskRunner() const {
52 // TODO(abarth): Move network requests to a background thread.
53 return base::MessageLoopProxy::current();
54 }
55
56 } // namespace loader
57 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/loader/url_request_context_getter.h ('k') | mojo/mojo.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698