Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(465)

Side by Side Diff: ios/chrome/app/startup/network_stack_setup.mm

Issue 2580363002: Upstream Chrome on iOS source code [1/11]. (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 "ios/chrome/app/startup/network_stack_setup.h"
6
7 #include "base/memory/ptr_util.h"
8 #include "ios/chrome/browser/application_context.h"
9 #include "ios/chrome/browser/chrome_url_constants.h"
10 #import "ios/net/empty_nsurlcache.h"
11 #include "ios/web/net/request_tracker_factory_impl.h"
12 #include "ios/web/net/web_http_protocol_handler_delegate.h"
13
14 @implementation NetworkStackSetup
15
16 + (void)setUpChromeNetworkStack:
17 (std::unique_ptr<web::RequestTrackerFactoryImpl>*)
18 requestTrackerFactory
19 httpProtocolHandlerDelegate:
20 (std::unique_ptr<web::WebHTTPProtocolHandlerDelegate>*)
21 httpProtocolHandlerDelegate {
22 // Disable the default cache.
23 [NSURLCache setSharedURLCache:[EmptyNSURLCache emptyNSURLCache]];
24
25 // Configuration for the HTTP protocol handler.
26 // TODO(crbug.com/585700): Remove this code.
27 *httpProtocolHandlerDelegate =
28 base::MakeUnique<web::WebHTTPProtocolHandlerDelegate>(
29 GetApplicationContext()->GetSystemURLRequestContext());
30 net::HTTPProtocolHandlerDelegate::SetInstance(
31 httpProtocolHandlerDelegate->get());
32
33 // Register the chrome http protocol handler to replace the default one.
34 // TODO(crbug.com/665036): Move the network stack initialization to the web
35 // layer.
36 BOOL success = [NSURLProtocol registerClass:[CRNHTTPProtocolHandler class]];
37 DCHECK(success);
38 *requestTrackerFactory =
39 base::MakeUnique<web::RequestTrackerFactoryImpl>(kChromeUIScheme);
40 net::RequestTracker::SetRequestTrackerFactory(requestTrackerFactory->get());
41
42 DCHECK(success);
43 }
44
45 @end
OLDNEW
« no previous file with comments | « ios/chrome/app/startup/network_stack_setup.h ('k') | ios/chrome/app/startup/provider_registration.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698