Commit a7e57da9 authored by Jeffrey Young's avatar Jeffrey Young Committed by Commit Bot

ambient: change attribution text

Concatenate metadata_line_{1,2} with spaces.
Ignore metadata_line_3.

BUG=b:170360468

Cq-Include-Trybots: luci.chrome.try:linux-chromeos-chrome
Change-Id: I3151728baac2d3b44330a54b1684844d83562def
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2468839Reviewed-by: default avatarXiaohui Chen <xiaohuic@chromium.org>
Reviewed-by: default avatarTao Wu <wutao@chromium.org>
Reviewed-by: default avatarMeilin Wang <meilinw@chromium.org>
Commit-Queue: Jeffrey Young <cowmoo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#817354}
parent 867900fa
...@@ -90,37 +90,19 @@ std::unique_ptr<network::ResourceRequest> CreateResourceRequest( ...@@ -90,37 +90,19 @@ std::unique_ptr<network::ResourceRequest> CreateResourceRequest(
return resource_request; return resource_request;
} }
std::string BuildCuratedTopicDetails( std::string BuildBackdropTopicDetails(
const backdrop::ScreenUpdate::Topic& topic) { const backdrop::ScreenUpdate::Topic& backdrop_topic) {
if (topic.has_metadata_line_1() && topic.has_metadata_line_2()) { std::string result;
// Uses a space as the separator between. if (backdrop_topic.has_metadata_line_1())
return topic.metadata_line_1() + " " + topic.metadata_line_2(); result += backdrop_topic.metadata_line_1();
} else if (topic.has_metadata_line_1()) {
return topic.metadata_line_1(); if (backdrop_topic.has_metadata_line_2()) {
} else if (topic.has_metadata_line_2()) { if (!result.empty())
return topic.metadata_line_2(); result += " ";
} else { result += backdrop_topic.metadata_line_2();
return std::string();
}
}
std::string BuildPersonalTopicDetails(
const backdrop::ScreenUpdate::Topic& topic) {
// |metadata_line_1| contains the album name.
return topic.has_metadata_line_1() ? topic.metadata_line_1() : std::string();
}
void BuildBackdropTopicDetails(
const backdrop::ScreenUpdate::Topic& backdrop_topic,
AmbientModeTopic& ambient_topic) {
switch (backdrop_topic.topic_type()) {
case backdrop::TopicSource::PERSONAL_PHOTO:
ambient_topic.details = BuildPersonalTopicDetails(backdrop_topic);
break;
default:
ambient_topic.details = BuildCuratedTopicDetails(backdrop_topic);
break;
} }
// Do not include metadata_line_3.
return result;
} }
AmbientModeTopicType ToAmbientModeTopicType( AmbientModeTopicType ToAmbientModeTopicType(
...@@ -240,8 +222,7 @@ ScreenUpdate ToScreenUpdate( ...@@ -240,8 +222,7 @@ ScreenUpdate ToScreenUpdate(
backdrop_topic.related_topic().url(); backdrop_topic.related_topic().url();
} }
} }
ambient_topic.details = BuildBackdropTopicDetails(backdrop_topic);
BuildBackdropTopicDetails(backdrop_topic, ambient_topic);
screen_update.next_topics.emplace_back(ambient_topic); screen_update.next_topics.emplace_back(ambient_topic);
} }
} }
......
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