base: Change DCHECK_IS_ON to a macro DCHECK_IS_ON().
[chromium-blink-merge.git] / ui / chromeos / network / network_list.h
blobca98f5d8475540971ccebe765f4f40e22d509b08
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/ui_chromeos_export.h"
15 #include "ui/gfx/image/image_skia.h"
17 namespace views {
18 class Label;
19 class View;
22 namespace ui {
24 struct NetworkInfo;
25 class NetworkListDelegate;
27 // NetworkListView can be used to present the list of available networks to the
28 // user.
29 class UI_CHROMEOS_EXPORT NetworkListView
30 : public network_icon::AnimationObserver {
31 public:
32 explicit NetworkListView(NetworkListDelegate* delegate);
33 virtual ~NetworkListView();
35 void UpdateNetworkList();
37 // Returns whether |view| is a View that represents a network in the list.
38 // |service_path| is set to the service-path of the network if this returns
39 // true, and remains unchanged if this returns false.
40 bool IsViewInList(views::View* view, std::string* service_path) const;
42 void set_content_view(views::View* content) { content_ = content; }
44 private:
45 void UpdateNetworks(
46 const chromeos::NetworkStateHandler::NetworkStateList& networks);
47 void UpdateNetworkListInternal();
48 bool UpdateNetworkListEntries(std::set<std::string>* new_service_paths);
49 bool UpdateNetworkChild(int index, const NetworkInfo* info);
50 bool PlaceViewAtIndex(views::View* view, int index);
51 bool UpdateInfoLabel(int message_id, int index, views::Label** label);
53 // network_icon::AnimationObserver:
54 virtual void NetworkIconChanged() override;
56 NetworkListDelegate* delegate_;
57 views::View* content_;
59 views::Label* scanning_view_;
60 views::Label* no_wifi_networks_view_;
61 views::Label* no_cellular_networks_view_;
63 // An owned list of network info.
64 ScopedVector<NetworkInfo> network_list_;
66 typedef std::map<views::View*, std::string> NetworkMap;
67 NetworkMap network_map_;
69 // A map of network service paths to their view.
70 typedef std::map<std::string, views::View*> ServicePathMap;
71 ServicePathMap service_path_map_;
73 DISALLOW_COPY_AND_ASSIGN(NetworkListView);
76 } // namespace ui
78 #endif // UI_CHROMEOS_NETWORK_NETWORK_LIST_H_