| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef UI_CHROMEOS_NETWORK_NETWORK_LIST_H_ | 5 #ifndef UI_CHROMEOS_NETWORK_NETWORK_LIST_H_ |
| 6 #define UI_CHROMEOS_NETWORK_NETWORK_LIST_H_ | 6 #define UI_CHROMEOS_NETWORK_NETWORK_LIST_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| 11 | 11 |
| 12 #include "chromeos/network/network_state_handler.h" | 12 #include "chromeos/network/network_state_handler.h" |
| 13 #include "ui/chromeos/network/network_icon_animation_observer.h" | 13 #include "ui/chromeos/network/network_icon_animation_observer.h" |
| 14 #include "ui/chromeos/network/network_list_view_base.h" |
| 14 #include "ui/chromeos/ui_chromeos_export.h" | 15 #include "ui/chromeos/ui_chromeos_export.h" |
| 15 #include "ui/gfx/image/image_skia.h" | 16 #include "ui/gfx/image/image_skia.h" |
| 16 | 17 |
| 17 namespace views { | 18 namespace views { |
| 18 class Label; | 19 class Label; |
| 19 class View; | 20 class View; |
| 20 } | 21 } |
| 21 | 22 |
| 22 namespace ui { | 23 namespace ui { |
| 23 | 24 |
| 24 struct NetworkInfo; | 25 struct NetworkInfo; |
| 25 class NetworkListDelegate; | 26 class NetworkListDelegate; |
| 26 | 27 |
| 27 // NetworkListView can be used to present the list of available networks to the | 28 // A list of available networks of a given type. This class is used for all |
| 28 // user. | 29 // network types except VPNs. For VPNs, see the |VPNList| class. |
| 29 class UI_CHROMEOS_EXPORT NetworkListView | 30 class UI_CHROMEOS_EXPORT NetworkListView |
| 30 : public network_icon::AnimationObserver { | 31 : public NetworkListViewBase, |
| 32 public network_icon::AnimationObserver { |
| 31 public: | 33 public: |
| 32 explicit NetworkListView(NetworkListDelegate* delegate); | 34 explicit NetworkListView(NetworkListDelegate* delegate); |
| 33 ~NetworkListView() override; | 35 ~NetworkListView() override; |
| 34 | 36 |
| 35 void UpdateNetworkList(); | 37 // NetworkListViewBase: |
| 36 | 38 void Update() override; |
| 37 // Returns whether |view| is a View that represents a network in the list. | 39 bool IsNetworkEntry(views::View* view, |
| 38 // |service_path| is set to the service-path of the network if this returns | 40 std::string* service_path) const override; |
| 39 // true, and remains unchanged if this returns false. | |
| 40 bool IsViewInList(views::View* view, std::string* service_path) const; | |
| 41 | |
| 42 void set_content_view(views::View* content) { content_ = content; } | |
| 43 | 41 |
| 44 private: | 42 private: |
| 45 void UpdateNetworks( | 43 void UpdateNetworks( |
| 46 const chromeos::NetworkStateHandler::NetworkStateList& networks); | 44 const chromeos::NetworkStateHandler::NetworkStateList& networks); |
| 47 void UpdateNetworkIcons(); | 45 void UpdateNetworkIcons(); |
| 48 void UpdateNetworkListInternal(); | 46 void UpdateNetworkListInternal(); |
| 49 void HandleRelayout(); | 47 void HandleRelayout(); |
| 50 bool UpdateNetworkListEntries(std::set<std::string>* new_service_paths); | 48 bool UpdateNetworkListEntries(std::set<std::string>* new_service_paths); |
| 51 bool UpdateNetworkChildren(std::set<std::string>* new_service_paths, | 49 bool UpdateNetworkChildren(std::set<std::string>* new_service_paths, |
| 52 int* child_index, | 50 int* child_index, |
| 53 bool highlighted); | 51 bool highlighted); |
| 54 bool UpdateNetworkChild(int index, const NetworkInfo* info); | 52 bool UpdateNetworkChild(int index, const NetworkInfo* info); |
| 55 bool PlaceViewAtIndex(views::View* view, int index); | 53 bool PlaceViewAtIndex(views::View* view, int index); |
| 56 bool UpdateInfoLabel(int message_id, int index, views::Label** label); | 54 bool UpdateInfoLabel(int message_id, int index, views::Label** label); |
| 57 | 55 |
| 58 // network_icon::AnimationObserver: | 56 // network_icon::AnimationObserver: |
| 59 void NetworkIconChanged() override; | 57 void NetworkIconChanged() override; |
| 60 | 58 |
| 61 NetworkListDelegate* delegate_; | 59 NetworkListDelegate* delegate_; |
| 62 views::View* content_; | |
| 63 | 60 |
| 64 views::Label* scanning_view_; | 61 views::Label* scanning_view_; |
| 65 views::Label* no_wifi_networks_view_; | 62 views::Label* no_wifi_networks_view_; |
| 66 views::Label* no_cellular_networks_view_; | 63 views::Label* no_cellular_networks_view_; |
| 67 | 64 |
| 68 // An owned list of network info. | 65 // An owned list of network info. |
| 69 ScopedVector<NetworkInfo> network_list_; | 66 ScopedVector<NetworkInfo> network_list_; |
| 70 | 67 |
| 71 typedef std::map<views::View*, std::string> NetworkMap; | 68 typedef std::map<views::View*, std::string> NetworkMap; |
| 72 NetworkMap network_map_; | 69 NetworkMap network_map_; |
| 73 | 70 |
| 74 // A map of network service paths to their view. | 71 // A map of network service paths to their view. |
| 75 typedef std::map<std::string, views::View*> ServicePathMap; | 72 typedef std::map<std::string, views::View*> ServicePathMap; |
| 76 ServicePathMap service_path_map_; | 73 ServicePathMap service_path_map_; |
| 77 | 74 |
| 78 DISALLOW_COPY_AND_ASSIGN(NetworkListView); | 75 DISALLOW_COPY_AND_ASSIGN(NetworkListView); |
| 79 }; | 76 }; |
| 80 | 77 |
| 81 } // namespace ui | 78 } // namespace ui |
| 82 | 79 |
| 83 #endif // UI_CHROMEOS_NETWORK_NETWORK_LIST_H_ | 80 #endif // UI_CHROMEOS_NETWORK_NETWORK_LIST_H_ |
| OLD | NEW |