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