Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / ui / chromeos / network / network_list.h
blob06ee3a6b3d7ea1bb1915c6d3ff5cd601edb7f5ba
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_
8 #include <map>
9 #include <set>
10 #include <string>
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"
18 namespace views {
19 class Label;
20 class View;
23 namespace ui {
25 struct NetworkInfo;
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 {
33 public:
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;
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_service_paths);
49 bool UpdateNetworkChildren(std::set<std::string>* new_service_paths,
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);
56 // network_icon::AnimationObserver:
57 void NetworkIconChanged() override;
59 NetworkListDelegate* delegate_;
61 views::Label* no_wifi_networks_view_;
62 views::Label* no_cellular_networks_view_;
64 // An owned list of network info.
65 ScopedVector<NetworkInfo> network_list_;
67 typedef std::map<views::View*, std::string> NetworkMap;
68 NetworkMap network_map_;
70 // A map of network service paths to their view.
71 typedef std::map<std::string, views::View*> ServicePathMap;
72 ServicePathMap service_path_map_;
74 DISALLOW_COPY_AND_ASSIGN(NetworkListView);
77 } // namespace ui
79 #endif // UI_CHROMEOS_NETWORK_NETWORK_LIST_H_