Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1060)

Side by Side Diff: ash/system/chromeos/network/tray_network.cc

Issue 2041233005: Moves ash::user::LoginStatus to ash/common (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix test Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ash/system/chromeos/network/tray_network.h ('k') | ash/system/chromeos/network/tray_sms.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/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"
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 notifier->AddNetworkObserver(this); 247 notifier->AddNetworkObserver(this);
248 notifier->AddNetworkPortalDetectorObserver(this); 248 notifier->AddNetworkPortalDetectorObserver(this);
249 } 249 }
250 250
251 TrayNetwork::~TrayNetwork() { 251 TrayNetwork::~TrayNetwork() {
252 SystemTrayNotifier* notifier = Shell::GetInstance()->system_tray_notifier(); 252 SystemTrayNotifier* notifier = Shell::GetInstance()->system_tray_notifier();
253 notifier->RemoveNetworkObserver(this); 253 notifier->RemoveNetworkObserver(this);
254 notifier->RemoveNetworkPortalDetectorObserver(this); 254 notifier->RemoveNetworkPortalDetectorObserver(this);
255 } 255 }
256 256
257 views::View* TrayNetwork::CreateTrayView(user::LoginStatus status) { 257 views::View* TrayNetwork::CreateTrayView(LoginStatus status) {
258 CHECK(tray_ == NULL); 258 CHECK(tray_ == NULL);
259 if (!chromeos::NetworkHandler::IsInitialized()) 259 if (!chromeos::NetworkHandler::IsInitialized())
260 return NULL; 260 return NULL;
261 tray_ = new tray::NetworkTrayView(this); 261 tray_ = new tray::NetworkTrayView(this);
262 return tray_; 262 return tray_;
263 } 263 }
264 264
265 views::View* TrayNetwork::CreateDefaultView(user::LoginStatus status) { 265 views::View* TrayNetwork::CreateDefaultView(LoginStatus status) {
266 CHECK(default_ == NULL); 266 CHECK(default_ == NULL);
267 if (!chromeos::NetworkHandler::IsInitialized()) 267 if (!chromeos::NetworkHandler::IsInitialized())
268 return NULL; 268 return NULL;
269 CHECK(tray_ != NULL); 269 CHECK(tray_ != NULL);
270 default_ = 270 default_ = new tray::NetworkDefaultView(this, status != LoginStatus::LOCKED);
271 new tray::NetworkDefaultView(this, status != user::LOGGED_IN_LOCKED);
272 return default_; 271 return default_;
273 } 272 }
274 273
275 views::View* TrayNetwork::CreateDetailedView(user::LoginStatus status) { 274 views::View* TrayNetwork::CreateDetailedView(LoginStatus status) {
276 CHECK(detailed_ == NULL); 275 CHECK(detailed_ == NULL);
277 Shell::GetInstance()->metrics()->RecordUserMetricsAction( 276 Shell::GetInstance()->metrics()->RecordUserMetricsAction(
278 ash::UMA_STATUS_AREA_DETAILED_NETWORK_VIEW); 277 ash::UMA_STATUS_AREA_DETAILED_NETWORK_VIEW);
279 if (!chromeos::NetworkHandler::IsInitialized()) 278 if (!chromeos::NetworkHandler::IsInitialized())
280 return NULL; 279 return NULL;
281 if (request_wifi_view_) { 280 if (request_wifi_view_) {
282 detailed_ = new tray::NetworkWifiDetailedView(this); 281 detailed_ = new tray::NetworkWifiDetailedView(this);
283 request_wifi_view_ = false; 282 request_wifi_view_ = false;
284 } else { 283 } else {
285 detailed_ = new tray::NetworkStateListDetailedView( 284 detailed_ = new tray::NetworkStateListDetailedView(
286 this, tray::NetworkStateListDetailedView::LIST_TYPE_NETWORK, status); 285 this, tray::NetworkStateListDetailedView::LIST_TYPE_NETWORK, status);
287 detailed_->Init(); 286 detailed_->Init();
288 } 287 }
289 return detailed_; 288 return detailed_;
290 } 289 }
291 290
292 void TrayNetwork::DestroyTrayView() { 291 void TrayNetwork::DestroyTrayView() {
293 tray_ = NULL; 292 tray_ = NULL;
294 } 293 }
295 294
296 void TrayNetwork::DestroyDefaultView() { 295 void TrayNetwork::DestroyDefaultView() {
297 default_ = NULL; 296 default_ = NULL;
298 } 297 }
299 298
300 void TrayNetwork::DestroyDetailedView() { 299 void TrayNetwork::DestroyDetailedView() {
301 detailed_ = NULL; 300 detailed_ = NULL;
302 } 301 }
303 302
304 void TrayNetwork::UpdateAfterLoginStatusChange(user::LoginStatus status) { 303 void TrayNetwork::UpdateAfterLoginStatusChange(LoginStatus status) {}
305 }
306 304
307 void TrayNetwork::UpdateAfterShelfAlignmentChange(ShelfAlignment alignment) { 305 void TrayNetwork::UpdateAfterShelfAlignmentChange(ShelfAlignment alignment) {
308 if (tray_) { 306 if (tray_) {
309 SetTrayImageItemBorder(tray_, alignment); 307 SetTrayImageItemBorder(tray_, alignment);
310 tray_->UpdateAlignment(alignment); 308 tray_->UpdateAlignment(alignment);
311 } 309 }
312 } 310 }
313 311
314 void TrayNetwork::RequestToggleWifi() { 312 void TrayNetwork::RequestToggleWifi() {
315 // This will always be triggered by a user action (e.g. keyboard shortcut) 313 // This will always be triggered by a user action (e.g. keyboard shortcut)
(...skipping 19 matching lines...) Expand all
335 void TrayNetwork::NetworkStateChanged() { 333 void TrayNetwork::NetworkStateChanged() {
336 if (tray_) 334 if (tray_)
337 tray_->UpdateNetworkStateHandlerIcon(); 335 tray_->UpdateNetworkStateHandlerIcon();
338 if (default_) 336 if (default_)
339 default_->Update(); 337 default_->Update();
340 if (detailed_) 338 if (detailed_)
341 detailed_->Update(); 339 detailed_->Update();
342 } 340 }
343 341
344 } // namespace ash 342 } // namespace ash
OLDNEW
« no previous file with comments | « ash/system/chromeos/network/tray_network.h ('k') | ash/system/chromeos/network/tray_sms.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698