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 #include "ash/system/network/network_state_list_detailed_view.h" | 5 #include "ash/system/network/network_state_list_detailed_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "ash/ash_constants.h" | 10 #include "ash/ash_constants.h" |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 DISALLOW_COPY_AND_ASSIGN(InfoThrobberLayout); | 218 DISALLOW_COPY_AND_ASSIGN(InfoThrobberLayout); |
219 }; | 219 }; |
220 | 220 |
221 //------------------------------------------------------------------------------ | 221 //------------------------------------------------------------------------------ |
222 // NetworkStateListDetailedView | 222 // NetworkStateListDetailedView |
223 | 223 |
224 NetworkStateListDetailedView::NetworkStateListDetailedView( | 224 NetworkStateListDetailedView::NetworkStateListDetailedView( |
225 SystemTrayItem* owner, | 225 SystemTrayItem* owner, |
226 ListType list_type, | 226 ListType list_type, |
227 LoginStatus login) | 227 LoginStatus login) |
228 : NetworkDetailedView(owner), | 228 : TrayDetailsView(owner), |
229 list_type_(list_type), | 229 list_type_(list_type), |
230 login_(login), | 230 login_(login), |
231 info_button_(nullptr), | 231 info_button_(nullptr), |
232 settings_button_(nullptr), | 232 settings_button_(nullptr), |
233 proxy_settings_button_(nullptr), | 233 proxy_settings_button_(nullptr), |
234 info_bubble_(nullptr) { | 234 info_bubble_(nullptr) { |
235 if (list_type == LIST_TYPE_VPN) { | 235 if (list_type == LIST_TYPE_VPN) { |
236 // Use a specialized class to list VPNs. | 236 // Use a specialized class to list VPNs. |
237 network_list_view_.reset(new VPNListView(this)); | 237 network_list_view_.reset(new VPNListView(this)); |
238 } else { | 238 } else { |
239 // Use a common class to list any other network types. | 239 // Use a common class to list any other network types. |
240 network_list_view_.reset(new NetworkListView(this)); | 240 network_list_view_.reset(new NetworkListView(this)); |
241 } | 241 } |
242 } | 242 } |
243 | 243 |
244 NetworkStateListDetailedView::~NetworkStateListDetailedView() { | 244 NetworkStateListDetailedView::~NetworkStateListDetailedView() { |
245 ResetInfoBubble(); | 245 ResetInfoBubble(); |
246 } | 246 } |
247 | 247 |
248 void NetworkStateListDetailedView::Update() { | 248 void NetworkStateListDetailedView::Update() { |
249 UpdateNetworkList(); | 249 UpdateNetworkList(); |
250 UpdateHeaderButtons(); | 250 UpdateHeaderButtons(); |
251 Layout(); | 251 Layout(); |
252 } | 252 } |
253 | 253 |
254 // Overridden from NetworkDetailedView: | |
255 | |
256 void NetworkStateListDetailedView::Init() { | 254 void NetworkStateListDetailedView::Init() { |
257 Reset(); | 255 Reset(); |
258 info_button_ = nullptr; | 256 info_button_ = nullptr; |
259 settings_button_ = nullptr; | 257 settings_button_ = nullptr; |
260 proxy_settings_button_ = nullptr; | 258 proxy_settings_button_ = nullptr; |
261 | 259 |
262 CreateScrollableList(); | 260 CreateScrollableList(); |
263 CreateTitleRow(list_type_ == ListType::LIST_TYPE_NETWORK | 261 CreateTitleRow(list_type_ == ListType::LIST_TYPE_NETWORK |
264 ? IDS_ASH_STATUS_TRAY_NETWORK | 262 ? IDS_ASH_STATUS_TRAY_NETWORK |
265 : IDS_ASH_STATUS_TRAY_VPN); | 263 : IDS_ASH_STATUS_TRAY_VPN); |
266 | 264 |
267 network_list_view_->set_container(scroll_content()); | 265 network_list_view_->set_container(scroll_content()); |
268 Update(); | 266 Update(); |
269 | 267 |
270 if (list_type_ != LIST_TYPE_VPN) | 268 if (list_type_ != LIST_TYPE_VPN) |
271 CallRequestScan(); | 269 CallRequestScan(); |
272 } | 270 } |
273 | 271 |
274 NetworkDetailedView::DetailedViewType | |
275 NetworkStateListDetailedView::GetViewType() const { | |
276 return STATE_LIST_VIEW; | |
277 } | |
278 | |
279 void NetworkStateListDetailedView::HandleButtonPressed(views::Button* sender, | 272 void NetworkStateListDetailedView::HandleButtonPressed(views::Button* sender, |
280 const ui::Event& event) { | 273 const ui::Event& event) { |
281 if (sender == info_button_) { | 274 if (sender == info_button_) { |
282 ToggleInfoBubble(); | 275 ToggleInfoBubble(); |
283 return; | 276 return; |
284 } | 277 } |
285 | 278 |
286 if (sender == settings_button_) | 279 if (sender == settings_button_) |
287 ShowSettings(); | 280 ShowSettings(); |
288 else if (sender == proxy_settings_button_) | 281 else if (sender == proxy_settings_button_) |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
545 UMA_STATUS_AREA_NETWORK_JOIN_OTHER_CLICKED); | 538 UMA_STATUS_AREA_NETWORK_JOIN_OTHER_CLICKED); |
546 Shell::Get()->system_tray_controller()->ShowNetworkCreate(shill::kTypeWifi); | 539 Shell::Get()->system_tray_controller()->ShowNetworkCreate(shill::kTypeWifi); |
547 } | 540 } |
548 | 541 |
549 void NetworkStateListDetailedView::RelayoutScrollList() { | 542 void NetworkStateListDetailedView::RelayoutScrollList() { |
550 scroller()->Layout(); | 543 scroller()->Layout(); |
551 } | 544 } |
552 | 545 |
553 } // namespace tray | 546 } // namespace tray |
554 } // namespace ash | 547 } // namespace ash |
OLD | NEW |