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/common/session/session_state_delegate.h" | 7 #include "ash/common/session/session_state_delegate.h" |
8 #include "ash/metrics/user_metrics_recorder.h" | 8 #include "ash/metrics/user_metrics_recorder.h" |
9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
10 #include "ash/system/chromeos/network/network_state_list_detailed_view.h" | 10 #include "ash/system/chromeos/network/network_state_list_detailed_view.h" |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 } // namespace tray | 113 } // namespace tray |
114 | 114 |
115 TrayVPN::TrayVPN(SystemTray* system_tray) | 115 TrayVPN::TrayVPN(SystemTray* system_tray) |
116 : SystemTrayItem(system_tray), default_(NULL), detailed_(NULL) { | 116 : SystemTrayItem(system_tray), default_(NULL), detailed_(NULL) { |
117 network_state_observer_.reset(new TrayNetworkStateObserver(this)); | 117 network_state_observer_.reset(new TrayNetworkStateObserver(this)); |
118 } | 118 } |
119 | 119 |
120 TrayVPN::~TrayVPN() { | 120 TrayVPN::~TrayVPN() { |
121 } | 121 } |
122 | 122 |
123 views::View* TrayVPN::CreateTrayView(user::LoginStatus status) { | 123 views::View* TrayVPN::CreateTrayView(LoginStatus status) { |
124 return NULL; | 124 return NULL; |
125 } | 125 } |
126 | 126 |
127 views::View* TrayVPN::CreateDefaultView(user::LoginStatus status) { | 127 views::View* TrayVPN::CreateDefaultView(LoginStatus status) { |
128 CHECK(default_ == NULL); | 128 CHECK(default_ == NULL); |
129 if (!chromeos::NetworkHandler::IsInitialized()) | 129 if (!chromeos::NetworkHandler::IsInitialized()) |
130 return NULL; | 130 return NULL; |
131 if (status == user::LOGGED_IN_NONE) | 131 if (status == LoginStatus::NOT_LOGGED_IN) |
132 return NULL; | 132 return NULL; |
133 if (!tray::VpnDefaultView::ShouldShow()) | 133 if (!tray::VpnDefaultView::ShouldShow()) |
134 return NULL; | 134 return NULL; |
135 | 135 |
136 bool userAddingRunning = ash::Shell::GetInstance() | 136 bool userAddingRunning = ash::Shell::GetInstance() |
137 ->session_state_delegate() | 137 ->session_state_delegate() |
138 ->IsInSecondaryLoginScreen(); | 138 ->IsInSecondaryLoginScreen(); |
139 | 139 |
140 default_ = new tray::VpnDefaultView( | 140 default_ = new tray::VpnDefaultView( |
141 this, status != user::LOGGED_IN_LOCKED && !userAddingRunning); | 141 this, status != LoginStatus::LOCKED && !userAddingRunning); |
142 | 142 |
143 return default_; | 143 return default_; |
144 } | 144 } |
145 | 145 |
146 views::View* TrayVPN::CreateDetailedView(user::LoginStatus status) { | 146 views::View* TrayVPN::CreateDetailedView(LoginStatus status) { |
147 CHECK(detailed_ == NULL); | 147 CHECK(detailed_ == NULL); |
148 if (!chromeos::NetworkHandler::IsInitialized()) | 148 if (!chromeos::NetworkHandler::IsInitialized()) |
149 return NULL; | 149 return NULL; |
150 | 150 |
151 Shell::GetInstance()->metrics()->RecordUserMetricsAction( | 151 Shell::GetInstance()->metrics()->RecordUserMetricsAction( |
152 ash::UMA_STATUS_AREA_DETAILED_VPN_VIEW); | 152 ash::UMA_STATUS_AREA_DETAILED_VPN_VIEW); |
153 detailed_ = new tray::NetworkStateListDetailedView( | 153 detailed_ = new tray::NetworkStateListDetailedView( |
154 this, tray::NetworkStateListDetailedView::LIST_TYPE_VPN, status); | 154 this, tray::NetworkStateListDetailedView::LIST_TYPE_VPN, status); |
155 detailed_->Init(); | 155 detailed_->Init(); |
156 return detailed_; | 156 return detailed_; |
157 } | 157 } |
158 | 158 |
159 void TrayVPN::DestroyTrayView() { | 159 void TrayVPN::DestroyTrayView() { |
160 } | 160 } |
161 | 161 |
162 void TrayVPN::DestroyDefaultView() { | 162 void TrayVPN::DestroyDefaultView() { |
163 default_ = NULL; | 163 default_ = NULL; |
164 } | 164 } |
165 | 165 |
166 void TrayVPN::DestroyDetailedView() { | 166 void TrayVPN::DestroyDetailedView() { |
167 detailed_ = NULL; | 167 detailed_ = NULL; |
168 } | 168 } |
169 | 169 |
170 void TrayVPN::UpdateAfterLoginStatusChange(user::LoginStatus status) { | 170 void TrayVPN::UpdateAfterLoginStatusChange(LoginStatus status) {} |
171 } | |
172 | 171 |
173 void TrayVPN::UpdateAfterShelfAlignmentChange(ShelfAlignment alignment) {} | 172 void TrayVPN::UpdateAfterShelfAlignmentChange(ShelfAlignment alignment) {} |
174 | 173 |
175 void TrayVPN::NetworkStateChanged() { | 174 void TrayVPN::NetworkStateChanged() { |
176 if (default_) | 175 if (default_) |
177 default_->Update(); | 176 default_->Update(); |
178 if (detailed_) | 177 if (detailed_) |
179 detailed_->Update(); | 178 detailed_->Update(); |
180 } | 179 } |
181 | 180 |
182 } // namespace ash | 181 } // namespace ash |
OLD | NEW |