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

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

Issue 2852003002: Adds mailto: URL support to app launching. (Closed)
Patch Set: rebase 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_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..a3eedba1a8e726b662eb2f43b5e42f23c901a7c5
--- /dev/null
+++ b/ios/chrome/browser/web/mailto_handler_system_mail.mm
@@ -0,0 +1,35 @@
+// 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 {
+ return YES;
+}
+
+- (NSString*)rewriteMailtoURL:(const GURL&)gURL {
+ if (!gURL.SchemeIs(url::kMailToScheme))
+ return nil;
+ return base::SysUTF8ToNSString(gURL.spec());
+}
+
+@end

Powered by Google App Engine
This is Rietveld 408576698