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

Side by Side Diff: ios/chrome/browser/chrome_url_util.mm

Issue 1868763002: Remove URLRequest::IsHandledProtocol and IsHandledURL (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase (needs fixing) Created 4 years, 2 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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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/chrome/browser/chrome_url_util.h" 5 #import "ios/chrome/browser/chrome_url_util.h"
6 6
7 #import <UIKit/UIKit.h> 7 #import <UIKit/UIKit.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/mac/scoped_block.h" 10 #include "base/mac/scoped_block.h"
(...skipping 27 matching lines...) Expand all
38 bool UrlHasChromeScheme(const GURL& url) { 38 bool UrlHasChromeScheme(const GURL& url) {
39 return url.SchemeIs(kChromeUIScheme); 39 return url.SchemeIs(kChromeUIScheme);
40 } 40 }
41 41
42 bool UrlHasChromeScheme(NSURL* url) { 42 bool UrlHasChromeScheme(NSURL* url) {
43 return net::UrlSchemeIs(url, base::SysUTF8ToNSString(kChromeUIScheme)); 43 return net::UrlSchemeIs(url, base::SysUTF8ToNSString(kChromeUIScheme));
44 } 44 }
45 45
46 bool IsHandledProtocol(const std::string& scheme) { 46 bool IsHandledProtocol(const std::string& scheme) {
47 DCHECK_EQ(scheme, base::ToLowerASCII(scheme)); 47 DCHECK_EQ(scheme, base::ToLowerASCII(scheme));
48 if (scheme == url::kAboutScheme) 48 static const char* const kProtocolList[] = {
49 return true; 49 kChromeUIScheme, url::kDataScheme, url::kAboutScheme, url::kHttpScheme,
50 if (scheme == url::kDataScheme) 50 url::kHttpsScheme, url::kWsScheme, url::kWssScheme,
51 return true; 51 };
52 if (scheme == kChromeUIScheme) 52 for (size_t i = 0; i < arraysize(kProtocolList); ++i) {
53 return true; 53 if (scheme == kProtocolList[i])
54 return net::URLRequest::IsHandledProtocol(scheme); 54 return true;
55 }
56 return false;
55 } 57 }
56 58
57 @implementation ChromeAppConstants { 59 @implementation ChromeAppConstants {
58 base::scoped_nsobject<NSString> _callbackScheme; 60 base::scoped_nsobject<NSString> _callbackScheme;
59 base::mac::ScopedBlock<AppIconURLProvider> _appIconURLProvider; 61 base::mac::ScopedBlock<AppIconURLProvider> _appIconURLProvider;
60 } 62 }
61 63
62 + (ChromeAppConstants*)sharedInstance { 64 + (ChromeAppConstants*)sharedInstance {
63 static ChromeAppConstants* g_instance = [[ChromeAppConstants alloc] init]; 65 static ChromeAppConstants* g_instance = [[ChromeAppConstants alloc] init];
64 return g_instance; 66 return g_instance;
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 105
104 - (void)setCallbackSchemeForTesting:(NSString*)scheme { 106 - (void)setCallbackSchemeForTesting:(NSString*)scheme {
105 _callbackScheme.reset([scheme copy]); 107 _callbackScheme.reset([scheme copy]);
106 } 108 }
107 109
108 - (void)setAppIconURLProviderForTesting:(AppIconURLProvider)block { 110 - (void)setAppIconURLProviderForTesting:(AppIconURLProvider)block {
109 _appIconURLProvider.reset(block, base::scoped_policy::RETAIN); 111 _appIconURLProvider.reset(block, base::scoped_policy::RETAIN);
110 } 112 }
111 113
112 @end 114 @end
OLDNEW
« no previous file with comments | « ios/chrome/browser/browser_state/chrome_browser_state_io_data.cc ('k') | net/url_request/url_request.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698