network_list_network_item_view.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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_NETWORK_ITEM_VIEW_H_
  5. #define ASH_SYSTEM_NETWORK_NETWORK_LIST_NETWORK_ITEM_VIEW_H_
  6. #include "ash/ash_export.h"
  7. #include "ash/system/network/network_info.h"
  8. #include "ash/system/network/network_list_item_view.h"
  9. #include "ash/system/tray/hover_highlight_view.h"
  10. #include "chromeos/services/network_config/public/mojom/cros_network_config.mojom.h"
  11. #include "ui/base/metadata/metadata_impl_macros.h"
  12. #include "ui/views/view.h"
  13. namespace ash {
  14. class ViewClickListener;
  15. // This class encapsulates the logic of configuring the view shown for a single
  16. // network (Mobile, Wifi and Ethernet) in the detailed Network page within the
  17. // quick settings.
  18. class ASH_EXPORT NetworkListNetworkItemView : public NetworkListItemView {
  19. public:
  20. METADATA_HEADER(NetworkListNetworkItemView);
  21. explicit NetworkListNetworkItemView(ViewClickListener* listener);
  22. NetworkListNetworkItemView(const NetworkListNetworkItemView&) = delete;
  23. NetworkListNetworkItemView& operator=(const NetworkListNetworkItemView&) =
  24. delete;
  25. ~NetworkListNetworkItemView() override;
  26. // NetworkListItemView:
  27. void UpdateViewForNetwork(
  28. const chromeos::network_config::mojom::NetworkStatePropertiesPtr&
  29. network_properties) override;
  30. private:
  31. friend class NetworkListNetworkItemViewTest;
  32. void SetupCellularSubtext();
  33. void SetupNetworkSubtext();
  34. void UpdateDisabledTextColor();
  35. void AddPowerStatusView();
  36. void AddPolicyView();
  37. std::u16string GenerateAccessibilityLabel(const std::u16string& label);
  38. std::u16string GenerateAccessibilityDescription();
  39. std::u16string GenerateAccessibilityDescriptionForEthernet(
  40. const std::u16string& connection_status);
  41. std::u16string GenerateAccessibilityDescriptionForWifi(
  42. const std::u16string& connection_status,
  43. int signal_strength);
  44. std::u16string GenerateAccessibilityDescriptionForCellular(
  45. const std::u16string& connection_status,
  46. int signal_strength);
  47. std::u16string GenerateAccessibilityDescriptionForTether(
  48. const std::u16string& connection_status,
  49. int signal_strength);
  50. };
  51. } // namespace ash
  52. #endif // ASH_SYSTEM_NETWORK_NETWORK_LIST_NETWORK_ITEM_VIEW_H_