Index: ios/chrome/browser/web/mailto_url_rewriter.h |
diff --git a/ios/chrome/browser/web/mailto_url_rewriter.h b/ios/chrome/browser/web/mailto_url_rewriter.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..688d39308a54185b66970efbad10f7f170676b02 |
--- /dev/null |
+++ b/ios/chrome/browser/web/mailto_url_rewriter.h |
@@ -0,0 +1,43 @@ |
+// Copyright 2017 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef IOS_CHROME_BROWSER_WEB_MAILTO_URL_REWRITER_H_ |
+#define IOS_CHROME_BROWSER_WEB_MAILTO_URL_REWRITER_H_ |
+ |
+#import <Foundation/Foundation.h> |
+ |
+@class MailtoHandler; |
+class GURL; |
+ |
+// Class of a singleton object that manages the available Mail client apps |
+// and the selected Mail client app to handle mailto: URL scheme. |
+@interface MailtoURLRewriter : NSObject |
+ |
+// Returns the ID as a string for the system-provided Mail client app. |
++ (NSString*)systemMailApp; |
+ |
+// An initializer returning an instance that has the standard set of |
+// MailtoHandlers initialized. Unit tests can use -init and then set up the |
+// different handlers. |
+- (instancetype)initWithStandardHandlers; |
+ |
+// Returns an array of all the currently supported Mail client apps that claims |
+// to handle mailto: URL scheme through their own custom defined URL schemes. |
+- (NSArray<MailtoHandler*>*)defaultHandlers; |
+ |
+// Returns the ID as a string for the Mail client app was set to handle mailto: |
+// URL scheme. |
+- (NSString*)defaultHandlerID; |
+ |
+// Sets the ID as a string for the Mail client app that will handle mailto: |
+// URL scheme. |
+- (void)setDefaultHandlerID:(NSString*)appStoreID; |
+ |
+// Rewrites |gURL|, which must be a mailto: URL, into a new URL that can be |
+// "opened" to launch the Mail client app. |
jif
2017/05/04 14:08:47
Can you mention that this can return nil? For exam
pkl (ping after 24h if needed)
2017/05/04 22:25:59
It's probably unnecessary to enumerate all the pos
|
+- (NSString*)rewriteMailtoURL:(const GURL&)gURL; |
+ |
+@end |
+ |
+#endif // IOS_CHROME_BROWSER_WEB_MAILTO_URL_REWRITER_H_ |