Chromium Code Reviews| Index: chrome/android/java/src/org/chromium/chrome/browser/blimp/ChromeBlimpClientContextDelegate.java |
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/blimp/ChromeBlimpClientContextDelegate.java b/chrome/android/java/src/org/chromium/chrome/browser/blimp/ChromeBlimpClientContextDelegate.java |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..58be878868d7e0ac4b2626d84a9125ca545f5785 |
| --- /dev/null |
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/blimp/ChromeBlimpClientContextDelegate.java |
| @@ -0,0 +1,43 @@ |
| +// Copyright 2016 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.blimp; |
| + |
| +import org.chromium.base.annotations.CalledByNative; |
| +import org.chromium.base.annotations.JNINamespace; |
| +import org.chromium.chrome.browser.profiles.Profile; |
| + |
| +/** |
| + * The ChromeBlimpClientContextDelegate for //chrome which provides the necessary functionality |
| + * required to run Blimp. This is the Java counterparty to the C++ |
| + * ChromeBlimpClientContextDelegateAndroid. |
| + */ |
| +@JNINamespace("chrome") |
| +public class ChromeBlimpClientContextDelegate { |
| + public static ChromeBlimpClientContextDelegate createAndSetDelegateForContext(Profile profile) { |
|
David Trainor- moved to gerrit
2016/07/14 19:07:13
Javadoc? Explain a bit taht only one of these can
nyquist
2016/07/14 22:56:50
Yeah, that'd be cool, but the constructor of the C
|
| + return new ChromeBlimpClientContextDelegate(profile); |
| + } |
| + |
| + /** |
| + * The pointer to the ChromeBlimpClientContextDelegateAndroid JNI bridge. |
| + */ |
| + private long mNativeChromeBlimpClientContextDelegateAndroid; |
| + |
| + private ChromeBlimpClientContextDelegate(Profile profile) { |
| + mNativeChromeBlimpClientContextDelegateAndroid = nativeInit(profile); |
| + } |
| + |
| + @CalledByNative |
| + private void clearNativePtr() { |
| + mNativeChromeBlimpClientContextDelegateAndroid = 0; |
| + } |
| + |
| + public void destroy() { |
| + assert mNativeChromeBlimpClientContextDelegateAndroid != 0; |
| + nativeDestroy(mNativeChromeBlimpClientContextDelegateAndroid); |
| + } |
| + |
| + private native long nativeInit(Profile profile); |
| + private native void nativeDestroy(long nativeChromeBlimpClientContextDelegateAndroid); |
| +} |