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

Side by Side Diff: chrome/browser/android/logo_bridge.cc

Issue 2794343002: Network traffic annotation added to image_data_fetcher. (Closed)
Patch Set: Favicon Annotation updated. Created 3 years, 7 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 unified diff | Download patch
OLDNEW
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/logo_bridge.h" 5 #include "chrome/browser/android/logo_bridge.h"
6 6
7 #include <jni.h> 7 #include <jni.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/android/jni_android.h" 10 #include "base/android/jni_android.h"
11 #include "base/android/jni_array.h" 11 #include "base/android/jni_array.h"
12 #include "base/android/jni_string.h" 12 #include "base/android/jni_string.h"
13 #include "base/android/scoped_java_ref.h" 13 #include "base/android/scoped_java_ref.h"
14 #include "base/bind.h" 14 #include "base/bind.h"
15 #include "base/feature_list.h" 15 #include "base/feature_list.h"
16 #include "base/metrics/histogram_macros.h" 16 #include "base/metrics/histogram_macros.h"
17 #include "chrome/browser/android/chrome_feature_list.h" 17 #include "chrome/browser/android/chrome_feature_list.h"
18 #include "chrome/browser/android/logo_service.h" 18 #include "chrome/browser/android/logo_service.h"
19 #include "chrome/browser/doodle/doodle_service_factory.h" 19 #include "chrome/browser/doodle/doodle_service_factory.h"
20 #include "chrome/browser/profiles/profile.h" 20 #include "chrome/browser/profiles/profile.h"
21 #include "chrome/browser/profiles/profile_android.h" 21 #include "chrome/browser/profiles/profile_android.h"
22 #include "chrome/browser/search/suggestions/image_decoder_impl.h" 22 #include "chrome/browser/search/suggestions/image_decoder_impl.h"
23 #include "components/image_fetcher/core/image_fetcher_impl.h" 23 #include "components/image_fetcher/core/image_fetcher_impl.h"
24 #include "components/search_provider_logos/logo_tracker.h" 24 #include "components/search_provider_logos/logo_tracker.h"
25 #include "jni/LogoBridge_jni.h" 25 #include "jni/LogoBridge_jni.h"
26 #include "net/traffic_annotation/network_traffic_annotation.h"
26 #include "net/url_request/url_fetcher.h" 27 #include "net/url_request/url_fetcher.h"
27 #include "net/url_request/url_fetcher_delegate.h" 28 #include "net/url_request/url_fetcher_delegate.h"
28 #include "net/url_request/url_request_context_getter.h" 29 #include "net/url_request/url_request_context_getter.h"
29 #include "net/url_request/url_request_status.h" 30 #include "net/url_request/url_request_status.h"
30 #include "third_party/skia/include/core/SkBitmap.h" 31 #include "third_party/skia/include/core/SkBitmap.h"
31 #include "ui/gfx/android/java_bitmap.h" 32 #include "ui/gfx/android/java_bitmap.h"
32 #include "ui/gfx/image/image.h" 33 #include "ui/gfx/image/image.h"
33 #include "url/gurl.h" 34 #include "url/gurl.h"
34 35
35 using base::android::ConvertJavaStringToUTF8; 36 using base::android::ConvertJavaStringToUTF8;
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 : doodle_config.large_image.url; 293 : doodle_config.large_image.url;
293 const GURL& animated_image_url = 294 const GURL& animated_image_url =
294 has_cta ? doodle_config.large_image.url : GURL::EmptyGURL(); 295 has_cta ? doodle_config.large_image.url : GURL::EmptyGURL();
295 // TODO(treib): For interactive doodles, use |fullpage_interactive_url| 296 // TODO(treib): For interactive doodles, use |fullpage_interactive_url|
296 // instead of |target_url|? 297 // instead of |target_url|?
297 const GURL& on_click_url = doodle_config.target_url; 298 const GURL& on_click_url = doodle_config.target_url;
298 const std::string& alt_text = doodle_config.alt_text; 299 const std::string& alt_text = doodle_config.alt_text;
299 image_fetcher_->StartOrQueueNetworkRequest( 300 image_fetcher_->StartOrQueueNetworkRequest(
300 image_url.spec(), image_url, 301 image_url.spec(), image_url,
301 base::Bind(&LogoBridge::DoodleImageFetched, base::Unretained(this), 302 base::Bind(&LogoBridge::DoodleImageFetched, base::Unretained(this),
302 from_cache, on_click_url, alt_text, animated_image_url)); 303 from_cache, on_click_url, alt_text, animated_image_url),
304 NO_TRAFFIC_ANNOTATION_YET);
303 } 305 }
304 306
305 void LogoBridge::DoodleImageFetched( 307 void LogoBridge::DoodleImageFetched(
306 bool config_from_cache, 308 bool config_from_cache,
307 const GURL& on_click_url, 309 const GURL& on_click_url,
308 const std::string& alt_text, 310 const std::string& alt_text,
309 const GURL& animated_image_url, 311 const GURL& animated_image_url,
310 const std::string& image_fetch_id, 312 const std::string& image_fetch_id,
311 const gfx::Image& image, 313 const gfx::Image& image,
312 const image_fetcher::RequestMetadata& metadata) { 314 const image_fetcher::RequestMetadata& metadata) {
(...skipping 13 matching lines...) Expand all
326 ScopedJavaLocalRef<jobject> j_logo = MakeJavaLogo( 328 ScopedJavaLocalRef<jobject> j_logo = MakeJavaLogo(
327 env, image.ToSkBitmap(), on_click_url, alt_text, animated_image_url); 329 env, image.ToSkBitmap(), on_click_url, alt_text, animated_image_url);
328 Java_LogoObserver_onLogoAvailable(env, j_logo_observer_, j_logo, 330 Java_LogoObserver_onLogoAvailable(env, j_logo_observer_, j_logo,
329 config_from_cache); 331 config_from_cache);
330 } 332 }
331 333
332 // static 334 // static
333 bool RegisterLogoBridge(JNIEnv* env) { 335 bool RegisterLogoBridge(JNIEnv* env) {
334 return RegisterNativesImpl(env); 336 return RegisterNativesImpl(env);
335 } 337 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698