| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "ios/chrome/browser/net/ios_chrome_url_request_context_getter.h" | 5 #include "ios/chrome/browser/net/ios_chrome_url_request_context_getter.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/memory/ptr_util.h" |
| 10 #include "base/message_loop/message_loop.h" | 11 #include "base/message_loop/message_loop.h" |
| 11 #include "ios/chrome/browser/browser_state/chrome_browser_state_io_data.h" | 12 #include "ios/chrome/browser/browser_state/chrome_browser_state_io_data.h" |
| 12 #include "ios/chrome/browser/ios_chrome_io_thread.h" | 13 #include "ios/chrome/browser/ios_chrome_io_thread.h" |
| 13 #include "ios/web/public/web_thread.h" | 14 #include "ios/web/public/web_thread.h" |
| 14 #include "net/cookies/cookie_store.h" | 15 #include "net/cookies/cookie_store.h" |
| 15 | 16 |
| 16 class IOSChromeURLRequestContextFactory { | 17 class IOSChromeURLRequestContextFactory { |
| 17 public: | 18 public: |
| 18 IOSChromeURLRequestContextFactory() {} | 19 IOSChromeURLRequestContextFactory() {} |
| 19 virtual ~IOSChromeURLRequestContextFactory() {} | 20 virtual ~IOSChromeURLRequestContextFactory() {} |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 scoped_refptr<net::URLRequestContextGetter> main_request_context_getter_; | 77 scoped_refptr<net::URLRequestContextGetter> main_request_context_getter_; |
| 77 }; | 78 }; |
| 78 | 79 |
| 79 } // namespace | 80 } // namespace |
| 80 | 81 |
| 81 // ---------------------------------------------------------------------------- | 82 // ---------------------------------------------------------------------------- |
| 82 // IOSChromeURLRequestContextGetter | 83 // IOSChromeURLRequestContextGetter |
| 83 // ---------------------------------------------------------------------------- | 84 // ---------------------------------------------------------------------------- |
| 84 | 85 |
| 85 IOSChromeURLRequestContextGetter::IOSChromeURLRequestContextGetter( | 86 IOSChromeURLRequestContextGetter::IOSChromeURLRequestContextGetter( |
| 86 scoped_ptr<IOSChromeURLRequestContextFactory> factory) | 87 std::unique_ptr<IOSChromeURLRequestContextFactory> factory) |
| 87 : factory_(std::move(factory)), url_request_context_(nullptr) { | 88 : factory_(std::move(factory)), url_request_context_(nullptr) { |
| 88 DCHECK(factory_); | 89 DCHECK(factory_); |
| 89 } | 90 } |
| 90 | 91 |
| 91 IOSChromeURLRequestContextGetter::~IOSChromeURLRequestContextGetter() { | 92 IOSChromeURLRequestContextGetter::~IOSChromeURLRequestContextGetter() { |
| 92 // NotifyContextShuttingDown() must have been called. | 93 // NotifyContextShuttingDown() must have been called. |
| 93 DCHECK(!factory_.get()); | 94 DCHECK(!factory_.get()); |
| 94 DCHECK(!url_request_context_); | 95 DCHECK(!url_request_context_); |
| 95 } | 96 } |
| 96 | 97 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 119 scoped_refptr<base::SingleThreadTaskRunner> | 120 scoped_refptr<base::SingleThreadTaskRunner> |
| 120 IOSChromeURLRequestContextGetter::GetNetworkTaskRunner() const { | 121 IOSChromeURLRequestContextGetter::GetNetworkTaskRunner() const { |
| 121 return web::WebThread::GetTaskRunnerForThread(web::WebThread::IO); | 122 return web::WebThread::GetTaskRunnerForThread(web::WebThread::IO); |
| 122 } | 123 } |
| 123 | 124 |
| 124 // static | 125 // static |
| 125 IOSChromeURLRequestContextGetter* IOSChromeURLRequestContextGetter::Create( | 126 IOSChromeURLRequestContextGetter* IOSChromeURLRequestContextGetter::Create( |
| 126 const ChromeBrowserStateIOData* io_data, | 127 const ChromeBrowserStateIOData* io_data, |
| 127 ProtocolHandlerMap* protocol_handlers) { | 128 ProtocolHandlerMap* protocol_handlers) { |
| 128 return new IOSChromeURLRequestContextGetter( | 129 return new IOSChromeURLRequestContextGetter( |
| 129 make_scoped_ptr(new FactoryForMain(io_data, protocol_handlers))); | 130 base::WrapUnique(new FactoryForMain(io_data, protocol_handlers))); |
| 130 } | 131 } |
| 131 | 132 |
| 132 // static | 133 // static |
| 133 IOSChromeURLRequestContextGetter* | 134 IOSChromeURLRequestContextGetter* |
| 134 IOSChromeURLRequestContextGetter::CreateForIsolatedApp( | 135 IOSChromeURLRequestContextGetter::CreateForIsolatedApp( |
| 135 net::URLRequestContextGetter* main_context, | 136 net::URLRequestContextGetter* main_context, |
| 136 const ChromeBrowserStateIOData* io_data, | 137 const ChromeBrowserStateIOData* io_data, |
| 137 const base::FilePath& partition_path) { | 138 const base::FilePath& partition_path) { |
| 138 return new IOSChromeURLRequestContextGetter(make_scoped_ptr( | 139 return new IOSChromeURLRequestContextGetter(base::WrapUnique( |
| 139 new FactoryForIsolatedApp(io_data, partition_path, main_context))); | 140 new FactoryForIsolatedApp(io_data, partition_path, main_context))); |
| 140 } | 141 } |
| OLD | NEW |