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

Unified Diff: ash/common/system/chromeos/cast/tray_cast.cc

Issue 2656003006: cros: Fix various small issues with cast tray entry. (Closed)
Patch Set: Rebase Created 3 years, 11 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 | « ash/ash_strings.grd ('k') | ash/common/system/chromeos/screen_security/screen_tray_item.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/common/system/chromeos/cast/tray_cast.cc
diff --git a/ash/common/system/chromeos/cast/tray_cast.cc b/ash/common/system/chromeos/cast/tray_cast.cc
index 9352de412a996f7a52fb1beae0f0676017f868ec..be5df751677372def109e8cb82db7a83c2f3c685 100644
--- a/ash/common/system/chromeos/cast/tray_cast.cc
+++ b/ash/common/system/chromeos/cast/tray_cast.cc
@@ -160,7 +160,9 @@ void CastCastView::UpdateLabel(
const mojom::CastSinkPtr& sink = i->sink;
const mojom::CastRoutePtr& route = i->route;
- if (!route->id.empty()) {
+ // We only want to display casts that came from this machine, since on a
+ // busy network many other people could be casting.
+ if (!route->id.empty() && route->is_local_source) {
displayed_route_ = route.Clone();
// We want to display different labels inside of the title depending on
@@ -170,27 +172,34 @@ void CastCastView::UpdateLabel(
case ash::mojom::ContentSource::UNKNOWN:
label()->SetText(
l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_CAST_CAST_UNKNOWN));
+ stop_button()->SetAccessibleName(l10n_util::GetStringUTF16(
+ IDS_ASH_STATUS_TRAY_CAST_CAST_UNKNOWN_ACCESSIBILITY_STOP));
break;
case ash::mojom::ContentSource::TAB:
label()->SetText(ElideString(l10n_util::GetStringFUTF16(
IDS_ASH_STATUS_TRAY_CAST_CAST_TAB,
base::UTF8ToUTF16(route->title), base::UTF8ToUTF16(sink->name))));
+ stop_button()->SetAccessibleName(
+ ElideString(l10n_util::GetStringFUTF16(
+ IDS_ASH_STATUS_TRAY_CAST_CAST_TAB_ACCESSIBILITY_STOP,
+ base::UTF8ToUTF16(route->title),
+ base::UTF8ToUTF16(sink->name))));
break;
case ash::mojom::ContentSource::DESKTOP:
label()->SetText(ElideString(
l10n_util::GetStringFUTF16(IDS_ASH_STATUS_TRAY_CAST_CAST_DESKTOP,
base::UTF8ToUTF16(sink->name))));
+ stop_button()->SetAccessibleName(
+ ElideString(l10n_util::GetStringFUTF16(
+ IDS_ASH_STATUS_TRAY_CAST_CAST_DESKTOP_ACCESSIBILITY_STOP,
+ base::UTF8ToUTF16(sink->name))));
break;
}
PreferredSizeChanged();
Layout();
-
- // If this machine is the source of the activity, then we want to display
- // it over any other activity. There can be multiple activities if other
- // devices on the network are casting at the same time.
- if (route->is_local_source)
- break;
+ // Only need to update labels once.
+ break;
}
}
}
@@ -547,11 +556,8 @@ void TrayCast::UpdatePrimaryView() {
}
bool TrayCast::HasActiveRoute() {
- if (is_mirror_casting_)
- return true;
-
for (const auto& sr : sinks_and_routes_) {
- if (!sr->route->title.empty())
+ if (!sr->route->title.empty() && sr->route->is_local_source)
return true;
}
« no previous file with comments | « ash/ash_strings.grd ('k') | ash/common/system/chromeos/screen_security/screen_tray_item.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698