OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef ASH_COMMON_SYSTEM_CHROMEOS_NETWORK_NETWORK_STATE_LIST_DETAILED_VIEW_H_ | |
6 #define ASH_COMMON_SYSTEM_CHROMEOS_NETWORK_NETWORK_STATE_LIST_DETAILED_VIEW_H_ | |
7 | |
8 #include <memory> | |
9 #include <string> | |
10 | |
11 #include "ash/common/login_status.h" | |
12 #include "ash/common/system/chromeos/network/network_detailed_view.h" | |
13 #include "ash/common/system/chromeos/network/network_list_delegate.h" | |
14 #include "base/macros.h" | |
15 #include "base/memory/weak_ptr.h" | |
16 #include "ui/gfx/image/image.h" | |
17 #include "ui/views/controls/button/button.h" | |
18 #include "ui/views/controls/button/custom_button.h" | |
19 | |
20 namespace chromeos { | |
21 class NetworkTypePattern; | |
22 } | |
23 | |
24 namespace ash { | |
25 class NetworkListViewBase; | |
26 } | |
27 | |
28 namespace views { | |
29 class BubbleDialogDelegateView; | |
30 class ImageButton; | |
31 } | |
32 | |
33 namespace ash { | |
34 class SystemTrayItem; | |
35 class ThrobberView; | |
36 class TrayPopupHeaderButton; | |
37 | |
38 namespace tray { | |
39 | |
40 class NetworkStateListDetailedView | |
41 : public NetworkDetailedView, | |
42 public NetworkListDelegate, | |
43 public base::SupportsWeakPtr<NetworkStateListDetailedView> { | |
44 public: | |
45 enum ListType { LIST_TYPE_NETWORK, LIST_TYPE_VPN }; | |
46 | |
47 NetworkStateListDetailedView(SystemTrayItem* owner, | |
48 ListType list_type, | |
49 LoginStatus login); | |
50 ~NetworkStateListDetailedView() override; | |
51 | |
52 // Overridden from NetworkDetailedView: | |
53 void Init() override; | |
54 DetailedViewType GetViewType() const override; | |
55 void Update() override; | |
56 | |
57 private: | |
58 class InfoBubble; | |
59 | |
60 // TrayDetailsView: | |
61 void HandleViewClicked(views::View* view) override; | |
62 void HandleButtonPressed(views::Button* sender, | |
63 const ui::Event& event) override; | |
64 void CreateExtraTitleRowButtons() override; | |
65 | |
66 // Launches the WebUI settings in a browser and closes the system menu. | |
67 void ShowSettings(); | |
68 | |
69 // Create UI components. | |
70 void CreateHeaderEntry(); | |
71 void CreateNetworkExtra(); | |
72 | |
73 // Update UI components. | |
74 void UpdateTechnologyButton(TrayPopupHeaderButton* button, | |
75 const chromeos::NetworkTypePattern& technology); | |
76 void UpdateNetworkList(); | |
77 void UpdateHeaderButtons(); | |
78 | |
79 bool OrderChild(views::View* view, int index); | |
80 | |
81 // Adds a settings entry when logged in, and an entry for changing proxy | |
82 // settings otherwise. | |
83 void CreateSettingsEntry(); | |
84 | |
85 // Sets the visibility and focusability of Network Info Button and | |
86 // WiFi scanning indicator. This will hide Network info button and display | |
87 // the scanning indicator when |is_scanning| is true. | |
88 void SetScanningStateForThrobberView(bool is_scanning); | |
89 | |
90 // Create and manage the network info bubble. | |
91 void ToggleInfoBubble(); | |
92 bool ResetInfoBubble(); | |
93 void OnInfoBubbleDestroyed(); | |
94 views::View* CreateNetworkInfoView(); | |
95 const gfx::ImageSkia* GetControlledByExtensionIcon(); | |
96 | |
97 // Creates the view of an extra icon appearing next to the network name | |
98 // indicating that the network is controlled by an extension. If no extension | |
99 // is registered for this network, returns |nullptr|. | |
100 views::View* CreateControlledByExtensionView(const NetworkInfo& info); | |
101 | |
102 // Periodically request a network scan. | |
103 void CallRequestScan(); | |
104 | |
105 // Handle toggile mobile action | |
106 void ToggleMobile(); | |
107 | |
108 // NetworkListDelegate: | |
109 views::View* CreateViewForNetwork(const NetworkInfo& info) override; | |
110 bool IsViewHovered(views::View* view) override; | |
111 chromeos::NetworkTypePattern GetNetworkTypePattern() const override; | |
112 void UpdateViewForNetwork(views::View* view, | |
113 const NetworkInfo& info) override; | |
114 views::Label* CreateInfoLabel() override; | |
115 void OnNetworkEntryClicked(views::View* sender) override; | |
116 void OnOtherWifiClicked() override; | |
117 void RelayoutScrollList() override; | |
118 | |
119 // Type of list (all networks or vpn) | |
120 ListType list_type_; | |
121 | |
122 // Track login state. | |
123 LoginStatus login_; | |
124 | |
125 // Tracks the WiFi scanning state to help detect if the state has changed. Use | |
126 // NetworkHandler::GetScanningByType() if you require the current wifi | |
127 // scanning state. | |
128 bool prev_wifi_scanning_state_; | |
129 | |
130 // Not used for material design. | |
131 views::ImageButton* info_icon_; | |
132 | |
133 // Only used in material design. | |
134 views::CustomButton* info_button_md_; | |
135 views::CustomButton* settings_button_md_; | |
136 views::CustomButton* proxy_settings_button_md_; | |
137 | |
138 // A small bubble for displaying network info. | |
139 views::BubbleDialogDelegateView* info_bubble_; | |
140 | |
141 // WiFi scanning throbber. | |
142 ThrobberView* scanning_throbber_; | |
143 | |
144 gfx::Image controlled_by_extension_icon_; | |
145 | |
146 std::unique_ptr<NetworkListViewBase> network_list_view_; | |
147 | |
148 DISALLOW_COPY_AND_ASSIGN(NetworkStateListDetailedView); | |
149 }; | |
150 | |
151 } // namespace tray | |
152 } // namespace ash | |
153 | |
154 #endif // ASH_COMMON_SYSTEM_CHROMEOS_NETWORK_NETWORK_STATE_LIST_DETAILED_VIEW_H
_ | |
OLD | NEW |