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 #ifndef IOS_CHROME_BROWSER_CHROME_URL_UTIL_H_ | 5 #ifndef IOS_CHROME_BROWSER_CHROME_URL_UTIL_H_ |
6 #define IOS_CHROME_BROWSER_CHROME_URL_UTIL_H_ | 6 #define IOS_CHROME_BROWSER_CHROME_URL_UTIL_H_ |
7 | 7 |
8 #import <Foundation/Foundation.h> | 8 #import <Foundation/Foundation.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 class GURL; | 12 class GURL; |
13 | 13 |
14 // Returns whether |url| is an external file reference. | 14 // Returns whether |url| is an external file reference. |
15 bool UrlIsExternalFileReference(const GURL& url); | 15 bool UrlIsExternalFileReference(const GURL& url); |
16 | 16 |
17 // Returns a URL that launches Chrome. | |
18 NSURL* UrlToLaunchChrome(); | |
19 | |
20 // Returns the URL for the iOS App Icon for Chrome. | |
21 NSURL* UrlOfChromeAppIcon(int width, int height); | |
22 | |
23 // Returns true if the scheme has a chrome scheme. | 17 // Returns true if the scheme has a chrome scheme. |
24 bool UrlHasChromeScheme(const GURL& url); | 18 bool UrlHasChromeScheme(const GURL& url); |
25 bool UrlHasChromeScheme(NSURL* url); | 19 bool UrlHasChromeScheme(NSURL* url); |
26 | 20 |
27 // Returns true if |scheme| is handled in Chrome, or by default handlers in | 21 // Returns true if |scheme| is handled in Chrome, or by default handlers in |
28 // net::URLRequest. | 22 // net::URLRequest. |
29 bool IsHandledProtocol(const std::string& scheme); | 23 bool IsHandledProtocol(const std::string& scheme); |
30 | 24 |
31 // Singleton object that generates constants for Chrome iOS applications. | 25 // Singleton object that generates constants for Chrome iOS applications. |
32 // Behavior of this object can be overridden by unit tests. | 26 // Behavior of this object can be overridden by unit tests. |
33 @interface ChromeAppConstants : NSObject | 27 @interface ChromeAppConstants : NSObject |
34 | 28 |
35 // Class method returning the singleton instance. | 29 // Class method returning the singleton instance. |
36 + (ChromeAppConstants*)sharedInstance; | 30 + (ChromeAppConstants*)sharedInstance; |
37 | 31 |
38 // Returns the URL scheme that launches Chrome. | 32 // Returns the URL scheme that launches Chrome. |
39 - (NSString*)getBundleURLScheme; | 33 - (NSString*)getBundleURLScheme; |
40 | 34 |
41 // Returns the URL string to the Chrome application icon. | |
42 - (NSString*)getChromeAppIconURLOfWidth:(int)width height:(int)height; | |
43 | |
44 // Method to set the scheme to callback Chrome iOS for testing. | 35 // Method to set the scheme to callback Chrome iOS for testing. |
45 - (void)setCallbackSchemeForTesting:(NSString*)callbackScheme; | 36 - (void)setCallbackSchemeForTesting:(NSString*)callbackScheme; |
46 | 37 |
47 // Method to set a different block to provider the App Icon URL. | |
48 typedef NSString* (^AppIconURLProvider)(int, int); | |
49 - (void)setAppIconURLProviderForTesting:(AppIconURLProvider)block; | |
50 | |
51 @end | 38 @end |
52 | 39 |
53 #endif // IOS_CHROME_BROWSER_CHROME_URL_UTIL_H_ | 40 #endif // IOS_CHROME_BROWSER_CHROME_URL_UTIL_H_ |
OLD | NEW |