Index: ash/common/system/cast/tray_cast.cc |
diff --git a/ash/common/system/cast/tray_cast.cc b/ash/common/system/cast/tray_cast.cc |
index 9aaeb54800757b876b20a711ff37e752b2312627..1c179ad0454eab7a32570bd880e4a8c9713231db 100644 |
--- a/ash/common/system/cast/tray_cast.cc |
+++ b/ash/common/system/cast/tray_cast.cc |
@@ -20,7 +20,6 @@ |
#include "ash/common/system/tray/tray_item_more.h" |
#include "ash/common/system/tray/tray_item_view.h" |
#include "ash/common/system/tray/tray_popup_label_button.h" |
-#include "ash/common/system/tray/view_click_listener.h" |
#include "ash/common/wm_shell.h" |
#include "base/bind.h" |
#include "grit/ash_resources.h" |
@@ -385,7 +384,7 @@ void CastTrayView::UpdateAlignment(ShelfAlignment alignment) { |
// This view displays a list of cast receivers that can be clicked on and casted |
// to. It is activated by clicking on the chevron inside of |
// |CastSelectDefaultView|. |
-class CastDetailedView : public TrayDetailsView, public ViewClickListener { |
+class CastDetailedView : public TrayDetailsView { |
public: |
CastDetailedView(SystemTrayItem* owner, |
LoginStatus login, |
@@ -409,10 +408,9 @@ class CastDetailedView : public TrayDetailsView, public ViewClickListener { |
const CastConfigDelegate::ReceiverAndActivity& receiverActivity); |
void AppendSettingsEntries(); |
- void AppendHeaderEntry(); |
- // Overridden from ViewClickListener. |
- void OnViewClicked(views::View* sender) override; |
+ // TrayDetailsView: |
+ void HandleViewClicked(views::View* view) override; |
LoginStatus login_; |
views::View* options_ = nullptr; |
@@ -440,7 +438,7 @@ void CastDetailedView::SimulateViewClickedForTest( |
const std::string& receiver_id) { |
for (auto& it : receiver_activity_map_) { |
if (it.second == receiver_id) { |
- OnViewClicked(it.first); |
+ HandleViewClicked(it.first); |
break; |
} |
} |
@@ -450,7 +448,7 @@ void CastDetailedView::CreateItems() { |
CreateScrollableList(); |
if (GetCastConfigDelegate()->HasOptions()) |
AppendSettingsEntries(); |
- AppendHeaderEntry(); |
+ CreateTitleRow(IDS_ASH_STATUS_TRAY_CAST); |
} |
void CastDetailedView::UpdateReceiverList( |
@@ -533,25 +531,18 @@ void CastDetailedView::AppendSettingsEntries() { |
options_ = container; |
} |
-void CastDetailedView::AppendHeaderEntry() { |
- CreateSpecialRow(IDS_ASH_STATUS_TRAY_CAST, this); |
-} |
- |
-void CastDetailedView::OnViewClicked(views::View* sender) { |
- CastConfigDelegate* cast_config_delegate = GetCastConfigDelegate(); |
+void CastDetailedView::HandleViewClicked(views::View* view) { |
+ if (view == options_) { |
+ GetCastConfigDelegate()->LaunchCastOptions(); |
+ return; |
+ } |
- if (sender == footer()->content()) { |
- TransitionToDefaultView(); |
- } else if (sender == options_) { |
- cast_config_delegate->LaunchCastOptions(); |
- } else { |
- // Find the receiver we are going to cast to |
- auto it = receiver_activity_map_.find(sender); |
- if (it != receiver_activity_map_.end()) { |
- cast_config_delegate->CastToReceiver(it->second); |
- WmShell::Get()->RecordUserMetricsAction( |
- UMA_STATUS_AREA_DETAILED_CAST_VIEW_LAUNCH_CAST); |
- } |
+ // Find the receiver we are going to cast to. |
+ auto it = receiver_activity_map_.find(view); |
+ if (it != receiver_activity_map_.end()) { |
+ GetCastConfigDelegate()->CastToReceiver(it->second); |
+ WmShell::Get()->RecordUserMetricsAction( |
+ UMA_STATUS_AREA_DETAILED_CAST_VIEW_LAUNCH_CAST); |
} |
} |