Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(183)

Side by Side Diff: ios/web/web_state/error_translation_util.mm

Issue 2096973002: [ios] Do not show SSL interstitial if cert is absent or cannot be parsed (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added unittest Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/web/web_state/error_translation_util.h" 5 #import "ios/web/web_state/error_translation_util.h"
6 6
7 #include <CFNetwork/CFNetwork.h> 7 #include <CFNetwork/CFNetwork.h>
8 8
9 #import "base/ios/ns_error_util.h" 9 #import "base/ios/ns_error_util.h"
10 #include "base/mac/scoped_nsobject.h" 10 #include "base/mac/scoped_nsobject.h"
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 base::ios::GetFinalUnderlyingErrorFromError(error); 150 base::ios::GetFinalUnderlyingErrorFromError(error);
151 151
152 NSInteger net_error_code = net::ERR_FAILED; 152 NSInteger net_error_code = net::ERR_FAILED;
153 if ([underlying_error.domain isEqualToString:NSURLErrorDomain] || 153 if ([underlying_error.domain isEqualToString:NSURLErrorDomain] ||
154 [underlying_error.domain 154 [underlying_error.domain
155 isEqualToString:static_cast<NSString*>(kCFErrorDomainCFNetwork)]) { 155 isEqualToString:static_cast<NSString*>(kCFErrorDomainCFNetwork)]) {
156 // Attempt to translate NSURL and CFNetwork error codes into their 156 // Attempt to translate NSURL and CFNetwork error codes into their
157 // corresponding net error codes. 157 // corresponding net error codes.
158 GetNetErrorFromIOSErrorCode(underlying_error.code, &net_error_code); 158 GetNetErrorFromIOSErrorCode(underlying_error.code, &net_error_code);
159 } 159 }
160 return NetErrorFromError(error, net_error_code);
161 }
160 162
163 NSError* NetErrorFromError(NSError* error, NSInteger net_error_code) {
164 DCHECK(error);
161 NSString* net_error_domain = 165 NSString* net_error_domain =
162 [NSString stringWithUTF8String:net::kErrorDomain]; 166 [NSString stringWithUTF8String:net::kErrorDomain];
163 NSError* net_error = [NSError errorWithDomain:net_error_domain 167 NSError* net_error = [NSError errorWithDomain:net_error_domain
164 code:net_error_code 168 code:net_error_code
165 userInfo:nil]; 169 userInfo:nil];
166 return base::ios::ErrorWithAppendedUnderlyingError(error, net_error); 170 return base::ios::ErrorWithAppendedUnderlyingError(error, net_error);
167 } 171 }
168 172
169 } // namespace web 173 } // namespace web
OLDNEW
« no previous file with comments | « ios/web/web_state/error_translation_util.h ('k') | ios/web/web_state/error_translation_util_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698