OLD | NEW |
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 29 matching lines...) Expand all Loading... |
40 return url.SchemeIs(ios::GetChromeBrowserProvider()->GetChromeUIScheme()); | 40 return url.SchemeIs(ios::GetChromeBrowserProvider()->GetChromeUIScheme()); |
41 } | 41 } |
42 | 42 |
43 bool UrlHasChromeScheme(NSURL* url) { | 43 bool UrlHasChromeScheme(NSURL* url) { |
44 return net::UrlSchemeIs( | 44 return net::UrlSchemeIs( |
45 url, base::SysUTF8ToNSString( | 45 url, base::SysUTF8ToNSString( |
46 ios::GetChromeBrowserProvider()->GetChromeUIScheme())); | 46 ios::GetChromeBrowserProvider()->GetChromeUIScheme())); |
47 } | 47 } |
48 | 48 |
49 bool IsHandledProtocol(const std::string& scheme) { | 49 bool IsHandledProtocol(const std::string& scheme) { |
50 DCHECK_EQ(scheme, base::StringToLowerASCII(scheme)); | 50 DCHECK_EQ(scheme, base::ToLowerASCII(scheme)); |
51 if (scheme == url::kAboutScheme) | 51 if (scheme == url::kAboutScheme) |
52 return true; | 52 return true; |
53 if (scheme == url::kDataScheme) | 53 if (scheme == url::kDataScheme) |
54 return true; | 54 return true; |
55 if (scheme == ios::GetChromeBrowserProvider()->GetChromeUIScheme()) | 55 if (scheme == ios::GetChromeBrowserProvider()->GetChromeUIScheme()) |
56 return true; | 56 return true; |
57 return net::URLRequest::IsHandledProtocol(scheme); | 57 return net::URLRequest::IsHandledProtocol(scheme); |
58 } | 58 } |
59 | 59 |
60 @implementation ChromeAppConstants { | 60 @implementation ChromeAppConstants { |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 | 106 |
107 - (void)setCallbackSchemeForTesting:(NSString*)scheme { | 107 - (void)setCallbackSchemeForTesting:(NSString*)scheme { |
108 _callbackScheme.reset([scheme copy]); | 108 _callbackScheme.reset([scheme copy]); |
109 } | 109 } |
110 | 110 |
111 - (void)setAppIconURLProviderForTesting:(AppIconURLProvider)block { | 111 - (void)setAppIconURLProviderForTesting:(AppIconURLProvider)block { |
112 _appIconURLProvider.reset(block, base::scoped_policy::RETAIN); | 112 _appIconURLProvider.reset(block, base::scoped_policy::RETAIN); |
113 } | 113 } |
114 | 114 |
115 @end | 115 @end |
OLD | NEW |