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

Side by Side Diff: ios/chrome/browser/web/mailto_handler.h

Issue 2852003002: Adds mailto: URL support to app launching. (Closed)
Patch Set: rebase 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 unified diff | Download patch
OLDNEW
(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 // Designated initializer that subclasses should call from -init.
24 - (instancetype)initWithName:(NSString*)appName
jif 2017/05/04 14:08:47 add NS_DESIGNATED_INITIALIZER and NS_UNAVAILABLE w
pkl (ping after 24h if needed) 2017/05/04 22:25:59 It's actually not a designated initializer, but a
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*)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_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698