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

Unified Diff: ios/chrome/browser/web/mailto_handler_system_mail.mm

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
Index: ios/chrome/browser/web/mailto_handler_system_mail.mm
diff --git a/ios/chrome/browser/web/mailto_handler_system_mail.mm b/ios/chrome/browser/web/mailto_handler_system_mail.mm
new file mode 100644
index 0000000000000000000000000000000000000000..43b9f917f26d262a69c94c69cd1ba70e9c3961e0
--- /dev/null
+++ b/ios/chrome/browser/web/mailto_handler_system_mail.mm
@@ -0,0 +1,36 @@
+// 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.
+
+#import "ios/chrome/browser/web/mailto_handler_system_mail.h"
+
+#include "base/strings/sys_string_conversions.h"
+#import "ios/chrome/browser/web/mailto_url_rewriter.h"
+#include "ios/chrome/grit/ios_strings.h"
+#include "ui/base/l10n/l10n_util.h"
+#include "url/gurl.h"
+
+#if !defined(__has_feature) || !__has_feature(objc_arc)
+#error "This file requires ARC support."
+#endif
+
+@implementation MailtoHandlerSystemMail
+
+- (instancetype)init {
+ NSString* name = l10n_util::GetNSString(IDS_IOS_SYSTEM_MAIL_APP);
+ self = [super initWithName:name appStoreID:[MailtoURLRewriter systemMailApp]];
+ return self;
+}
+
+- (BOOL)isAvailable {
+ // System Mail client app is always available.
+ return YES;
+}
+
+- (NSString*)rewriteMailtoURL:(const GURL&)gURL {
+ if (!gURL.SchemeIs(url::kMailToScheme))
+ return nil;
+ return base::SysUTF8ToNSString(gURL.spec());
+}
+
+@end
« no previous file with comments | « ios/chrome/browser/web/mailto_handler_system_mail.h ('k') | ios/chrome/browser/web/mailto_handler_system_mail_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698