Chromium Code Reviews| Index: chrome/android/java/src/org/chromium/chrome/browser/PlatformUtil.java |
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/PlatformUtil.java b/chrome/android/java/src/org/chromium/chrome/browser/PlatformUtil.java |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..b7a889d4098ecd054025c13a499b10c81252d6ec |
| --- /dev/null |
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/PlatformUtil.java |
| @@ -0,0 +1,27 @@ |
| +// Copyright 2015 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. |
| + |
| +package org.chromium.chrome.browser; |
| + |
| +import android.content.Context; |
| +import android.content.Intent; |
| +import android.net.Uri; |
| + |
| +import org.chromium.base.ApplicationStatus; |
| +import org.chromium.base.annotations.CalledByNative; |
| + |
| +/** |
| + * Utility class for providing platform functionalities. |
| + */ |
| +public class PlatformUtil { |
| + @CalledByNative |
| + private static void launchExternalProtocol(String url) { |
| + if (url.startsWith("mailto:")) { |
| + Context context = ApplicationStatus.getApplicationContext(); |
| + Intent intent = new Intent(Intent.ACTION_SENDTO, Uri.parse(url)); |
| + intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); |
|
Ted C
2015/09/04 17:32:26
should we add:
intent.addCategory(Intent.CATEGORY
qinmin
2015/09/04 17:51:38
Done.
|
| + context.startActivity(intent); |
|
Ted C
2015/09/04 17:32:26
I would catch ActivityNotFoundException just in ca
qinmin
2015/09/04 17:51:38
Done.
|
| + } |
|
Ted C
2015/09/04 17:32:26
should we be sending a generic view intent in the
qinmin
2015/09/04 17:51:38
Changed the Intent action to ACTION_VIEW and remov
|
| + } |
|
Ted C
2015/09/04 17:32:26
And looking a bit more at the intent class, it loo
qinmin
2015/09/04 17:51:38
Done.
|
| +} |