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

Unified Diff: components/suggestions/image_manager.cc

Issue 2794343002: Network traffic annotation added to image_data_fetcher. (Closed)
Patch Set: 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 side-by-side diff with in-line comments
Download patch
Index: components/suggestions/image_manager.cc
diff --git a/components/suggestions/image_manager.cc b/components/suggestions/image_manager.cc
index 366a6a2018c8341130c37973c418c170cc7239cc..10ddf5ef7d6cd067948419cf7a319779b9eb6e1a 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 "
msramek 2017/05/19 08:47:38 nit: Offset.
Ramin Halavati 2017/05/19 09:03:37 Done.
+ "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);
}
}

Powered by Google App Engine
This is Rietveld 408576698