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

Unified Diff: ios/chrome/browser/web/mailto_url_rewriter.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/mailto_handler_unittest.mm ('k') | ios/chrome/browser/web/mailto_url_rewriter.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..d5deb1cdc206713e8a5c0000b199162f8dbf1732
--- /dev/null
+++ b/ios/chrome/browser/web/mailto_url_rewriter.h
@@ -0,0 +1,41 @@
+// 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;
+
+// An object that manages the available Mail client apps. The currently selected
+// Mail client to handle mailto: URL is stored in a key in NSUserDefaults.
+// If the key in NSUserDefaults is not set, the system-provided Mail client app
+// will be used.
+@interface MailtoURLRewriter : NSObject
+
+// The unique ID of the Mail client app was set to handle mailto: URL scheme.
+@property(nonatomic, copy) NSString* defaultHandlerID;
+
+// 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;
+
+// Rewrites |gURL| into a new URL that can be "opened" to launch the Mail
+// client app. May return nil if |gURL| is not a mailto: URL or there are no
+// Mail client app available.
+- (NSString*)rewriteMailtoURL:(const GURL&)gURL;
+
+@end
+
+#endif // IOS_CHROME_BROWSER_WEB_MAILTO_URL_REWRITER_H_
« no previous file with comments | « ios/chrome/browser/web/mailto_handler_unittest.mm ('k') | ios/chrome/browser/web/mailto_url_rewriter.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698