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

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

Issue 2852003002: Adds mailto: URL support to app launching. (Closed)
Patch Set: .grd message update Created 3 years, 8 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
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..d2746a80fb4d51eaa504533a7bcd69b7ba7e4921
--- /dev/null
+++ b/ios/chrome/browser/web/mailto_handler.h
@@ -0,0 +1,39 @@
+// 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;
+
+// Designated initializer that subclasses should call from -init.
+- (instancetype)initWithName:(NSString*)appName
+ appStoreID:(NSString*)appStoreID;
+
+// Returns whether the Mail client app is installed.
+- (BOOL)isAvailable;
jif 2017/05/03 13:01:35 I think the subclass should return the Mail client
pkl (ping after 24h if needed) 2017/05/03 22:17:18 May be I don't understand completely. Having this
jif 2017/05/04 14:08:47 Indeed it does not. I'm suggesting factoring the c
jif 2017/05/05 09:49:39 Seems like you missed this reply (which is in the
+
+// 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.
+// This method is intended to be an abstract interface for subclasses and is
+// not implemented for this class.
+- (NSString*)rewriteMailtoURL:(const GURL&)gURL;
+
+@end
+
+#endif // _IOS_CHROME_BROWSER_WEB_MAILTO_HANDLER_H_

Powered by Google App Engine
This is Rietveld 408576698