tray_cast.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. // Copyright 2015 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef ASH_SYSTEM_CAST_TRAY_CAST_H_
  5. #define ASH_SYSTEM_CAST_TRAY_CAST_H_
  6. #include <string>
  7. #include <vector>
  8. #include "ash/public/cpp/cast_config_controller.h"
  9. #include "ash/system/tray/tray_detailed_view.h"
  10. namespace ash {
  11. // This view displays a list of cast receivers that can be clicked on and casted
  12. // to. It is activated by clicking on the chevron inside of
  13. // |CastSelectDefaultView|.
  14. class CastDetailedView : public TrayDetailedView,
  15. public CastConfigController::Observer {
  16. public:
  17. explicit CastDetailedView(DetailedViewDelegate* delegate);
  18. CastDetailedView(const CastDetailedView&) = delete;
  19. CastDetailedView& operator=(const CastDetailedView&) = delete;
  20. ~CastDetailedView() override;
  21. // CastConfigController::Observer:
  22. void OnDevicesUpdated(const std::vector<SinkAndRoute>& devices) override;
  23. // views::View:
  24. const char* GetClassName() const override;
  25. views::View* get_add_access_code_device_for_testing() {
  26. return add_access_code_device_;
  27. }
  28. private:
  29. void CreateItems();
  30. void UpdateReceiverListFromCachedData();
  31. // TrayDetailedView:
  32. void HandleViewClicked(views::View* view) override;
  33. // A mapping from the sink id to the receiver/activity data.
  34. std::map<std::string, SinkAndRoute> sinks_and_routes_;
  35. // A mapping from the view pointer to the associated activity sink id.
  36. std::map<views::View*, std::string> view_to_sink_map_;
  37. // Special list item that, if clicked, launches the access code casting dialog
  38. views::View* add_access_code_device_ = nullptr;
  39. };
  40. } // namespace ash
  41. #endif // ASH_SYSTEM_CAST_TRAY_CAST_H_