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_MD_H_ | |
6 #define UI_CHROMEOS_NETWORK_NETWORK_LIST_MD_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 #include "ui/views/controls/button/button.h" | |
21 | |
22 namespace views { | |
23 class Label; | |
24 class View; | |
25 } | |
26 | |
27 namespace ui { | |
28 | |
29 struct NetworkInfo; | |
30 class NetworkListDelegate; | |
31 | |
32 // A list of available networks of a given type. This class is used for all | |
33 // network types except VPNs. For VPNs, see the |VPNList| class. | |
34 class UI_CHROMEOS_EXPORT NetworkListViewMd | |
35 : public NetworkListViewBase, | |
36 public network_icon::AnimationObserver, | |
37 public views::ButtonListener { | |
38 public: | |
39 explicit NetworkListViewMd(NetworkListDelegate* delegate); | |
40 ~NetworkListViewMd() override; | |
41 | |
42 // NetworkListViewBase: | |
43 void Update() override; | |
44 bool IsNetworkEntry(views::View* view, | |
45 std::string* service_path) const override; | |
46 | |
47 private: | |
48 class WiFiHeaderRowView; | |
49 | |
50 void UpdateNetworks( | |
51 const chromeos::NetworkStateHandler::NetworkStateList& networks); | |
52 void UpdateNetworkIcons(); | |
53 void OrderNetworks(); | |
54 void UpdateNetworkListInternal(); | |
55 void HandleRelayout(); | |
56 bool UpdateNetworkListEntries(std::set<std::string>* new_service_paths); | |
57 bool UpdateNetworkChildren(std::set<std::string>* new_service_paths, | |
58 int* child_index, | |
59 bool wifi); | |
60 bool UpdateNetworkChild(int index, const NetworkInfo* info); | |
61 bool PlaceViewAtIndex(views::View* view, int index); | |
62 bool UpdateInfoLabel(int message_id, int index, views::Label** label); | |
63 bool UpdateWiFiHeaderRow(bool enabled, int index, WiFiHeaderRowView** view); | |
Evan Stade
2016/09/23 01:37:59
these are all in dire need of documentation
varkha
2016/09/23 04:50:36
Done.
| |
64 | |
65 // network_icon::AnimationObserver: | |
66 void NetworkIconChanged() override; | |
67 | |
68 // views::ButtonListener: | |
69 void ButtonPressed(views::Button* sender, const ui::Event& event) override; | |
70 | |
71 NetworkListDelegate* delegate_; | |
72 | |
73 views::Label* no_wifi_networks_view_; | |
74 views::Label* no_cellular_networks_view_; | |
75 WiFiHeaderRowView* wifi_header_view_; | |
76 | |
77 // An owned list of network info. | |
78 std::vector<std::unique_ptr<NetworkInfo>> network_list_; | |
79 | |
80 typedef std::map<views::View*, std::string> NetworkMap; | |
81 NetworkMap network_map_; | |
82 | |
83 // A map of network service paths to their view. | |
84 typedef std::map<std::string, views::View*> ServicePathMap; | |
85 ServicePathMap service_path_map_; | |
86 | |
87 DISALLOW_COPY_AND_ASSIGN(NetworkListViewMd); | |
88 }; | |
89 | |
90 } // namespace ui | |
91 | |
92 #endif // UI_CHROMEOS_NETWORK_NETWORK_LIST_MD_H_ | |
OLD | NEW |