| Index: components/cronet/ios/cronet_consumer/cronet_consumer_app_delegate.mm
|
| diff --git a/ios/crnet/crnet_consumer/crnet_consumer_app_delegate.mm b/components/cronet/ios/cronet_consumer/cronet_consumer_app_delegate.mm
|
| similarity index 58%
|
| rename from ios/crnet/crnet_consumer/crnet_consumer_app_delegate.mm
|
| rename to components/cronet/ios/cronet_consumer/cronet_consumer_app_delegate.mm
|
| index d11245220c449ff5b791a4b0ca59583793a4dcbb..a6c0605fd053fc5829624714c7a2afdc015987f3 100644
|
| --- a/ios/crnet/crnet_consumer/crnet_consumer_app_delegate.mm
|
| +++ b/components/cronet/ios/cronet_consumer/cronet_consumer_app_delegate.mm
|
| @@ -2,14 +2,14 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#import "crnet_consumer_app_delegate.h"
|
| +#import "cronet_consumer_app_delegate.h"
|
|
|
| -#import <CrNet/CrNet.h>
|
| +#import <Cronet/Cronet.h>
|
|
|
| #include "base/format_macros.h"
|
| -#import "crnet_consumer_view_controller.h"
|
| +#import "cronet_consumer_view_controller.h"
|
|
|
| -@implementation CrNetConsumerAppDelegate {
|
| +@implementation CronetConsumerAppDelegate {
|
| NSUInteger _counter;
|
| }
|
|
|
| @@ -21,19 +21,19 @@
|
| // modifying that.
|
| - (NSString*)currentNetLogFileName {
|
| return [NSString
|
| - stringWithFormat:@"crnet-consumer-net-log%" PRIuNS ".json", _counter];
|
| + stringWithFormat:@"cronet-consumer-net-log%" PRIuNS ".json", _counter];
|
| }
|
|
|
| - (NSString*)SDCHPrefStoreFileName {
|
| NSFileManager* manager = [NSFileManager defaultManager];
|
| - NSArray* possibleURLs = [manager
|
| - URLsForDirectory:NSApplicationSupportDirectory
|
| - inDomains:NSUserDomainMask];
|
| + NSArray* possibleURLs =
|
| + [manager URLsForDirectory:NSApplicationSupportDirectory
|
| + inDomains:NSUserDomainMask];
|
| NSURL* appSupportDir = [possibleURLs firstObject];
|
| if (appSupportDir == nil)
|
| return nil;
|
| - NSURL* prefStoreFile = [NSURL URLWithString:@"sdch-prefs.json"
|
| - relativeToURL:appSupportDir];
|
| + NSURL* prefStoreFile =
|
| + [NSURL URLWithString:@"sdch-prefs.json" relativeToURL:appSupportDir];
|
| NSError* error = nil;
|
| [manager createDirectoryAtURL:appSupportDir
|
| withIntermediateDirectories:YES
|
| @@ -44,31 +44,30 @@
|
|
|
| - (BOOL)application:(UIApplication*)application
|
| didFinishLaunchingWithOptions:(NSDictionary*)launchOptions {
|
| - [CrNet setPartialUserAgent:@"Dummy/1.0"];
|
| - [CrNet setQuicEnabled:YES];
|
| - [CrNet setSDCHEnabled:YES withPrefStore:[self SDCHPrefStoreFileName]];
|
| - [CrNet install];
|
| - [CrNet startNetLogToFile:[self currentNetLogFileName] logBytes:NO];
|
| + [Cronet setUserAgent:@"Dummy/1.0" partial:YES];
|
| + [Cronet setQuicEnabled:YES];
|
| + [Cronet start];
|
| + [Cronet startNetLogToFile:[self currentNetLogFileName] logBytes:NO];
|
|
|
| NSURLSessionConfiguration* config =
|
| [NSURLSessionConfiguration ephemeralSessionConfiguration];
|
| - [CrNet installIntoSessionConfiguration:config];
|
| + [Cronet installIntoSessionConfiguration:config];
|
|
|
| - // Just for fun, don't route chromium.org requests through CrNet.
|
| + // Just for fun, don't route chromium.org requests through Cronet.
|
| //
|
| // |chromiumPrefix| is declared outside the scope of the request block so that
|
| // the block references something outside of its own scope, and cannot be
|
| // declared as a global block. This makes sure the block is
|
| // an __NSStackBlock__, and verifies the fix for http://crbug.com/436175 .
|
| - NSString *chromiumPrefix = @"www.chromium.org";
|
| - [CrNet setRequestFilterBlock:^BOOL (NSURLRequest *request) {
|
| - BOOL isChromiumSite = [[[request URL] host] hasPrefix:chromiumPrefix];
|
| - return !isChromiumSite;
|
| + NSString* chromiumPrefix = @"www.chromium.org";
|
| + [Cronet setRequestFilterBlock:^BOOL(NSURLRequest* request) {
|
| + BOOL isChromiumSite = [[[request URL] host] hasPrefix:chromiumPrefix];
|
| + return !isChromiumSite;
|
| }];
|
|
|
| self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
|
| self.viewController =
|
| - [[CrNetConsumerViewController alloc] initWithNibName:nil bundle:nil];
|
| + [[CronetConsumerViewController alloc] initWithNibName:nil bundle:nil];
|
| self.window.rootViewController = self.viewController;
|
| [self.window makeKeyAndVisible];
|
|
|
| @@ -76,15 +75,12 @@
|
| }
|
|
|
| - (void)applicationDidEnterBackground:(UIApplication*)application {
|
| - [CrNet stopNetLog];
|
| - [CrNet clearCacheWithCompletionCallback:^(int error) {
|
| - NSLog(@"Cache cleared: %d\n", error);
|
| - }];
|
| + [Cronet stopNetLog];
|
| }
|
|
|
| - (void)applicationWillEnterForeground:(UIApplication*)application {
|
| _counter++;
|
| - [CrNet startNetLogToFile:[self currentNetLogFileName] logBytes:NO];
|
| + [Cronet startNetLogToFile:[self currentNetLogFileName] logBytes:NO];
|
| }
|
|
|
| @end
|
|
|