| 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);
|
| + }
|
| + }
|
| +}
|
|
|