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

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: nit 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..4bb4565360e2b4ef8ab482c42d2bda1488aad473
--- /dev/null
+++ b/chrome/android/java/src/org/chromium/chrome/browser/PlatformUtil.java
@@ -0,0 +1,34 @@
+// 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.ActivityNotFoundException;
+import android.content.Context;
+import android.content.Intent;
+import android.net.Uri;
+
+import org.chromium.base.ApplicationStatus;
+import org.chromium.base.Log;
+import org.chromium.base.annotations.CalledByNative;
+
+/**
+ * Utility class for providing platform functionalities.
+ */
+public class PlatformUtil {
+ private static final String TAG = "cr.PlatformUtil";
+
+ @CalledByNative
+ private static void launchExternalProtocol(String url) {
+ Context context = ApplicationStatus.getApplicationContext();
+ Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
+ intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ intent.addCategory(Intent.CATEGORY_BROWSABLE);
+ try {
+ context.startActivity(intent);
+ } catch (ActivityNotFoundException e) {
+ Log.e(TAG, "cannot find activity to launch " + url, e);
+ }
+ }
+}
« 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