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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/PlatformUtil.java

Issue 1310873003: Implement PlatformUtil::OpenExternal() so that mailto: can work (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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 | « no previous file | chrome/browser/android/chrome_jni_registrar.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
+}
« no previous file with comments | « no previous file | chrome/browser/android/chrome_jni_registrar.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698