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/chromeos/network/tray_network.h" | 5 #include "ash/system/chromeos/network/tray_network.h" |
6 | 6 |
7 #include "ash/ash_switches.h" | 7 #include "ash/ash_switches.h" |
8 #include "ash/common/wm/shelf/wm_shelf_util.h" | 8 #include "ash/common/shelf/wm_shelf_util.h" |
9 #include "ash/metrics/user_metrics_recorder.h" | 9 #include "ash/metrics/user_metrics_recorder.h" |
10 #include "ash/shelf/shelf_util.h" | 10 #include "ash/shelf/shelf_util.h" |
11 #include "ash/shell.h" | 11 #include "ash/shell.h" |
12 #include "ash/system/chromeos/network/network_state_list_detailed_view.h" | 12 #include "ash/system/chromeos/network/network_state_list_detailed_view.h" |
13 #include "ash/system/chromeos/network/tray_network_state_observer.h" | 13 #include "ash/system/chromeos/network/tray_network_state_observer.h" |
14 #include "ash/system/tray/system_tray.h" | 14 #include "ash/system/tray/system_tray.h" |
15 #include "ash/system/tray/system_tray_delegate.h" | 15 #include "ash/system/tray/system_tray_delegate.h" |
16 #include "ash/system/tray/system_tray_notifier.h" | 16 #include "ash/system/tray/system_tray_notifier.h" |
17 #include "ash/system/tray/tray_constants.h" | 17 #include "ash/system/tray/tray_constants.h" |
18 #include "ash/system/tray/tray_item_more.h" | 18 #include "ash/system/tray/tray_item_more.h" |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 const NetworkState* connected_network = | 85 const NetworkState* connected_network = |
86 handler->ConnectedNetworkByType(NetworkTypePattern::NonVirtual()); | 86 handler->ConnectedNetworkByType(NetworkTypePattern::NonVirtual()); |
87 if (connected_network) { | 87 if (connected_network) { |
88 UpdateConnectionStatus(base::UTF8ToUTF16(connected_network->name()), | 88 UpdateConnectionStatus(base::UTF8ToUTF16(connected_network->name()), |
89 true); | 89 true); |
90 } else { | 90 } else { |
91 UpdateConnectionStatus(base::string16(), false); | 91 UpdateConnectionStatus(base::string16(), false); |
92 } | 92 } |
93 } | 93 } |
94 | 94 |
95 void UpdateAlignment(wm::ShelfAlignment alignment) { | 95 void UpdateAlignment(ShelfAlignment alignment) { |
96 SetLayoutManager(new views::BoxLayout(wm::IsHorizontalAlignment(alignment) | 96 SetLayoutManager(new views::BoxLayout(IsHorizontalAlignment(alignment) |
97 ? views::BoxLayout::kHorizontal | 97 ? views::BoxLayout::kHorizontal |
98 : views::BoxLayout::kVertical, | 98 : views::BoxLayout::kVertical, |
99 0, 0, 0)); | 99 0, 0, 0)); |
100 Layout(); | 100 Layout(); |
101 } | 101 } |
102 | 102 |
103 // views::View override. | 103 // views::View override. |
104 void GetAccessibleState(ui::AXViewState* state) override { | 104 void GetAccessibleState(ui::AXViewState* state) override { |
105 state->name = connection_status_string_; | 105 state->name = connection_status_string_; |
106 state->role = ui::AX_ROLE_BUTTON; | 106 state->role = ui::AX_ROLE_BUTTON; |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 default_ = NULL; | 297 default_ = NULL; |
298 } | 298 } |
299 | 299 |
300 void TrayNetwork::DestroyDetailedView() { | 300 void TrayNetwork::DestroyDetailedView() { |
301 detailed_ = NULL; | 301 detailed_ = NULL; |
302 } | 302 } |
303 | 303 |
304 void TrayNetwork::UpdateAfterLoginStatusChange(user::LoginStatus status) { | 304 void TrayNetwork::UpdateAfterLoginStatusChange(user::LoginStatus status) { |
305 } | 305 } |
306 | 306 |
307 void TrayNetwork::UpdateAfterShelfAlignmentChange( | 307 void TrayNetwork::UpdateAfterShelfAlignmentChange(ShelfAlignment alignment) { |
308 wm::ShelfAlignment alignment) { | |
309 if (tray_) { | 308 if (tray_) { |
310 SetTrayImageItemBorder(tray_, alignment); | 309 SetTrayImageItemBorder(tray_, alignment); |
311 tray_->UpdateAlignment(alignment); | 310 tray_->UpdateAlignment(alignment); |
312 } | 311 } |
313 } | 312 } |
314 | 313 |
315 void TrayNetwork::RequestToggleWifi() { | 314 void TrayNetwork::RequestToggleWifi() { |
316 // This will always be triggered by a user action (e.g. keyboard shortcut) | 315 // This will always be triggered by a user action (e.g. keyboard shortcut) |
317 if (!detailed_ || | 316 if (!detailed_ || |
318 detailed_->GetViewType() == tray::NetworkDetailedView::WIFI_VIEW) { | 317 detailed_->GetViewType() == tray::NetworkDetailedView::WIFI_VIEW) { |
(...skipping 17 matching lines...) Expand all Loading... |
336 void TrayNetwork::NetworkStateChanged() { | 335 void TrayNetwork::NetworkStateChanged() { |
337 if (tray_) | 336 if (tray_) |
338 tray_->UpdateNetworkStateHandlerIcon(); | 337 tray_->UpdateNetworkStateHandlerIcon(); |
339 if (default_) | 338 if (default_) |
340 default_->Update(); | 339 default_->Update(); |
341 if (detailed_) | 340 if (detailed_) |
342 detailed_->Update(); | 341 detailed_->Update(); |
343 } | 342 } |
344 | 343 |
345 } // namespace ash | 344 } // namespace ash |
OLD | NEW |