OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 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. |
| 4 |
| 5 #ifndef _IOS_CHROME_BROWSER_WEB_MAILTO_HANDLER_H_ |
| 6 #define _IOS_CHROME_BROWSER_WEB_MAILTO_HANDLER_H_ |
| 7 |
| 8 #import <Foundation/Foundation.h> |
| 9 |
| 10 class GURL; |
| 11 |
| 12 // MailtoHandler is the base class for Mail client apps that can handle |
| 13 // mailto: URLs via custom URL schemes. To add support for Mail clients, |
| 14 // subclass from this and add it to MailtoURLRewriter class. |
| 15 @interface MailtoHandler : NSObject |
| 16 |
| 17 // Name of Mail client. This is a name that a user can recognize, e.g. @"Gmail". |
| 18 @property(nonatomic, readonly) NSString* appName; |
| 19 |
| 20 // The iOS App Store ID for the Mail client. This is usually a string of digits. |
| 21 @property(nonatomic, readonly) NSString* appStoreID; |
| 22 |
| 23 // Initializer that subclasses should call from -init. |
| 24 - (instancetype)initWithName:(NSString*)appName |
| 25 appStoreID:(NSString*)appStoreID; |
| 26 |
| 27 // Returns whether the Mail client app is installed. |
| 28 - (BOOL)isAvailable; |
| 29 |
| 30 // Returns the prefix to use with -rewriteMailtoURL:. This is usually the custom |
| 31 // URL scheme plus some operator prefix. Subclasses should override this method. |
| 32 - (NSString*)beginningScheme; |
| 33 |
| 34 // Returns a set of NSString for mailto: parameters supported by this handler. |
| 35 - (NSSet<NSString*>*)supportedHeaders; |
| 36 |
| 37 // Rewrites |gURL| into a URL with a different URL scheme that will cause a |
| 38 // native iOS app to be launched to handle the mailto: URL. Returns nil if |
| 39 // |gURL| is not a mailto: URL. Base class implementation provides the typical |
| 40 // use which rewrites mailto:user@domain.com?subject=arg to |
| 41 // mailtoScheme:/co?to=user@domain.com&subject=arg |
| 42 - (NSString*)rewriteMailtoURL:(const GURL&)gURL; |
| 43 |
| 44 @end |
| 45 |
| 46 #endif // _IOS_CHROME_BROWSER_WEB_MAILTO_HANDLER_H_ |
OLD | NEW |