Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 package org.chromium.chrome.browser.omnibox; | |
| 6 | |
| 7 import android.graphics.Bitmap; | |
| 8 | |
| 9 import org.chromium.base.CalledByNative; | |
| 10 import org.chromium.chrome.browser.profiles.Profile; | |
| 11 | |
| 12 /** | |
| 13 * Provides access to images used by Answers in Suggest. | |
| 14 */ | |
| 15 public class AnswersImage { | |
| 16 /** | |
| 17 * Observer for updating an image when it is available. | |
| 18 */ | |
| 19 public interface AnswersImageObserver { | |
| 20 /** | |
| 21 * Called when the image is updated. | |
| 22 * | |
| 23 * @param answersImage the image | |
| 24 */ | |
| 25 @CalledByNative("AnswersImageObserver") | |
| 26 public void onAnswersImageChanged(Bitmap bitmap); | |
|
Ted C
2014/06/17 20:38:15
-4 indent
groby-ooo-7-16
2014/06/17 23:46:20
Done.
| |
| 27 } | |
| 28 | |
| 29 /** | |
| 30 * Encapsulates requests to the AnswerImagesService. | |
| 31 */ | |
| 32 public static class AnswersImageRequest { | |
| 33 public final AnswersImageObserver observer; | |
| 34 public final int requestId; | |
| 35 | |
| 36 public AnswersImageRequest(AnswersImageObserver observer, int requestId) { | |
| 37 this.observer = observer; | |
| 38 this.requestId = requestId; | |
| 39 } | |
| 40 } | |
| 41 | |
| 42 /** | |
| 43 * Request image, observer is notified when image is loaded. | |
| 44 * @param profile Profile that the request is for. | |
| 45 * @param imageUrl URL for image data. | |
| 46 * @param observer Observer to be notified when image is updated. | |
| 47 * @return An AnswersImageRequest. | |
| 48 */ | |
| 49 public static AnswersImageRequest requestAnswersImage( | |
| 50 Profile profile, String imageUrl, AnswersImageObserver observer) { | |
| 51 return nativeRequestAnswersImage(profile, imageUrl, observer); | |
| 52 } | |
| 53 | |
| 54 /** | |
| 55 * Cancel a pending image request. | |
| 56 * @param profile Profile the request was issued for. | |
| 57 * @param requestId The ID of the request to be cancelled. | |
| 58 */ | |
| 59 public static void cancelAnswersImageRequest(Profile profile, int requestId) { | |
| 60 nativeCancelAnswersImageRequest(profile, requestId); | |
| 61 } | |
| 62 | |
| 63 /** | |
| 64 * Allows the native side to generate AnswersImageRequest objects. | |
| 65 */ | |
| 66 @CalledByNative | |
| 67 private static AnswersImageRequest createAnswersImageRequest( | |
|
Ted C
2014/06/17 20:38:15
This function needs to be -4 indented
groby-ooo-7-16
2014/06/17 23:46:20
Function deleted, since the request class is unnec
| |
| 68 AnswersImageObserver observer, int requestId) { | |
| 69 return new AnswersImageRequest(observer, requestId); | |
| 70 } | |
| 71 | |
| 72 /** | |
| 73 * Requests an image at |imageUrl| for the given |profile| with |observer| b eing notified. | |
| 74 * @returns an AnswersImageRequest | |
| 75 */ | |
| 76 private static native AnswersImageRequest nativeRequestAnswersImage( | |
| 77 Profile profile, String imageUrl, AnswersImageObserver observer); | |
| 78 | |
| 79 /** | |
| 80 * Cancels a pending request. | |
| 81 */ | |
| 82 private static native void nativeCancelAnswersImageRequest(Profile profile, int requestId); | |
| 83 } | |
| OLD | NEW |