Chromium Code Reviews| 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..f3c944fa830764ceff6c0d634b14c08dcd1e6151 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,19 @@ NSString* PromptActionString(NSString* scheme) { |
| } |
| } |
| + // Replaces |URL| with a rewritten URL if it is of mailto: scheme. |
| + if (!experimental_flags::IsNativeAppLauncherEnabled() && |
| + gURL.SchemeIs(url::kMailToScheme)) { |
| + NSString* launchURL = |
| + [[MailtoURLRewriter sharedInstance] rewriteMailtoURL:gURL]; |
|
jif
2017/05/03 13:01:35
MailtoURLRewriter doesn't have to be a singleton.
pkl (ping after 24h if needed)
2017/05/03 22:17:18
Given how ExternalAppLauncher is used, it is likel
|
| + if (launchURL) { |
| + UMA_HISTOGRAM_BOOLEAN("MailtoURLRewriter.Rewritten", true); |
| + URL = [NSURL URLWithString:launchURL]; |
| + } else { |
| + UMA_HISTOGRAM_BOOLEAN("MailtoURLRewriter.Rewritten", false); |
| + } |
| + } |
| + |
| // 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. |