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

Unified Diff: components/suggestions/image_manager.cc

Issue 2794343002: Network traffic annotation added to image_data_fetcher. (Closed)
Patch Set: Comments addressed. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/ntp_tiles/icon_cacher_impl_unittest.cc ('k') | components/suggestions/image_manager_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/suggestions/image_manager.cc
diff --git a/components/suggestions/image_manager.cc b/components/suggestions/image_manager.cc
index 366a6a2018c8341130c37973c418c170cc7239cc..d2fb227f9ac4d80e0f1f2be89560c6604694b2a8 100644
--- a/components/suggestions/image_manager.cc
+++ b/components/suggestions/image_manager.cc
@@ -12,6 +12,7 @@
#include "base/task_runner_util.h"
#include "components/image_fetcher/core/image_fetcher.h"
#include "components/suggestions/image_encoder.h"
+#include "net/traffic_annotation/network_traffic_annotation.h"
#include "ui/gfx/image/image.h"
using leveldb_proto::ProtoDatabase;
@@ -39,6 +40,39 @@ void WrapCallback(
wrapped_callback.Run(GURL(url), image);
}
+constexpr net::NetworkTrafficAnnotationTag kTrafficAnnotation =
+ net::DefineNetworkTrafficAnnotation("suggestions_image_manager", R"(
+ semantics {
+ sender: "Suggestions Service Thumbnail Fetch"
+ description:
+ "Retrieves thumbnails for site suggestions based on the user's "
+ "synced browsing history, for use e.g. on the New Tab page."
+ trigger:
+ "Triggered when a thumbnail for a suggestion is required, and no "
+ "local thumbnail is available."
+ data: "The URL for which to retrieve a thumbnail."
+ destination: GOOGLE_OWNED_SERVICE
+ }
+ policy {
+ cookies_allowed: false
+ setting:
+ "Users can disable this feature by signing out of Chrome, or "
+ "disabling Sync or History Sync in Chrome settings under 'Advanced "
+ "sync settings...'. The feature is enabled by default."
+ chrome_policy {
+ SyncDisabled {
+ policy_options {mode: MANDATORY}
+ SyncDisabled: true
+ }
+ }
+ chrome_policy {
+ SigninAllowed {
+ policy_options {mode: MANDATORY}
+ SigninAllowed: false
+ }
+ }
+ })");
+
} // namespace
namespace suggestions {
@@ -146,7 +180,8 @@ void ImageManager::OnCacheImageDecoded(
callback.Run(url, gfx::Image::CreateFrom1xBitmap(*bitmap));
} else {
image_fetcher_->StartOrQueueNetworkRequest(
- url.spec(), image_url, base::Bind(&WrapCallback, callback));
+ url.spec(), image_url, base::Bind(&WrapCallback, callback),
+ kTrafficAnnotation);
}
}
@@ -173,7 +208,8 @@ void ImageManager::ServeFromCacheOrNetwork(
weak_ptr_factory_.GetWeakPtr(), url, image_url, callback));
} else {
image_fetcher_->StartOrQueueNetworkRequest(
- url.spec(), image_url, base::Bind(&WrapCallback, callback));
+ url.spec(), image_url, base::Bind(&WrapCallback, callback),
+ kTrafficAnnotation);
}
}
« no previous file with comments | « components/ntp_tiles/icon_cacher_impl_unittest.cc ('k') | components/suggestions/image_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698