| 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/tray_vpn.h" | 5 #include "ash/system/network/tray_vpn.h" |
| 6 | 6 |
| 7 #include "ash/resources/vector_icons/vector_icons.h" | 7 #include "ash/resources/vector_icons/vector_icons.h" |
| 8 #include "ash/session/session_controller.h" | 8 #include "ash/session/session_controller.h" |
| 9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
| 10 #include "ash/shell_port.h" | 10 #include "ash/shell_port.h" |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 | 141 |
| 142 TrayVPN::TrayVPN(SystemTray* system_tray) | 142 TrayVPN::TrayVPN(SystemTray* system_tray) |
| 143 : SystemTrayItem(system_tray, UMA_VPN), | 143 : SystemTrayItem(system_tray, UMA_VPN), |
| 144 default_(nullptr), | 144 default_(nullptr), |
| 145 detailed_(nullptr) { | 145 detailed_(nullptr) { |
| 146 network_state_observer_.reset(new TrayNetworkStateObserver(this)); | 146 network_state_observer_.reset(new TrayNetworkStateObserver(this)); |
| 147 } | 147 } |
| 148 | 148 |
| 149 TrayVPN::~TrayVPN() {} | 149 TrayVPN::~TrayVPN() {} |
| 150 | 150 |
| 151 views::View* TrayVPN::CreateTrayView(LoginStatus status) { | |
| 152 return NULL; | |
| 153 } | |
| 154 | |
| 155 views::View* TrayVPN::CreateDefaultView(LoginStatus status) { | 151 views::View* TrayVPN::CreateDefaultView(LoginStatus status) { |
| 156 CHECK(default_ == NULL); | 152 CHECK(default_ == nullptr); |
| 157 if (!chromeos::NetworkHandler::IsInitialized()) | 153 if (!chromeos::NetworkHandler::IsInitialized()) |
| 158 return NULL; | 154 return nullptr; |
| 159 if (status == LoginStatus::NOT_LOGGED_IN) | 155 if (status == LoginStatus::NOT_LOGGED_IN) |
| 160 return NULL; | 156 return nullptr; |
| 161 if (!tray::VpnDefaultView::ShouldShow()) | 157 if (!tray::VpnDefaultView::ShouldShow()) |
| 162 return NULL; | 158 return nullptr; |
| 163 | 159 |
| 164 const bool is_in_secondary_login_screen = | 160 const bool is_in_secondary_login_screen = |
| 165 Shell::Get()->session_controller()->IsInSecondaryLoginScreen(); | 161 Shell::Get()->session_controller()->IsInSecondaryLoginScreen(); |
| 166 | 162 |
| 167 default_ = new tray::VpnDefaultView(this); | 163 default_ = new tray::VpnDefaultView(this); |
| 168 default_->SetEnabled(status != LoginStatus::LOCKED && | 164 default_->SetEnabled(status != LoginStatus::LOCKED && |
| 169 !is_in_secondary_login_screen); | 165 !is_in_secondary_login_screen); |
| 170 | 166 |
| 171 return default_; | 167 return default_; |
| 172 } | 168 } |
| 173 | 169 |
| 174 views::View* TrayVPN::CreateDetailedView(LoginStatus status) { | 170 views::View* TrayVPN::CreateDetailedView(LoginStatus status) { |
| 175 CHECK(detailed_ == NULL); | 171 CHECK(detailed_ == nullptr); |
| 176 if (!chromeos::NetworkHandler::IsInitialized()) | 172 if (!chromeos::NetworkHandler::IsInitialized()) |
| 177 return NULL; | 173 return nullptr; |
| 178 | 174 |
| 179 ShellPort::Get()->RecordUserMetricsAction(UMA_STATUS_AREA_DETAILED_VPN_VIEW); | 175 ShellPort::Get()->RecordUserMetricsAction(UMA_STATUS_AREA_DETAILED_VPN_VIEW); |
| 180 detailed_ = new tray::NetworkStateListDetailedView( | 176 detailed_ = new tray::NetworkStateListDetailedView( |
| 181 this, tray::NetworkStateListDetailedView::LIST_TYPE_VPN, status); | 177 this, tray::NetworkStateListDetailedView::LIST_TYPE_VPN, status); |
| 182 detailed_->Init(); | 178 detailed_->Init(); |
| 183 return detailed_; | 179 return detailed_; |
| 184 } | 180 } |
| 185 | 181 |
| 186 void TrayVPN::DestroyTrayView() {} | |
| 187 | |
| 188 void TrayVPN::DestroyDefaultView() { | 182 void TrayVPN::DestroyDefaultView() { |
| 189 default_ = NULL; | 183 default_ = nullptr; |
| 190 } | 184 } |
| 191 | 185 |
| 192 void TrayVPN::DestroyDetailedView() { | 186 void TrayVPN::DestroyDetailedView() { |
| 193 detailed_ = NULL; | 187 detailed_ = nullptr; |
| 194 } | 188 } |
| 195 | 189 |
| 196 void TrayVPN::UpdateAfterLoginStatusChange(LoginStatus status) {} | |
| 197 | |
| 198 void TrayVPN::UpdateAfterShelfAlignmentChange(ShelfAlignment alignment) {} | |
| 199 | |
| 200 void TrayVPN::NetworkStateChanged() { | 190 void TrayVPN::NetworkStateChanged() { |
| 201 if (default_) | 191 if (default_) |
| 202 default_->Update(); | 192 default_->Update(); |
| 203 if (detailed_) | 193 if (detailed_) |
| 204 detailed_->Update(); | 194 detailed_->Update(); |
| 205 } | 195 } |
| 206 | 196 |
| 207 } // namespace ash | 197 } // namespace ash |
| OLD | NEW |