OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 ASH_SYSTEM_NETWORK_NETWORK_STATE_LIST_DETAILED_VIEW_H_ | 5 #ifndef ASH_SYSTEM_NETWORK_NETWORK_STATE_LIST_DETAILED_VIEW_H_ |
6 #define ASH_SYSTEM_NETWORK_NETWORK_STATE_LIST_DETAILED_VIEW_H_ | 6 #define ASH_SYSTEM_NETWORK_NETWORK_STATE_LIST_DETAILED_VIEW_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "ash/login_status.h" | 11 #include "ash/login_status.h" |
12 #include "ash/system/network/network_list_delegate.h" | |
13 #include "ash/system/tray/tray_details_view.h" | 12 #include "ash/system/tray/tray_details_view.h" |
14 #include "base/macros.h" | 13 #include "base/macros.h" |
15 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
16 #include "ui/gfx/image/image.h" | 15 #include "ui/gfx/image/image.h" |
17 #include "ui/views/controls/button/button.h" | 16 #include "ui/views/controls/button/button.h" |
18 #include "ui/views/controls/button/custom_button.h" | 17 #include "ui/views/controls/button/custom_button.h" |
19 | 18 |
20 namespace chromeos { | |
21 class NetworkTypePattern; | |
22 } | |
23 | |
24 namespace ash { | 19 namespace ash { |
25 class NetworkListViewBase; | 20 class NetworkListViewBase; |
26 } | 21 } |
27 | 22 |
28 namespace views { | 23 namespace views { |
29 class BubbleDialogDelegateView; | 24 class BubbleDialogDelegateView; |
30 } | 25 } |
31 | 26 |
32 namespace ash { | 27 namespace ash { |
33 class SystemTrayItem; | 28 class SystemTrayItem; |
34 | 29 |
35 namespace tray { | 30 namespace tray { |
36 | 31 |
37 class NetworkStateListDetailedView | 32 class NetworkStateListDetailedView |
38 : public TrayDetailsView, | 33 : public TrayDetailsView, |
39 public NetworkListDelegate, | |
40 public base::SupportsWeakPtr<NetworkStateListDetailedView> { | 34 public base::SupportsWeakPtr<NetworkStateListDetailedView> { |
41 public: | 35 public: |
42 enum ListType { LIST_TYPE_NETWORK, LIST_TYPE_VPN }; | 36 enum ListType { LIST_TYPE_NETWORK, LIST_TYPE_VPN }; |
43 | 37 |
44 NetworkStateListDetailedView(SystemTrayItem* owner, | 38 NetworkStateListDetailedView(SystemTrayItem* owner, |
45 ListType list_type, | 39 ListType list_type, |
46 LoginStatus login); | 40 LoginStatus login); |
47 ~NetworkStateListDetailedView() override; | 41 ~NetworkStateListDetailedView() override; |
48 | 42 |
49 void Init(); | 43 void Init(); |
50 | 44 |
51 // Called when the contents of the network list have changed or when any | 45 // Called when the contents of the network list have changed or when any |
52 // Manager properties (e.g. technology state) have changed. | 46 // Manager properties (e.g. technology state) have changed. |
53 void Update(); | 47 void Update(); |
54 | 48 |
| 49 // Called when the user clicks on an entry representing a network in the list. |
| 50 void OnNetworkEntryClicked(views::View* sender); |
| 51 |
| 52 void RelayoutScrollList(); |
| 53 |
55 private: | 54 private: |
56 class InfoBubble; | 55 class InfoBubble; |
57 | 56 |
58 // TrayDetailsView: | 57 // TrayDetailsView: |
59 void HandleViewClicked(views::View* view) override; | 58 void HandleViewClicked(views::View* view) override; |
60 void HandleButtonPressed(views::Button* sender, | 59 void HandleButtonPressed(views::Button* sender, |
61 const ui::Event& event) override; | 60 const ui::Event& event) override; |
62 void CreateExtraTitleRowButtons() override; | 61 void CreateExtraTitleRowButtons() override; |
63 | 62 |
64 // Launches the WebUI settings in a browser and closes the system menu. | 63 // Launches the WebUI settings in a browser and closes the system menu. |
65 void ShowSettings(); | 64 void ShowSettings(); |
66 | 65 |
67 // Update UI components. | 66 // Update UI components. |
68 void UpdateNetworkList(); | 67 void UpdateNetworkList(); |
69 void UpdateHeaderButtons(); | 68 void UpdateHeaderButtons(); |
70 | 69 |
71 // Create and manage the network info bubble. | 70 // Create and manage the network info bubble. |
72 void ToggleInfoBubble(); | 71 void ToggleInfoBubble(); |
73 bool ResetInfoBubble(); | 72 bool ResetInfoBubble(); |
74 void OnInfoBubbleDestroyed(); | 73 void OnInfoBubbleDestroyed(); |
75 views::View* CreateNetworkInfoView(); | 74 views::View* CreateNetworkInfoView(); |
76 | 75 |
77 // Creates the view of an extra icon appearing next to the network name | |
78 // indicating that the network is controlled by an extension. If no extension | |
79 // is registered for this network, returns |nullptr|. | |
80 views::View* CreateControlledByExtensionView(const NetworkInfo& info); | |
81 | |
82 // Periodically request a network scan. | 76 // Periodically request a network scan. |
83 void CallRequestScan(); | 77 void CallRequestScan(); |
84 | 78 |
85 // NetworkListDelegate: | |
86 views::View* CreateViewForNetwork(const NetworkInfo& info) override; | |
87 chromeos::NetworkTypePattern GetNetworkTypePattern() const override; | |
88 void UpdateViewForNetwork(views::View* view, | |
89 const NetworkInfo& info) override; | |
90 views::Label* CreateInfoLabel() override; | |
91 void OnNetworkEntryClicked(views::View* sender) override; | |
92 void OnOtherWifiClicked() override; | |
93 void RelayoutScrollList() override; | |
94 | |
95 // Type of list (all networks or vpn) | 79 // Type of list (all networks or vpn) |
96 ListType list_type_; | 80 ListType list_type_; |
97 | 81 |
98 // Track login state. | 82 // Track login state. |
99 LoginStatus login_; | 83 LoginStatus login_; |
100 | 84 |
101 views::CustomButton* info_button_; | 85 views::CustomButton* info_button_; |
102 views::CustomButton* settings_button_; | 86 views::CustomButton* settings_button_; |
103 views::CustomButton* proxy_settings_button_; | 87 views::CustomButton* proxy_settings_button_; |
104 | 88 |
105 // A small bubble for displaying network info. | 89 // A small bubble for displaying network info. |
106 views::BubbleDialogDelegateView* info_bubble_; | 90 views::BubbleDialogDelegateView* info_bubble_; |
107 | 91 |
108 std::unique_ptr<NetworkListViewBase> network_list_view_; | 92 std::unique_ptr<NetworkListViewBase> network_list_view_; |
109 | 93 |
110 DISALLOW_COPY_AND_ASSIGN(NetworkStateListDetailedView); | 94 DISALLOW_COPY_AND_ASSIGN(NetworkStateListDetailedView); |
111 }; | 95 }; |
112 | 96 |
113 } // namespace tray | 97 } // namespace tray |
114 } // namespace ash | 98 } // namespace ash |
115 | 99 |
116 #endif // ASH_SYSTEM_NETWORK_NETWORK_STATE_LIST_DETAILED_VIEW_H_ | 100 #endif // ASH_SYSTEM_NETWORK_NETWORK_STATE_LIST_DETAILED_VIEW_H_ |
OLD | NEW |