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

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

Issue 312203005: [AiS] Java bridge for AnswersImageService (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@img-service
Patch Set: Fix formatting. Created 6 years, 6 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/omnibox/AnswersImage.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/omnibox/AnswersImage.java b/chrome/android/java/src/org/chromium/chrome/browser/omnibox/AnswersImage.java
new file mode 100644
index 0000000000000000000000000000000000000000..958c2563fe902258f6ede0d104d0621d2e5e83fb
--- /dev/null
+++ b/chrome/android/java/src/org/chromium/chrome/browser/omnibox/AnswersImage.java
@@ -0,0 +1,62 @@
+// Copyright 2014 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.omnibox;
+
+import android.graphics.Bitmap;
+
+import org.chromium.base.CalledByNative;
+import org.chromium.chrome.browser.profiles.Profile;
+
+/**
+ * Provides access to images used by Answers in Suggest.
+ */
+public class AnswersImage {
+ /**
+ * Observer for updating an image when it is available.
+ */
+ public interface AnswersImageObserver {
+ /**
+ * Called when the image is updated.
+ *
+ * @param answersImage the image
+ */
+ @CalledByNative("AnswersImageObserver")
+ public void onAnswersImageChanged(Bitmap bitmap);
+ }
+
+ /**
+ * Request image, observer is notified when image is loaded.
+ * @param profile Profile that the request is for.
+ * @param imageUrl URL for image data.
+ * @param observer Observer to be notified when image is updated. The C++ side will hold a
+ * strong reference to this.
+ * @return A request_id.
+ */
+ public static int requestAnswersImage(
+ Profile profile, String imageUrl, AnswersImageObserver observer) {
+ return nativeRequestAnswersImage(profile, imageUrl, observer);
+ }
+
+ /**
+ * Cancel a pending image request.
+ * @param profile Profile the request was issued for.
+ * @param requestId The ID of the request to be cancelled.
+ */
+ public static void cancelAnswersImageRequest(Profile profile, int requestId) {
+ nativeCancelAnswersImageRequest(profile, requestId);
+ }
+
+ /**
+ * Requests an image at |imageUrl| for the given |profile| with |observer| being notified.
+ * @returns an AnswersImageRequest
+ */
+ private static native int nativeRequestAnswersImage(
+ Profile profile, String imageUrl, AnswersImageObserver observer);
+
+ /**
+ * Cancels a pending request.
+ */
+ private static native void nativeCancelAnswersImageRequest(Profile profile, int requestId);
+}
« 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