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 "ios/chrome/app/startup/network_stack_setup.h" | 5 #include "ios/chrome/app/startup/network_stack_setup.h" |
6 | 6 |
7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
8 #include "ios/chrome/browser/application_context.h" | 8 #include "ios/chrome/browser/application_context.h" |
9 #include "ios/chrome/browser/chrome_url_constants.h" | 9 #include "ios/chrome/browser/chrome_url_constants.h" |
10 #import "ios/net/empty_nsurlcache.h" | 10 #import "ios/net/empty_nsurlcache.h" |
11 #include "ios/web/net/request_tracker_factory_impl.h" | 11 #include "ios/web/net/request_tracker_factory_impl.h" |
12 #include "ios/web/net/web_http_protocol_handler_delegate.h" | 12 #include "ios/web/net/web_http_protocol_handler_delegate.h" |
13 | 13 |
| 14 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 15 #error "This file requires ARC support." |
| 16 #endif |
| 17 |
14 @implementation NetworkStackSetup | 18 @implementation NetworkStackSetup |
15 | 19 |
16 + (void)setUpChromeNetworkStack: | 20 + (void)setUpChromeNetworkStack: |
17 (std::unique_ptr<web::RequestTrackerFactoryImpl>*) | 21 (std::unique_ptr<web::RequestTrackerFactoryImpl>*) |
18 requestTrackerFactory | 22 requestTrackerFactory |
19 httpProtocolHandlerDelegate: | 23 httpProtocolHandlerDelegate: |
20 (std::unique_ptr<web::WebHTTPProtocolHandlerDelegate>*) | 24 (std::unique_ptr<web::WebHTTPProtocolHandlerDelegate>*) |
21 httpProtocolHandlerDelegate { | 25 httpProtocolHandlerDelegate { |
22 // Disable the default cache. | 26 // Disable the default cache. |
23 [NSURLCache setSharedURLCache:[EmptyNSURLCache emptyNSURLCache]]; | 27 [NSURLCache setSharedURLCache:[EmptyNSURLCache emptyNSURLCache]]; |
(...skipping 12 matching lines...) Expand all Loading... |
36 BOOL success = [NSURLProtocol registerClass:[CRNHTTPProtocolHandler class]]; | 40 BOOL success = [NSURLProtocol registerClass:[CRNHTTPProtocolHandler class]]; |
37 DCHECK(success); | 41 DCHECK(success); |
38 *requestTrackerFactory = | 42 *requestTrackerFactory = |
39 base::MakeUnique<web::RequestTrackerFactoryImpl>(kChromeUIScheme); | 43 base::MakeUnique<web::RequestTrackerFactoryImpl>(kChromeUIScheme); |
40 net::RequestTracker::SetRequestTrackerFactory(requestTrackerFactory->get()); | 44 net::RequestTracker::SetRequestTrackerFactory(requestTrackerFactory->get()); |
41 | 45 |
42 DCHECK(success); | 46 DCHECK(success); |
43 } | 47 } |
44 | 48 |
45 @end | 49 @end |
OLD | NEW |