Index: ios/net/clients/crn_simple_network_client_factory.mm |
diff --git a/ios/net/clients/crn_simple_network_client_factory.mm b/ios/net/clients/crn_simple_network_client_factory.mm |
new file mode 100644 |
index 0000000000000000000000000000000000000000..9ffd9d255b69b798cdd2c87da6bdad53bfae8984 |
--- /dev/null |
+++ b/ios/net/clients/crn_simple_network_client_factory.mm |
@@ -0,0 +1,34 @@ |
+// Copyright 2014 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#import "ios/net/clients/crn_simple_network_client_factory.h" |
+ |
+#include "base/logging.h" |
+#include "base/mac/scoped_nsobject.h" |
+#import "ios/net/clients/crn_forwarding_network_client.h" |
+ |
+@interface CRNSimpleNetworkClientFactory () { |
+ base::scoped_nsprotocol<Class> _clientClass; |
+} |
+@end |
+ |
+@implementation CRNSimpleNetworkClientFactory |
+ |
+- (instancetype)initWithClass:(Class)clientClass { |
+ if (self = [super init]) { |
+ DCHECK([clientClass isSubclassOfClass:[CRNForwardingNetworkClient class]]); |
+ _clientClass.reset([clientClass retain]); |
+ } |
+ return self; |
+} |
+ |
+- (CRNForwardingNetworkClient*)clientHandlingAnyRequest { |
+ return [[[_clientClass alloc] init] autorelease]; |
+} |
+ |
+- (Class)clientClass { |
+ return _clientClass; |
+} |
+ |
+@end |