OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/android/omnibox/answers_image_bridge.h" | 5 #include "chrome/browser/android/omnibox/answers_image_bridge.h" |
6 | 6 |
7 #include <jni.h> | 7 #include <jni.h> |
8 | 8 |
9 #include "base/android/jni_android.h" | 9 #include "base/android/jni_android.h" |
10 #include "base/android/jni_string.h" | 10 #include "base/android/jni_string.h" |
11 #include "base/android/scoped_java_ref.h" | 11 #include "base/android/scoped_java_ref.h" |
12 #include "base/bind.h" | 12 #include "base/bind.h" |
13 #include "chrome/browser/bitmap_fetcher/bitmap_fetcher_service.h" | 13 #include "chrome/browser/bitmap_fetcher/bitmap_fetcher_service.h" |
14 #include "chrome/browser/bitmap_fetcher/bitmap_fetcher_service_factory.h" | 14 #include "chrome/browser/bitmap_fetcher/bitmap_fetcher_service_factory.h" |
15 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
16 #include "chrome/browser/profiles/profile_android.h" | 16 #include "chrome/browser/profiles/profile_android.h" |
17 #include "jni/AnswersImage_jni.h" | 17 #include "jni/AnswersImage_jni.h" |
| 18 #include "net/traffic_annotation/network_traffic_annotation.h" |
18 #include "third_party/skia/include/core/SkBitmap.h" | 19 #include "third_party/skia/include/core/SkBitmap.h" |
19 #include "ui/gfx/android/java_bitmap.h" | 20 #include "ui/gfx/android/java_bitmap.h" |
20 #include "url/gurl.h" | 21 #include "url/gurl.h" |
21 | 22 |
22 using base::android::JavaParamRef; | 23 using base::android::JavaParamRef; |
23 using base::android::ScopedJavaLocalRef; | 24 using base::android::ScopedJavaLocalRef; |
24 using base::android::ConvertUTF8ToJavaString; | 25 using base::android::ConvertUTF8ToJavaString; |
25 | 26 |
26 namespace { | 27 namespace { |
27 | 28 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 const JavaParamRef<jobject>& java_profile, | 69 const JavaParamRef<jobject>& java_profile, |
69 const JavaParamRef<jstring>& java_url, | 70 const JavaParamRef<jstring>& java_url, |
70 const JavaParamRef<jobject>& java_callback) { | 71 const JavaParamRef<jobject>& java_callback) { |
71 Profile* profile = ProfileAndroid::FromProfileAndroid(java_profile); | 72 Profile* profile = ProfileAndroid::FromProfileAndroid(java_profile); |
72 DCHECK(profile); | 73 DCHECK(profile); |
73 BitmapFetcherService* bitmap_fetcher_service = | 74 BitmapFetcherService* bitmap_fetcher_service = |
74 BitmapFetcherServiceFactory::GetForBrowserContext(profile); | 75 BitmapFetcherServiceFactory::GetForBrowserContext(profile); |
75 std::string url; | 76 std::string url; |
76 base::android::ConvertJavaStringToUTF8(env, java_url, &url); | 77 base::android::ConvertJavaStringToUTF8(env, java_url, &url); |
77 return bitmap_fetcher_service->RequestImage( | 78 return bitmap_fetcher_service->RequestImage( |
78 GURL(url), new AnswersImageObserverAndroid(env, java_callback)); | 79 GURL(url), new AnswersImageObserverAndroid(env, java_callback), |
| 80 NO_TRAFFIC_ANNOTATION_YET); |
79 } | 81 } |
80 | 82 |
81 // static | 83 // static |
82 bool RegisterAnswersImageBridge(JNIEnv* env) { | 84 bool RegisterAnswersImageBridge(JNIEnv* env) { |
83 return RegisterNativesImpl(env); | 85 return RegisterNativesImpl(env); |
84 } | 86 } |
OLD | NEW |