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

Unified Diff: ios/chrome/browser/web/external_app_launcher.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
« no previous file with comments | « ios/chrome/browser/web/BUILD.gn ('k') | ios/chrome/browser/web/mailto_handler.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/chrome/browser/web/external_app_launcher.mm
diff --git a/ios/chrome/browser/web/external_app_launcher.mm b/ios/chrome/browser/web/external_app_launcher.mm
index 9489a55ca058771bbbdef29a9697749fa95f123d..d10f3d66aec9686906d461b5b453058042ca2628 100644
--- a/ios/chrome/browser/web/external_app_launcher.mm
+++ b/ios/chrome/browser/web/external_app_launcher.mm
@@ -11,10 +11,12 @@
#include "components/strings/grit/components_strings.h"
#include "ios/chrome/browser/experimental_flags.h"
#import "ios/chrome/browser/open_url_util.h"
+#import "ios/chrome/browser/web/mailto_url_rewriter.h"
#include "ios/chrome/grit/ios_strings.h"
#import "net/base/mac/url_conversions.h"
#include "ui/base/l10n/l10n_util.h"
#include "url/gurl.h"
+#include "url/url_constants.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
@@ -52,7 +54,7 @@ void RecordExternalApplicationOpened(bool opened) {
}
// Returns whether gURL has the scheme of a URL that initiates a call.
-BOOL UrlHasPhoneCallScheme(const GURL& gURL) {
+bool UrlHasPhoneCallScheme(const GURL& gURL) {
return gURL.SchemeIs("tel") || gURL.SchemeIs("facetime") ||
gURL.SchemeIs("facetime-audio");
}
@@ -186,6 +188,18 @@ NSString* PromptActionString(NSString* scheme) {
}
}
+ // Replaces |URL| with a rewritten URL if it is of mailto: scheme.
+ if (!experimental_flags::IsNativeAppLauncherEnabled() &&
+ gURL.SchemeIs(url::kMailToScheme)) {
+ MailtoURLRewriter* rewriter =
+ [[MailtoURLRewriter alloc] initWithStandardHandlers];
+ NSString* launchURL = [rewriter rewriteMailtoURL:gURL];
+ if (launchURL) {
+ URL = [NSURL URLWithString:launchURL];
+ }
+ UMA_HISTOGRAM_BOOLEAN("IOS.MailtoURLRewritten", launchURL != nil);
+ }
+
// If the following call returns YES, an external application is about to be
// launched and Chrome will go into the background now.
// TODO(crbug.com/622735): This call still needs to be updated.
« no previous file with comments | « ios/chrome/browser/web/BUILD.gn ('k') | ios/chrome/browser/web/mailto_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698