Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 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 "blimp/engine/app/blimp_system_url_request_context_getter.h" | 5 #include "blimp/engine/app/blimp_system_url_request_context_getter.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/single_thread_task_runner.h" | 11 #include "base/single_thread_task_runner.h" |
| 12 #include "blimp/engine/common/blimp_user_agent.h" | |
| 12 #include "content/public/browser/browser_thread.h" | 13 #include "content/public/browser/browser_thread.h" |
| 13 #include "net/proxy/proxy_service.h" | 14 #include "net/proxy/proxy_service.h" |
| 14 #include "net/url_request/url_request_context.h" | 15 #include "net/url_request/url_request_context.h" |
| 15 #include "net/url_request/url_request_context_builder.h" | 16 #include "net/url_request/url_request_context_builder.h" |
| 16 | 17 |
| 17 namespace blimp { | 18 namespace blimp { |
| 18 namespace engine { | 19 namespace engine { |
| 19 | 20 |
| 20 BlimpSystemURLRequestContextGetter::BlimpSystemURLRequestContextGetter() { | 21 BlimpSystemURLRequestContextGetter::BlimpSystemURLRequestContextGetter() { |
| 21 // Must first be created on the UI thread. | 22 // Must first be created on the UI thread. |
|
Kevin M
2016/06/06 22:00:17
IMO the code already makes this clear :)
Jess
2016/06/06 22:10:38
Removed.
| |
| 22 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 23 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 23 } | 24 } |
| 24 | 25 |
| 25 BlimpSystemURLRequestContextGetter::~BlimpSystemURLRequestContextGetter() {} | 26 BlimpSystemURLRequestContextGetter::~BlimpSystemURLRequestContextGetter() {} |
| 26 | 27 |
| 27 net::URLRequestContext* | 28 net::URLRequestContext* |
| 28 BlimpSystemURLRequestContextGetter::GetURLRequestContext() { | 29 BlimpSystemURLRequestContextGetter::GetURLRequestContext() { |
| 29 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); | 30 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); |
| 30 if (!url_request_context_) { | 31 if (!url_request_context_) { |
| 31 // Use default values | 32 // Use default values |
| 32 net::URLRequestContextBuilder builder; | 33 net::URLRequestContextBuilder builder; |
| 33 // TODO(jessicag): See if proxy_service setup should be harmonized with | 34 // TODO(jessicag): See if proxy_service setup should be harmonized with |
|
Kevin M
2016/06/06 22:00:17
Put newlines before comments
Jess
2016/06/06 22:10:38
Done.
| |
| 34 // user request context getter. http://crbug/609981 | 35 // user request context getter. http://crbug/609981 |
| 35 builder.set_proxy_service(net::ProxyService::CreateDirect()); | 36 builder.set_proxy_service(net::ProxyService::CreateDirect()); |
| 37 // Metrics service ignores upload without appropriate user agent. | |
|
Kevin M
2016/06/06 22:00:17
Comment seems unnecessarily defensive - it's reaso
Jess
2016/06/06 22:10:38
Done.
| |
| 38 builder.set_user_agent(GetBlimpEngineUserAgent()); | |
| 36 url_request_context_ = builder.Build(); | 39 url_request_context_ = builder.Build(); |
| 37 } | 40 } |
| 38 return url_request_context_.get(); | 41 return url_request_context_.get(); |
| 39 } | 42 } |
| 40 | 43 |
| 41 scoped_refptr<base::SingleThreadTaskRunner> | 44 scoped_refptr<base::SingleThreadTaskRunner> |
| 42 BlimpSystemURLRequestContextGetter::GetNetworkTaskRunner() const { | 45 BlimpSystemURLRequestContextGetter::GetNetworkTaskRunner() const { |
| 43 return content::BrowserThread::GetMessageLoopProxyForThread( | 46 return content::BrowserThread::GetMessageLoopProxyForThread( |
| 44 content::BrowserThread::IO); | 47 content::BrowserThread::IO); |
| 45 } | 48 } |
| 46 | 49 |
| 47 } // namespace engine | 50 } // namespace engine |
| 48 } // namespace blimp | 51 } // namespace blimp |
| OLD | NEW |