OLD | NEW |
| (Empty) |
1 // Copyright 2016 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 "blimp/engine/app/blimp_system_url_request_context_getter.h" | |
6 | |
7 #include <utility> | |
8 #include <vector> | |
9 | |
10 #include "base/logging.h" | |
11 #include "base/single_thread_task_runner.h" | |
12 #include "blimp/engine/common/blimp_user_agent.h" | |
13 #include "content/public/browser/browser_thread.h" | |
14 #include "net/proxy/proxy_service.h" | |
15 #include "net/url_request/url_request_context.h" | |
16 #include "net/url_request/url_request_context_builder.h" | |
17 | |
18 namespace blimp { | |
19 namespace engine { | |
20 | |
21 BlimpSystemURLRequestContextGetter::BlimpSystemURLRequestContextGetter() { | |
22 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | |
23 } | |
24 | |
25 BlimpSystemURLRequestContextGetter::~BlimpSystemURLRequestContextGetter() {} | |
26 | |
27 net::URLRequestContext* | |
28 BlimpSystemURLRequestContextGetter::GetURLRequestContext() { | |
29 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); | |
30 if (!url_request_context_) { | |
31 // Use default values | |
32 net::URLRequestContextBuilder builder; | |
33 | |
34 // TODO(jessicag): See if proxy_service setup should be harmonized with | |
35 // user request context getter. http://crbug/609981 | |
36 builder.set_proxy_service(net::ProxyService::CreateDirect()); | |
37 builder.set_user_agent(GetBlimpEngineUserAgent()); | |
38 url_request_context_ = builder.Build(); | |
39 } | |
40 return url_request_context_.get(); | |
41 } | |
42 | |
43 scoped_refptr<base::SingleThreadTaskRunner> | |
44 BlimpSystemURLRequestContextGetter::GetNetworkTaskRunner() const { | |
45 return content::BrowserThread::GetTaskRunnerForThread( | |
46 content::BrowserThread::IO); | |
47 } | |
48 | |
49 } // namespace engine | |
50 } // namespace blimp | |
OLD | NEW |