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_URL_REWRITER_H_ |
| 6 #define IOS_CHROME_BROWSER_WEB_MAILTO_URL_REWRITER_H_ |
| 7 |
| 8 #import <Foundation/Foundation.h> |
| 9 |
| 10 @class MailtoHandler; |
| 11 class GURL; |
| 12 |
| 13 // An object that manages the available Mail client apps. The currently selected |
| 14 // Mail client to handle mailto: URL is stored in a key in NSUserDefaults. |
| 15 // If the key in NSUserDefaults is not set, the system-provided Mail client app |
| 16 // will be used. |
| 17 @interface MailtoURLRewriter : NSObject |
| 18 |
| 19 // The unique ID of the Mail client app was set to handle mailto: URL scheme. |
| 20 @property(nonatomic, copy) NSString* defaultHandlerID; |
| 21 |
| 22 // Returns the ID as a string for the system-provided Mail client app. |
| 23 + (NSString*)systemMailApp; |
| 24 |
| 25 // An initializer returning an instance that has the standard set of |
| 26 // MailtoHandlers initialized. Unit tests can use -init and then set up the |
| 27 // different handlers. |
| 28 - (instancetype)initWithStandardHandlers; |
| 29 |
| 30 // Returns an array of all the currently supported Mail client apps that claims |
| 31 // to handle mailto: URL scheme through their own custom defined URL schemes. |
| 32 - (NSArray<MailtoHandler*>*)defaultHandlers; |
| 33 |
| 34 // Rewrites |gURL| into a new URL that can be "opened" to launch the Mail |
| 35 // client app. May return nil if |gURL| is not a mailto: URL or there are no |
| 36 // Mail client app available. |
| 37 - (NSString*)rewriteMailtoURL:(const GURL&)gURL; |
| 38 |
| 39 @end |
| 40 |
| 41 #endif // IOS_CHROME_BROWSER_WEB_MAILTO_URL_REWRITER_H_ |
OLD | NEW |