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

Unified Diff: blimp/client/core/android/java/src/org/chromium/blimp/core/DummyBlimpClientContext.java

Issue 2132163002: Add BlimpClientContext and factory with real and dummy implementation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@move-blimp-client-core-public-to-blimp-client
Patch Set: git merge origin/master before CQ for good measure Created 4 years, 5 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
Index: blimp/client/core/android/java/src/org/chromium/blimp/core/DummyBlimpClientContext.java
diff --git a/blimp/client/core/android/java/src/org/chromium/blimp/core/DummyBlimpClientContext.java b/blimp/client/core/android/java/src/org/chromium/blimp/core/DummyBlimpClientContext.java
new file mode 100644
index 0000000000000000000000000000000000000000..5818312073aec6b97d969fcde1ef5aa8869e6cd8
--- /dev/null
+++ b/blimp/client/core/android/java/src/org/chromium/blimp/core/DummyBlimpClientContext.java
@@ -0,0 +1,46 @@
+// 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.blimp.core;
+
+import org.chromium.base.annotations.CalledByNative;
+import org.chromium.base.annotations.JNINamespace;
+import org.chromium.blimp_public.BlimpClientContext;
+import org.chromium.blimp_public.BlimpContents;
+
+/**
+ * A dummy implementation of the {@link BlimpClientContext}.
+ */
+@JNINamespace("blimp::client")
+public class DummyBlimpClientContext implements BlimpClientContext {
+ @CalledByNative
+ private static DummyBlimpClientContext create(long nativeDummyBlimpClientContextAndroid) {
+ return new DummyBlimpClientContext(nativeDummyBlimpClientContextAndroid);
+ }
+
+ /**
+ * The pointer to the DummyBlimpClientContextAndroid JNI bridge.
+ */
+ private long mNativeDummyBlimpClientContextAndroid;
+
+ private DummyBlimpClientContext(long nativeDummyBlimpClientContextAndroid) {
+ mNativeDummyBlimpClientContextAndroid = nativeDummyBlimpClientContextAndroid;
+ }
+
+ @Override
+ public BlimpContents createBlimpContents() {
+ return null;
+ }
+
+ @CalledByNative
+ private void clearNativePtr() {
+ mNativeDummyBlimpClientContextAndroid = 0;
+ }
+
+ @CalledByNative
+ private long getNativePtr() {
+ assert mNativeDummyBlimpClientContextAndroid != 0;
+ return mNativeDummyBlimpClientContextAndroid;
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698