| 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_vpn.h" | 5 #include "ash/system/chromeos/network/tray_vpn.h" |
| 6 | 6 |
| 7 #include "ash/metrics/user_metrics_recorder.h" | 7 #include "ash/metrics/user_metrics_recorder.h" |
| 8 #include "ash/session/session_state_delegate.h" |
| 8 #include "ash/shell.h" | 9 #include "ash/shell.h" |
| 9 #include "ash/system/chromeos/network/network_state_list_detailed_view.h" | 10 #include "ash/system/chromeos/network/network_state_list_detailed_view.h" |
| 10 #include "ash/system/tray/system_tray.h" | 11 #include "ash/system/tray/system_tray.h" |
| 11 #include "ash/system/tray/system_tray_delegate.h" | 12 #include "ash/system/tray/system_tray_delegate.h" |
| 12 #include "ash/system/tray/tray_constants.h" | 13 #include "ash/system/tray/tray_constants.h" |
| 13 #include "ash/system/tray/tray_item_more.h" | 14 #include "ash/system/tray/tray_item_more.h" |
| 14 #include "ash/system/tray/tray_popup_label_button.h" | 15 #include "ash/system/tray/tray_popup_label_button.h" |
| 15 #include "chromeos/network/network_state.h" | 16 #include "chromeos/network/network_state.h" |
| 16 #include "chromeos/network/network_state_handler.h" | 17 #include "chromeos/network/network_state_handler.h" |
| 17 #include "grit/ash_strings.h" | 18 #include "grit/ash_strings.h" |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 | 118 |
| 118 views::View* TrayVPN::CreateDefaultView(user::LoginStatus status) { | 119 views::View* TrayVPN::CreateDefaultView(user::LoginStatus status) { |
| 119 CHECK(default_ == NULL); | 120 CHECK(default_ == NULL); |
| 120 if (!chromeos::NetworkHandler::IsInitialized()) | 121 if (!chromeos::NetworkHandler::IsInitialized()) |
| 121 return NULL; | 122 return NULL; |
| 122 if (status == user::LOGGED_IN_NONE) | 123 if (status == user::LOGGED_IN_NONE) |
| 123 return NULL; | 124 return NULL; |
| 124 if (!tray::VpnDefaultView::ShouldShow()) | 125 if (!tray::VpnDefaultView::ShouldShow()) |
| 125 return NULL; | 126 return NULL; |
| 126 | 127 |
| 127 default_ = new tray::VpnDefaultView(this, status != user::LOGGED_IN_LOCKED); | 128 default_ = new tray::VpnDefaultView( |
| 129 this, |
| 130 status != user::LOGGED_IN_LOCKED && |
| 131 ash::Shell::GetInstance() |
| 132 ->session_state_delegate() |
| 133 ->GetSessionState() != |
| 134 ash::SessionStateDelegate::SESSION_STATE_LOGIN_SECONDARY); |
| 135 |
| 128 return default_; | 136 return default_; |
| 129 } | 137 } |
| 130 | 138 |
| 131 views::View* TrayVPN::CreateDetailedView(user::LoginStatus status) { | 139 views::View* TrayVPN::CreateDetailedView(user::LoginStatus status) { |
| 132 CHECK(detailed_ == NULL); | 140 CHECK(detailed_ == NULL); |
| 133 if (!chromeos::NetworkHandler::IsInitialized()) | 141 if (!chromeos::NetworkHandler::IsInitialized()) |
| 134 return NULL; | 142 return NULL; |
| 135 | 143 |
| 136 Shell::GetInstance()->metrics()->RecordUserMetricsAction( | 144 Shell::GetInstance()->metrics()->RecordUserMetricsAction( |
| 137 ash::UMA_STATUS_AREA_DETAILED_VPN_VIEW); | 145 ash::UMA_STATUS_AREA_DETAILED_VPN_VIEW); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 168 detailed_->ManagerChanged(); | 176 detailed_->ManagerChanged(); |
| 169 } | 177 } |
| 170 } | 178 } |
| 171 | 179 |
| 172 void TrayVPN::NetworkServiceChanged(const chromeos::NetworkState* network) { | 180 void TrayVPN::NetworkServiceChanged(const chromeos::NetworkState* network) { |
| 173 if (detailed_) | 181 if (detailed_) |
| 174 detailed_->NetworkServiceChanged(network); | 182 detailed_->NetworkServiceChanged(network); |
| 175 } | 183 } |
| 176 | 184 |
| 177 } // namespace ash | 185 } // namespace ash |
| OLD | NEW |