Add ICU message format support
[chromium-blink-merge.git] / ios / net / clients / crn_forwarding_network_client.mm
blob8d8f114114b14bed6cba19912462c03af27ec07f
1 // Copyright 2013 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.
5 #import "ios/net/clients/crn_forwarding_network_client.h"
7 #include "base/logging.h"
8 #include "base/mac/scoped_nsobject.h"
9 #include "base/threading/thread_checker.h"
11 @implementation CRNForwardingNetworkClient {
12   // Next client in the client chain.
13   base::scoped_nsprotocol<id<CRNNetworkClientProtocol>> _underlyingClient;
14   base::ThreadChecker _threadChecker;
17 #pragma mark CRNNetworkClientProtocol methods
19 - (void)didFailWithNSErrorCode:(NSInteger)nsErrorCode
20                   netErrorCode:(int)netErrorCode {
21   DCHECK(_threadChecker.CalledOnValidThread());
22   DCHECK(_underlyingClient);
23   [_underlyingClient didFailWithNSErrorCode:nsErrorCode
24                                netErrorCode:netErrorCode];
27 - (void)didLoadData:(NSData*)data {
28   DCHECK(_threadChecker.CalledOnValidThread());
29   DCHECK(_underlyingClient);
30   [_underlyingClient didLoadData:data];
33 - (void)didReceiveResponse:(NSURLResponse*)response {
34   DCHECK(_threadChecker.CalledOnValidThread());
35   DCHECK(_underlyingClient);
36   [_underlyingClient didReceiveResponse:response];
39 - (void)wasRedirectedToRequest:(NSURLRequest*)request
40                  nativeRequest:(net::URLRequest*)nativeRequest
41               redirectResponse:(NSURLResponse*)response {
42   DCHECK(_threadChecker.CalledOnValidThread());
43   DCHECK(_underlyingClient);
44   [_underlyingClient wasRedirectedToRequest:request
45                               nativeRequest:nativeRequest
46                            redirectResponse:response];
49 - (void)didFinishLoading {
50   DCHECK(_threadChecker.CalledOnValidThread());
51   DCHECK(_underlyingClient);
52   [_underlyingClient didFinishLoading];
55 - (void)didCreateNativeRequest:(net::URLRequest*)nativeRequest {
56   DCHECK(_threadChecker.CalledOnValidThread());
57   DCHECK(_underlyingClient);
58   [_underlyingClient didCreateNativeRequest:nativeRequest];
61 - (void)didRecieveAuthChallenge:(net::AuthChallengeInfo*)authInfo
62                   nativeRequest:(const net::URLRequest&)nativeRequest
63                        callback:(const network_client::AuthCallback&)callback {
64   DCHECK(_threadChecker.CalledOnValidThread());
65   DCHECK(_underlyingClient);
66   [_underlyingClient didRecieveAuthChallenge:authInfo
67                                nativeRequest:nativeRequest
68                                     callback:callback];
71 - (void)cancelAuthRequest {
72   DCHECK(_threadChecker.CalledOnValidThread());
73   DCHECK(_underlyingClient);
74   [_underlyingClient cancelAuthRequest];
77 - (id<CRNNetworkClientProtocol>)underlyingClient {
78   return _underlyingClient;
81 - (void)setUnderlyingClient:(id<CRNNetworkClientProtocol>)underlyingClient {
82   DCHECK(_threadChecker.CalledOnValidThread());
83   DCHECK(underlyingClient);
84   _underlyingClient.reset([underlyingClient retain]);
87 @end