Commit 4fb93387 authored by Wenzhao Zang's avatar Wenzhao Zang Committed by Commit Bot

cros: Add "chromebook" filter to Backdrop requests

Bug: 873711
Change-Id: I35e6c04cc1d137db35ec1f02a41ce55d2b51b0e4
Reviewed-on: https://chromium-review.googlesource.com/1172068Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Commit-Queue: Wenzhao (Colin) Zang <wzang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#582748}
parent 719d952a
...@@ -32,6 +32,9 @@ constexpr char kBackdropSurpriseMeImageUrl[] = ...@@ -32,6 +32,9 @@ constexpr char kBackdropSurpriseMeImageUrl[] =
"https://clients3.google.com/cast/chromecast/home/wallpaper/" "https://clients3.google.com/cast/chromecast/home/wallpaper/"
"image?rt=b"; "image?rt=b";
// The label used to return exclusive content or filter unwanted images.
constexpr char kFilteringLabel[] = "chromebook";
// Helper function to parse the data from a |backdrop::Image| object and save it // Helper function to parse the data from a |backdrop::Image| object and save it
// to |image_info_out|. // to |image_info_out|.
void ParseImageInfo( void ParseImageInfo(
...@@ -142,6 +145,7 @@ void CollectionInfoFetcher::Start(OnCollectionsInfoFetched callback) { ...@@ -142,6 +145,7 @@ void CollectionInfoFetcher::Start(OnCollectionsInfoFetched callback) {
backdrop::GetCollectionsRequest request; backdrop::GetCollectionsRequest request;
// The language field may include the country code (e.g. "en-US"). // The language field may include the country code (e.g. "en-US").
request.set_language(g_browser_process->GetApplicationLocale()); request.set_language(g_browser_process->GetApplicationLocale());
request.add_filtering_label(kFilteringLabel);
std::string serialized_proto; std::string serialized_proto;
request.SerializeToString(&serialized_proto); request.SerializeToString(&serialized_proto);
...@@ -219,6 +223,7 @@ void ImageInfoFetcher::Start(OnImagesInfoFetched callback) { ...@@ -219,6 +223,7 @@ void ImageInfoFetcher::Start(OnImagesInfoFetched callback) {
// The language field may include the country code (e.g. "en-US"). // The language field may include the country code (e.g. "en-US").
request.set_language(g_browser_process->GetApplicationLocale()); request.set_language(g_browser_process->GetApplicationLocale());
request.set_collection_id(collection_id_); request.set_collection_id(collection_id_);
request.add_filtering_label(kFilteringLabel);
std::string serialized_proto; std::string serialized_proto;
request.SerializeToString(&serialized_proto); request.SerializeToString(&serialized_proto);
...@@ -294,6 +299,7 @@ void SurpriseMeImageFetcher::Start(OnSurpriseMeImageFetched callback) { ...@@ -294,6 +299,7 @@ void SurpriseMeImageFetcher::Start(OnSurpriseMeImageFetched callback) {
// The language field may include the country code (e.g. "en-US"). // The language field may include the country code (e.g. "en-US").
request.set_language(g_browser_process->GetApplicationLocale()); request.set_language(g_browser_process->GetApplicationLocale());
request.add_collection_ids(collection_id_); request.add_collection_ids(collection_id_);
request.add_filtering_label(kFilteringLabel);
if (!resume_token_.empty()) if (!resume_token_.empty())
request.set_resume_token(resume_token_); request.set_resume_token(resume_token_);
std::string serialized_proto; std::string serialized_proto;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment