Commit 452d37a0 authored by Takumi Fujimoto's avatar Takumi Fujimoto Committed by Commit Bot

[Harmony Cast Dialog] Add sink status text for available and connecting states

Show "Available" or "Connecting..." as the status text for sinks in respective
states. Default to the status text if supplied by the sink.

Bug: 844099
Change-Id: I5ba8b82960413dd7927182d34e2112ed391a12ba
Reviewed-on: https://chromium-review.googlesource.com/1071089Reviewed-by: default avatarDerek Cheng <imcheng@chromium.org>
Commit-Queue: Takumi Fujimoto <takumif@chromium.org>
Cr-Commit-Position: refs/heads/master@{#563083}
parent 591d060a
......@@ -195,6 +195,12 @@
<message name="IDS_MEDIA_ROUTER_DESTINATION_MISSING" desc="Link to display when no Cast destinations are found which, on click, opens a page to the Chromecast help center explaining possible reasons why none are detected.">
No Cast destinations found. Need help?
</message>
<message name="IDS_MEDIA_ROUTER_SINK_AVAILABLE" desc="Text shown as the status of a Cast destination that the user can Cast to.">
Available
</message>
<message name="IDS_MEDIA_ROUTER_SINK_CONNECTING" desc="Text shown as the status of a Cast destination that we are starting a Cast session on.">
Connecting...
</message>
<!-- Sink Search -->
<message name="IDS_MEDIA_ROUTER_SEARCH_LABEL" desc="Label for search input in sink list.">
......
......@@ -80,6 +80,19 @@ std::unique_ptr<views::View> CreateSecondaryIconForSink(
return nullptr;
}
base::string16 GetStatusTextForSink(const UIMediaSink& sink) {
if (!sink.status_text.empty())
return sink.status_text;
switch (sink.state) {
case UIMediaSinkState::AVAILABLE:
return l10n_util::GetStringUTF16(IDS_MEDIA_ROUTER_SINK_AVAILABLE);
case UIMediaSinkState::CONNECTING:
return l10n_util::GetStringUTF16(IDS_MEDIA_ROUTER_SINK_CONNECTING);
default:
return base::string16();
}
}
} // namespace
CastDialogSinkButton::CastDialogSinkButton(
......@@ -88,7 +101,7 @@ CastDialogSinkButton::CastDialogSinkButton(
: HoverButton(button_listener,
CreatePrimaryIconForSink(sink),
sink.friendly_name,
sink.status_text,
GetStatusTextForSink(sink),
CreateSecondaryIconForSink(sink)),
sink_(sink) {}
......
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