| OLD | NEW |
| 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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 url_request_context_.reset(builder.Build()); | 102 url_request_context_.reset(builder.Build()); |
| 103 | 103 |
| 104 job_factory_.reset(new AwURLRequestJobFactory); | 104 job_factory_.reset(new AwURLRequestJobFactory); |
| 105 bool set_protocol = job_factory_->SetProtocolHandler( | 105 bool set_protocol = job_factory_->SetProtocolHandler( |
| 106 chrome::kFileScheme, new net::FileProtocolHandler()); | 106 chrome::kFileScheme, new net::FileProtocolHandler()); |
| 107 DCHECK(set_protocol); | 107 DCHECK(set_protocol); |
| 108 set_protocol = job_factory_->SetProtocolHandler( | 108 set_protocol = job_factory_->SetProtocolHandler( |
| 109 chrome::kDataScheme, new net::DataProtocolHandler()); | 109 chrome::kDataScheme, new net::DataProtocolHandler()); |
| 110 DCHECK(set_protocol); | 110 DCHECK(set_protocol); |
| 111 job_factory_->AddInterceptor(new AwRequestInterceptor()); | 111 job_factory_->AddInterceptor(new AwRequestInterceptor()); |
| 112 |
| 113 job_factory_ = OnNetworkStackInitialized(url_request_context_.get(), |
| 114 job_factory_.Pass()); |
| 112 url_request_context_->set_job_factory(job_factory_.get()); | 115 url_request_context_->set_job_factory(job_factory_.get()); |
| 113 | |
| 114 OnNetworkStackInitialized(url_request_context_.get(), | |
| 115 job_factory_.get()); | |
| 116 } | 116 } |
| 117 | 117 |
| 118 content::ResourceContext* AwURLRequestContextGetter::GetResourceContext() { | 118 content::ResourceContext* AwURLRequestContextGetter::GetResourceContext() { |
| 119 DCHECK(url_request_context_); | 119 DCHECK(url_request_context_); |
| 120 if (!resource_context_) | 120 if (!resource_context_) |
| 121 resource_context_.reset(new AwResourceContext(url_request_context_.get())); | 121 resource_context_.reset(new AwResourceContext(url_request_context_.get())); |
| 122 return resource_context_.get(); | 122 return resource_context_.get(); |
| 123 } | 123 } |
| 124 | 124 |
| 125 net::URLRequestContext* AwURLRequestContextGetter::GetURLRequestContext() { | 125 net::URLRequestContext* AwURLRequestContextGetter::GetURLRequestContext() { |
| 126 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 126 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 127 return url_request_context_.get(); | 127 return url_request_context_.get(); |
| 128 } | 128 } |
| 129 | 129 |
| 130 scoped_refptr<base::SingleThreadTaskRunner> | 130 scoped_refptr<base::SingleThreadTaskRunner> |
| 131 AwURLRequestContextGetter::GetNetworkTaskRunner() const { | 131 AwURLRequestContextGetter::GetNetworkTaskRunner() const { |
| 132 return BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO); | 132 return BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO); |
| 133 } | 133 } |
| 134 | 134 |
| 135 } // namespace android_webview | 135 } // namespace android_webview |
| OLD | NEW |