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

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

Issue 2831023003: Refactor AddScrollListItem() in system menu detailed views (Closed)
Patch Set: Rebased Created 3 years, 8 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/system/bluetooth/tray_bluetooth.cc ('k') | ash/system/ime_menu/ime_list_view.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/system/cast/tray_cast.cc
diff --git a/ash/system/cast/tray_cast.cc b/ash/system/cast/tray_cast.cc
index 899b4d0c9a2adebc48eb915e2bcb464e3f5de1ee..70678868956a74cfdf529dad77b6a306f38f9419 100644
--- a/ash/system/cast/tray_cast.cc
+++ b/ash/system/cast/tray_cast.cc
@@ -315,7 +315,6 @@ class CastDetailedView : public TrayDetailsView {
void CreateItems();
void UpdateReceiverListFromCachedData();
- views::View* AddToReceiverList(const mojom::SinkAndRoutePtr& sink_route);
// TrayDetailsView:
void HandleViewClicked(views::View* view) override;
@@ -388,7 +387,8 @@ void CastDetailedView::UpdateReceiverListFromCachedData() {
// Add a view for each receiver.
for (auto& it : sinks_and_routes_) {
const ash::mojom::SinkAndRoutePtr& sink_route = it.second;
- views::View* container = AddToReceiverList(sink_route);
+ const base::string16 name = base::UTF8ToUTF16(sink_route->sink->name);
+ views::View* container = AddScrollListItem(kSystemMenuCastDeviceIcon, name);
view_to_sink_map_[container] = sink_route->sink.Clone();
}
@@ -396,18 +396,6 @@ void CastDetailedView::UpdateReceiverListFromCachedData() {
scroller()->Layout();
}
-views::View* CastDetailedView::AddToReceiverList(
- const ash::mojom::SinkAndRoutePtr& sink_route) {
- const gfx::ImageSkia image =
- gfx::CreateVectorIcon(kSystemMenuCastDeviceIcon, kMenuIconColor);
-
- HoverHighlightView* container = new HoverHighlightView(this);
- container->AddIconAndLabel(image, base::UTF8ToUTF16(sink_route->sink->name));
-
- scroll_content()->AddChildView(container);
- return container;
-}
-
void CastDetailedView::HandleViewClicked(views::View* view) {
// Find the receiver we are going to cast to.
auto it = view_to_sink_map_.find(view);
« no previous file with comments | « ash/system/bluetooth/tray_bluetooth.cc ('k') | ash/system/ime_menu/ime_list_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698