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