OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/compositor/scene_layer/contextual_search_scene_
layer.h" | 5 #include "chrome/browser/android/compositor/scene_layer/contextual_search_scene_
layer.h" |
6 | 6 |
7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
8 #include "base/android/jni_array.h" | 8 #include "base/android/jni_array.h" |
9 #include "base/android/jni_string.h" | 9 #include "base/android/jni_string.h" |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
11 #include "cc/layers/solid_color_layer.h" | 11 #include "cc/layers/solid_color_layer.h" |
12 #include "chrome/browser/android/compositor/layer/contextual_search_layer.h" | 12 #include "chrome/browser/android/compositor/layer/contextual_search_layer.h" |
13 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
14 #include "chrome/browser/profiles/profile_android.h" | 14 #include "chrome/browser/profiles/profile_android.h" |
15 #include "content/public/browser/android/compositor.h" | 15 #include "content/public/browser/android/compositor.h" |
16 #include "content/public/browser/web_contents.h" | 16 #include "content/public/browser/web_contents.h" |
17 #include "jni/ContextualSearchSceneLayer_jni.h" | 17 #include "jni/ContextualSearchSceneLayer_jni.h" |
18 #include "net/base/load_flags.h" | 18 #include "net/base/load_flags.h" |
| 19 #include "net/traffic_annotation/network_traffic_annotation.h" |
19 #include "net/url_request/url_request_context_getter.h" | 20 #include "net/url_request/url_request_context_getter.h" |
20 #include "ui/android/resources/resource_manager_impl.h" | 21 #include "ui/android/resources/resource_manager_impl.h" |
21 #include "ui/android/view_android.h" | 22 #include "ui/android/view_android.h" |
22 #include "ui/gfx/android/java_bitmap.h" | 23 #include "ui/gfx/android/java_bitmap.h" |
23 | 24 |
24 using base::android::JavaParamRef; | 25 using base::android::JavaParamRef; |
25 | 26 |
26 namespace android { | 27 namespace android { |
27 | 28 |
28 ContextualSearchSceneLayer::ContextualSearchSceneLayer(JNIEnv* env, | 29 ContextualSearchSceneLayer::ContextualSearchSceneLayer(JNIEnv* env, |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 // Make the layer visible if it is not already. | 226 // Make the layer visible if it is not already. |
226 contextual_search_layer_->layer()->SetHideLayerAndSubtree(false); | 227 contextual_search_layer_->layer()->SetHideLayerAndSubtree(false); |
227 } | 228 } |
228 | 229 |
229 void ContextualSearchSceneLayer::FetchThumbnail(jobject j_profile) { | 230 void ContextualSearchSceneLayer::FetchThumbnail(jobject j_profile) { |
230 if (thumbnail_url_.empty()) | 231 if (thumbnail_url_.empty()) |
231 return; | 232 return; |
232 | 233 |
233 GURL gurl(thumbnail_url_); | 234 GURL gurl(thumbnail_url_); |
234 Profile* profile = ProfileAndroid::FromProfileAndroid(j_profile); | 235 Profile* profile = ProfileAndroid::FromProfileAndroid(j_profile); |
235 fetcher_ = base::MakeUnique<chrome::BitmapFetcher>(gurl, this); | 236 fetcher_ = base::MakeUnique<chrome::BitmapFetcher>(gurl, this, |
| 237 NO_TRAFFIC_ANNOTATION_YET); |
236 fetcher_->Init( | 238 fetcher_->Init( |
237 profile->GetRequestContext(), | 239 profile->GetRequestContext(), |
238 std::string(), | 240 std::string(), |
239 net::URLRequest::CLEAR_REFERRER_ON_TRANSITION_FROM_SECURE_TO_INSECURE, | 241 net::URLRequest::CLEAR_REFERRER_ON_TRANSITION_FROM_SECURE_TO_INSECURE, |
240 net::LOAD_NORMAL); | 242 net::LOAD_NORMAL); |
241 fetcher_->Start(); | 243 fetcher_->Start(); |
242 } | 244 } |
243 | 245 |
244 void ContextualSearchSceneLayer::OnFetchComplete(const GURL& url, | 246 void ContextualSearchSceneLayer::OnFetchComplete(const GURL& url, |
245 const SkBitmap* bitmap) { | 247 const SkBitmap* bitmap) { |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 ContextualSearchSceneLayer* tree_provider = | 287 ContextualSearchSceneLayer* tree_provider = |
286 new ContextualSearchSceneLayer(env, jobj); | 288 new ContextualSearchSceneLayer(env, jobj); |
287 return reinterpret_cast<intptr_t>(tree_provider); | 289 return reinterpret_cast<intptr_t>(tree_provider); |
288 } | 290 } |
289 | 291 |
290 bool RegisterContextualSearchSceneLayer(JNIEnv* env) { | 292 bool RegisterContextualSearchSceneLayer(JNIEnv* env) { |
291 return RegisterNativesImpl(env); | 293 return RegisterNativesImpl(env); |
292 } | 294 } |
293 | 295 |
294 } // namespace android | 296 } // namespace android |
OLD | NEW |