OLD | NEW |
| (Empty) |
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. | |
4 | |
5 #ifndef ASH_COMMON_SYSTEM_CHROMEOS_NETWORK_NETWORK_LIST_H_ | |
6 #define ASH_COMMON_SYSTEM_CHROMEOS_NETWORK_NETWORK_LIST_H_ | |
7 | |
8 #include <map> | |
9 #include <memory> | |
10 #include <set> | |
11 #include <string> | |
12 #include <vector> | |
13 | |
14 #include "ash/common/system/chromeos/network/network_icon_animation_observer.h" | |
15 #include "ash/common/system/chromeos/network/network_list_view_base.h" | |
16 #include "base/macros.h" | |
17 #include "chromeos/network/network_state_handler.h" | |
18 #include "ui/gfx/image/image_skia.h" | |
19 | |
20 namespace views { | |
21 class Label; | |
22 class View; | |
23 } | |
24 | |
25 namespace ash { | |
26 | |
27 struct NetworkInfo; | |
28 class NetworkListDelegate; | |
29 | |
30 // A list of available networks of a given type. This class is used for all | |
31 // network types except VPNs. For VPNs, see the |VPNList| class. | |
32 class NetworkListView : public NetworkListViewBase, | |
33 public network_icon::AnimationObserver { | |
34 public: | |
35 explicit NetworkListView(NetworkListDelegate* delegate); | |
36 ~NetworkListView() override; | |
37 | |
38 // NetworkListViewBase: | |
39 void Update() override; | |
40 bool IsNetworkEntry(views::View* view, std::string* guid) const override; | |
41 | |
42 private: | |
43 void UpdateNetworks( | |
44 const chromeos::NetworkStateHandler::NetworkStateList& networks); | |
45 void UpdateNetworkIcons(); | |
46 void UpdateNetworkListInternal(); | |
47 void HandleRelayout(); | |
48 bool UpdateNetworkListEntries(std::set<std::string>* new_guids); | |
49 bool UpdateNetworkChildren(std::set<std::string>* new_guids, | |
50 int* child_index, | |
51 bool highlighted); | |
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); | |
55 | |
56 // network_icon::AnimationObserver: | |
57 void NetworkIconChanged() override; | |
58 | |
59 NetworkListDelegate* delegate_; | |
60 | |
61 views::Label* no_wifi_networks_view_; | |
62 views::Label* no_cellular_networks_view_; | |
63 | |
64 // An owned list of network info. | |
65 std::vector<std::unique_ptr<NetworkInfo>> network_list_; | |
66 | |
67 typedef std::map<views::View*, std::string> NetworkMap; | |
68 NetworkMap network_map_; | |
69 | |
70 // A map of network guids to their view. | |
71 typedef std::map<std::string, views::View*> NetworkGuidMap; | |
72 NetworkGuidMap network_guid_map_; | |
73 | |
74 DISALLOW_COPY_AND_ASSIGN(NetworkListView); | |
75 }; | |
76 | |
77 } // namespace ash | |
78 | |
79 #endif // ASH_COMMON_SYSTEM_CHROMEOS_NETWORK_NETWORK_LIST_H_ | |
OLD | NEW |