| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #import "ios/net/clients/crn_simple_network_client_factory.h" | 5 #import "ios/net/clients/crn_simple_network_client_factory.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/mac/scoped_nsobject.h" | 8 #include "base/mac/scoped_nsobject.h" |
| 9 #import "ios/net/clients/crn_forwarding_network_client.h" | 9 #import "ios/net/clients/crn_forwarding_network_client.h" |
| 10 | 10 |
| 11 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 12 #error "This file requires ARC support." |
| 13 #endif |
| 14 |
| 11 @interface CRNSimpleNetworkClientFactory () { | 15 @interface CRNSimpleNetworkClientFactory () { |
| 12 base::scoped_nsprotocol<Class> _clientClass; | 16 base::scoped_nsprotocol<Class> _clientClass; |
| 13 } | 17 } |
| 14 @end | 18 @end |
| 15 | 19 |
| 16 @implementation CRNSimpleNetworkClientFactory | 20 @implementation CRNSimpleNetworkClientFactory |
| 17 | 21 |
| 18 - (instancetype)initWithClass:(Class)clientClass { | 22 - (instancetype)initWithClass:(Class)clientClass { |
| 19 if (self = [super init]) { | 23 if (self = [super init]) { |
| 20 DCHECK([clientClass isSubclassOfClass:[CRNForwardingNetworkClient class]]); | 24 DCHECK([clientClass isSubclassOfClass:[CRNForwardingNetworkClient class]]); |
| 21 _clientClass.reset([clientClass retain]); | 25 _clientClass.reset(clientClass); |
| 22 } | 26 } |
| 23 return self; | 27 return self; |
| 24 } | 28 } |
| 25 | 29 |
| 26 - (CRNForwardingNetworkClient*)clientHandlingAnyRequest { | 30 - (CRNForwardingNetworkClient*)clientHandlingAnyRequest { |
| 27 return [[[_clientClass alloc] init] autorelease]; | 31 return [[_clientClass alloc] init]; |
| 28 } | 32 } |
| 29 | 33 |
| 30 - (Class)clientClass { | 34 - (Class)clientClass { |
| 31 return _clientClass; | 35 return _clientClass; |
| 32 } | 36 } |
| 33 | 37 |
| 34 @end | 38 @end |
| OLD | NEW |