1 // Copyright 2014 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.
5 #ifndef UI_CHROMEOS_NETWORK_NETWORK_LIST_H_
6 #define UI_CHROMEOS_NETWORK_NETWORK_LIST_H_
12 #include "chromeos/network/network_state_handler.h"
13 #include "ui/chromeos/network/network_icon_animation_observer.h"
14 #include "ui/chromeos/network/network_list_view_base.h"
15 #include "ui/chromeos/ui_chromeos_export.h"
16 #include "ui/gfx/image/image_skia.h"
26 class NetworkListDelegate
;
28 // A list of available networks of a given type. This class is used for all
29 // network types except VPNs. For VPNs, see the |VPNList| class.
30 class UI_CHROMEOS_EXPORT NetworkListView
31 : public NetworkListViewBase
,
32 public network_icon::AnimationObserver
{
34 explicit NetworkListView(NetworkListDelegate
* delegate
);
35 ~NetworkListView() override
;
37 // NetworkListViewBase:
38 void Update() override
;
39 bool IsNetworkEntry(views::View
* view
,
40 std::string
* service_path
) const override
;
44 const chromeos::NetworkStateHandler::NetworkStateList
& networks
);
45 void UpdateNetworkIcons();
46 void UpdateNetworkListInternal();
47 void HandleRelayout();
48 bool UpdateNetworkListEntries(std::set
<std::string
>* new_service_paths
);
49 bool UpdateNetworkChildren(std::set
<std::string
>* new_service_paths
,
52 bool UpdateNetworkChild(int index
, const NetworkInfo
* info
);
53 bool PlaceViewAtIndex(views::View
* view
, int index
);
54 bool UpdateInfoLabel(int message_id
, int index
, views::Label
** label
);
56 // network_icon::AnimationObserver:
57 void NetworkIconChanged() override
;
59 NetworkListDelegate
* delegate_
;
61 views::Label
* scanning_view_
;
62 views::Label
* no_wifi_networks_view_
;
63 views::Label
* no_cellular_networks_view_
;
65 // An owned list of network info.
66 ScopedVector
<NetworkInfo
> network_list_
;
68 typedef std::map
<views::View
*, std::string
> NetworkMap
;
69 NetworkMap network_map_
;
71 // A map of network service paths to their view.
72 typedef std::map
<std::string
, views::View
*> ServicePathMap
;
73 ServicePathMap service_path_map_
;
75 DISALLOW_COPY_AND_ASSIGN(NetworkListView
);
80 #endif // UI_CHROMEOS_NETWORK_NETWORK_LIST_H_