| 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/browser_state/chrome_browser_state_io_data.h" | 5 #include "ios/chrome/browser/browser_state/chrome_browser_state_io_data.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 it->second->AssertNoURLRequests(); | 228 it->second->AssertNoURLRequests(); |
| 229 delete it->second; | 229 delete it->second; |
| 230 current_context++; | 230 current_context++; |
| 231 } | 231 } |
| 232 } | 232 } |
| 233 | 233 |
| 234 // static | 234 // static |
| 235 bool ChromeBrowserStateIOData::IsHandledProtocol(const std::string& scheme) { | 235 bool ChromeBrowserStateIOData::IsHandledProtocol(const std::string& scheme) { |
| 236 DCHECK_EQ(scheme, base::ToLowerASCII(scheme)); | 236 DCHECK_EQ(scheme, base::ToLowerASCII(scheme)); |
| 237 static const char* const kProtocolList[] = { | 237 static const char* const kProtocolList[] = { |
| 238 url::kFileScheme, kChromeUIScheme, url::kDataScheme, url::kAboutScheme, | 238 url::kFileScheme, kChromeUIScheme, url::kDataScheme, url::kAboutScheme, |
| 239 url::kHttpScheme, url::kHttpsScheme, url::kWsScheme, url::kWssScheme, |
| 239 }; | 240 }; |
| 240 for (size_t i = 0; i < arraysize(kProtocolList); ++i) { | 241 for (size_t i = 0; i < arraysize(kProtocolList); ++i) { |
| 241 if (scheme == kProtocolList[i]) | 242 if (scheme == kProtocolList[i]) |
| 242 return true; | 243 return true; |
| 243 } | 244 } |
| 244 return net::URLRequest::IsHandledProtocol(scheme); | 245 return false; |
| 245 } | 246 } |
| 246 | 247 |
| 247 // static | 248 // static |
| 248 void ChromeBrowserStateIOData::InstallProtocolHandlers( | 249 void ChromeBrowserStateIOData::InstallProtocolHandlers( |
| 249 net::URLRequestJobFactoryImpl* job_factory, | 250 net::URLRequestJobFactoryImpl* job_factory, |
| 250 ProtocolHandlerMap* protocol_handlers) { | 251 ProtocolHandlerMap* protocol_handlers) { |
| 251 for (ProtocolHandlerMap::iterator it = protocol_handlers->begin(); | 252 for (ProtocolHandlerMap::iterator it = protocol_handlers->begin(); |
| 252 it != protocol_handlers->end(); ++it) { | 253 it != protocol_handlers->end(); ++it) { |
| 253 bool set_protocol = job_factory->SetProtocolHandler( | 254 bool set_protocol = job_factory->SetProtocolHandler( |
| 254 it->first, base::WrapUnique(it->second.release())); | 255 it->first, base::WrapUnique(it->second.release())); |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 484 return std::unique_ptr<net::HttpCache>( | 485 return std::unique_ptr<net::HttpCache>( |
| 485 new net::HttpCache(session, std::move(main_backend), true)); | 486 new net::HttpCache(session, std::move(main_backend), true)); |
| 486 } | 487 } |
| 487 | 488 |
| 488 std::unique_ptr<net::HttpCache> ChromeBrowserStateIOData::CreateHttpFactory( | 489 std::unique_ptr<net::HttpCache> ChromeBrowserStateIOData::CreateHttpFactory( |
| 489 net::HttpNetworkSession* shared_session, | 490 net::HttpNetworkSession* shared_session, |
| 490 std::unique_ptr<net::HttpCache::BackendFactory> backend) const { | 491 std::unique_ptr<net::HttpCache::BackendFactory> backend) const { |
| 491 return std::unique_ptr<net::HttpCache>( | 492 return std::unique_ptr<net::HttpCache>( |
| 492 new net::HttpCache(shared_session, std::move(backend), true)); | 493 new net::HttpCache(shared_session, std::move(backend), true)); |
| 493 } | 494 } |
| OLD | NEW |