blob: 9ffd9d255b69b798cdd2c87da6bdad53bfae8984 [file] [log] [blame]
// 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