network_list_wifi_header_view_impl.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. // Copyright 2022 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_NETWORK_NETWORK_LIST_WIFI_HEADER_VIEW_IMPL_H_
  5. #define ASH_SYSTEM_NETWORK_NETWORK_LIST_WIFI_HEADER_VIEW_IMPL_H_
  6. #include "ash/ash_export.h"
  7. #include "ash/style/icon_button.h"
  8. #include "ash/system/network/network_list_wifi_header_view.h"
  9. #include "ash/system/tray/tri_view.h"
  10. #include "base/memory/weak_ptr.h"
  11. #include "ui/views/view.h"
  12. namespace ash {
  13. // Implementation of NetworkListWifiHeaderView.
  14. class ASH_EXPORT NetworkListWifiHeaderViewImpl
  15. : public NetworkListWifiHeaderView {
  16. public:
  17. explicit NetworkListWifiHeaderViewImpl(
  18. NetworkListNetworkHeaderView::Delegate* delegate);
  19. NetworkListWifiHeaderViewImpl(const NetworkListWifiHeaderViewImpl&) = delete;
  20. NetworkListWifiHeaderViewImpl& operator=(
  21. const NetworkListWifiHeaderViewImpl&) = delete;
  22. ~NetworkListWifiHeaderViewImpl() override;
  23. private:
  24. friend class NetworkListWifiHeaderViewTest;
  25. // Used for testing.
  26. static constexpr int kJoinWifiButtonId =
  27. NetworkListNetworkHeaderView::kToggleButtonId + 1;
  28. // NetworkListNetworkHeaderView:
  29. void AddExtraButtons() override;
  30. void SetToggleState(bool enabled, bool is_on) override;
  31. void OnToggleToggled(bool is_on) override;
  32. // NetworkListWifiHeaderView:
  33. void SetJoinWifiButtonState(bool enabled, bool visible) override;
  34. void JoinWifiButtonPressed();
  35. // A button to invoke "Join Wi-Fi network" dialog.
  36. IconButton* join_wifi_button_ = nullptr;
  37. base::WeakPtrFactory<NetworkListWifiHeaderViewImpl> weak_factory_{this};
  38. };
  39. } // namespace ash
  40. #endif // ASH_SYSTEM_NETWORK_NETWORK_LIST_WIFI_HEADER_VIEW_IMPL_H_