fake_bluetooth_detailed_view.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. // Copyright 2021 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_BLUETOOTH_FAKE_BLUETOOTH_DETAILED_VIEW_H_
  5. #define ASH_SYSTEM_BLUETOOTH_FAKE_BLUETOOTH_DETAILED_VIEW_H_
  6. #include <memory>
  7. #include "ash/ash_export.h"
  8. #include "ash/system/bluetooth/bluetooth_detailed_view.h"
  9. #include "ash/system/tray/view_click_listener.h"
  10. #include "third_party/abseil-cpp/absl/types/optional.h"
  11. #include "ui/gfx/vector_icon_types.h"
  12. #include "ui/views/view.h"
  13. namespace views {
  14. class View;
  15. } // namespace views
  16. namespace ash {
  17. class BluetoothDeviceListItemView;
  18. class TriView;
  19. // Fake BluetoothDetailedView implementation.
  20. class ASH_EXPORT FakeBluetoothDetailedView : public BluetoothDetailedView,
  21. public ViewClickListener,
  22. public views::View {
  23. public:
  24. explicit FakeBluetoothDetailedView(Delegate* delegate);
  25. FakeBluetoothDetailedView(const FakeBluetoothDetailedView&) = delete;
  26. FakeBluetoothDetailedView& operator=(const FakeBluetoothDetailedView&) =
  27. delete;
  28. ~FakeBluetoothDetailedView() override;
  29. size_t notify_device_list_changed_call_count() const {
  30. return notify_device_list_changed_call_count_;
  31. }
  32. const absl::optional<bool>& last_bluetooth_enabled_state() const {
  33. return last_bluetooth_enabled_state_;
  34. }
  35. const BluetoothDeviceListItemView* last_clicked_device_list_item() const {
  36. return last_clicked_device_list_item_;
  37. }
  38. private:
  39. // BluetoothDetailedView:
  40. views::View* GetAsView() override;
  41. void UpdateBluetoothEnabledState(bool enabled) override;
  42. BluetoothDeviceListItemView* AddDeviceListItem() override;
  43. ash::TriView* AddDeviceListSubHeader(const gfx::VectorIcon& /*icon*/,
  44. int text_id) override;
  45. void NotifyDeviceListChanged() override;
  46. views::View* device_list() override;
  47. // ViewClickListener:
  48. void OnViewClicked(views::View* view) override;
  49. size_t notify_device_list_changed_call_count_ = 0;
  50. absl::optional<bool> last_bluetooth_enabled_state_;
  51. std::unique_ptr<views::View> device_list_;
  52. BluetoothDeviceListItemView* last_clicked_device_list_item_ = nullptr;
  53. };
  54. } // namespace ash
  55. #endif // ASH_SYSTEM_BLUETOOTH_FAKE_BLUETOOTH_DETAILED_VIEW_H_