Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(115)

Unified Diff: ios/chrome/browser/web/mailto_handler.h

Issue 2852003002: Adds mailto: URL support to app launching. (Closed)
Patch Set: separate migration from auto-default even more Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ios/chrome/browser/web/external_app_launcher.mm ('k') | ios/chrome/browser/web/mailto_handler.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/chrome/browser/web/mailto_handler.h
diff --git a/ios/chrome/browser/web/mailto_handler.h b/ios/chrome/browser/web/mailto_handler.h
new file mode 100644
index 0000000000000000000000000000000000000000..53347a32cdef8b6e1aae578d9f83db33066f7f67
--- /dev/null
+++ b/ios/chrome/browser/web/mailto_handler.h
@@ -0,0 +1,46 @@
+// 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_HANDLER_H_
+#define _IOS_CHROME_BROWSER_WEB_MAILTO_HANDLER_H_
+
+#import <Foundation/Foundation.h>
+
+class GURL;
+
+// MailtoHandler is the base class for Mail client apps that can handle
+// mailto: URLs via custom URL schemes. To add support for Mail clients,
+// subclass from this and add it to MailtoURLRewriter class.
+@interface MailtoHandler : NSObject
+
+// Name of Mail client. This is a name that a user can recognize, e.g. @"Gmail".
+@property(nonatomic, readonly) NSString* appName;
+
+// The iOS App Store ID for the Mail client. This is usually a string of digits.
+@property(nonatomic, readonly) NSString* appStoreID;
+
+// Initializer that subclasses should call from -init.
+- (instancetype)initWithName:(NSString*)appName
+ appStoreID:(NSString*)appStoreID;
+
+// Returns whether the Mail client app is installed.
+- (BOOL)isAvailable;
+
+// Returns the prefix to use with -rewriteMailtoURL:. This is usually the custom
+// URL scheme plus some operator prefix. Subclasses should override this method.
+- (NSString*)beginningScheme;
+
+// Returns a set of NSString for mailto: parameters supported by this handler.
+- (NSSet<NSString*>*)supportedHeaders;
+
+// Rewrites |gURL| into a URL with a different URL scheme that will cause a
+// native iOS app to be launched to handle the mailto: URL. Returns nil if
+// |gURL| is not a mailto: URL. Base class implementation provides the typical
+// use which rewrites mailto:user@domain.com?subject=arg to
+// mailtoScheme:/co?to=user@domain.com&subject=arg
+- (NSString*)rewriteMailtoURL:(const GURL&)gURL;
+
+@end
+
+#endif // _IOS_CHROME_BROWSER_WEB_MAILTO_HANDLER_H_
« no previous file with comments | « ios/chrome/browser/web/external_app_launcher.mm ('k') | ios/chrome/browser/web/mailto_handler.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698