| 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_network.h" | 5 #include "ash/system/network/tray_network.h" |
| 6 | 6 |
| 7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
| 8 #include "ash/shell_window_ids.h" | 8 #include "ash/shell_window_ids.h" |
| 9 #include "ash/system/tray/system_tray.h" | 9 #include "ash/system/tray/system_tray.h" |
| 10 #include "ash/system/tray/system_tray_delegate.h" | 10 #include "ash/system/tray/system_tray_delegate.h" |
| (...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 506 TrayPopupTextButton* settings_; | 506 TrayPopupTextButton* settings_; |
| 507 TrayPopupTextButton* proxy_settings_; | 507 TrayPopupTextButton* proxy_settings_; |
| 508 | 508 |
| 509 views::BubbleDelegateView* info_bubble_; | 509 views::BubbleDelegateView* info_bubble_; |
| 510 | 510 |
| 511 DISALLOW_COPY_AND_ASSIGN(NetworkDetailedView); | 511 DISALLOW_COPY_AND_ASSIGN(NetworkDetailedView); |
| 512 }; | 512 }; |
| 513 | 513 |
| 514 } // namespace tray | 514 } // namespace tray |
| 515 | 515 |
| 516 TrayNetwork::TrayNetwork() { | 516 TrayNetwork::TrayNetwork() |
| 517 : tray_(NULL), |
| 518 default_(NULL), |
| 519 detailed_(NULL) { |
| 517 } | 520 } |
| 518 | 521 |
| 519 TrayNetwork::~TrayNetwork() { | 522 TrayNetwork::~TrayNetwork() { |
| 520 } | 523 } |
| 521 | 524 |
| 522 views::View* TrayNetwork::CreateTrayView(user::LoginStatus status) { | 525 views::View* TrayNetwork::CreateTrayView(user::LoginStatus status) { |
| 523 tray_.reset(new tray::NetworkTrayView(tray::LIGHT, true /*tray_icon*/)); | 526 DCHECK(tray_ == NULL); |
| 524 return tray_.get(); | 527 tray_ = new tray::NetworkTrayView(tray::LIGHT, true /*tray_icon*/); |
| 528 return tray_; |
| 525 } | 529 } |
| 526 | 530 |
| 527 views::View* TrayNetwork::CreateDefaultView(user::LoginStatus status) { | 531 views::View* TrayNetwork::CreateDefaultView(user::LoginStatus status) { |
| 528 default_.reset(new tray::NetworkDefaultView(this)); | 532 DCHECK(default_ == NULL); |
| 529 return default_.get(); | 533 default_ = new tray::NetworkDefaultView(this); |
| 534 return default_; |
| 530 } | 535 } |
| 531 | 536 |
| 532 views::View* TrayNetwork::CreateDetailedView(user::LoginStatus status) { | 537 views::View* TrayNetwork::CreateDetailedView(user::LoginStatus status) { |
| 533 detailed_.reset(new tray::NetworkDetailedView(status)); | 538 DCHECK(detailed_ == NULL); |
| 534 return detailed_.get(); | 539 detailed_ = new tray::NetworkDetailedView(status); |
| 540 return detailed_; |
| 535 } | 541 } |
| 536 | 542 |
| 537 void TrayNetwork::DestroyTrayView() { | 543 void TrayNetwork::DestroyTrayView() { |
| 538 tray_.reset(); | 544 tray_ = NULL; |
| 539 } | 545 } |
| 540 | 546 |
| 541 void TrayNetwork::DestroyDefaultView() { | 547 void TrayNetwork::DestroyDefaultView() { |
| 542 default_.reset(); | 548 default_ = NULL; |
| 543 } | 549 } |
| 544 | 550 |
| 545 void TrayNetwork::DestroyDetailedView() { | 551 void TrayNetwork::DestroyDetailedView() { |
| 546 detailed_.reset(); | 552 detailed_ = NULL; |
| 547 } | 553 } |
| 548 | 554 |
| 549 void TrayNetwork::UpdateAfterLoginStatusChange(user::LoginStatus status) { | 555 void TrayNetwork::UpdateAfterLoginStatusChange(user::LoginStatus status) { |
| 550 } | 556 } |
| 551 | 557 |
| 552 void TrayNetwork::OnNetworkRefresh(const NetworkIconInfo& info) { | 558 void TrayNetwork::OnNetworkRefresh(const NetworkIconInfo& info) { |
| 553 if (tray_.get()) | 559 if (tray_) |
| 554 tray_->Update(info); | 560 tray_->Update(info); |
| 555 if (default_.get()) | 561 if (default_) |
| 556 default_->Update(); | 562 default_->Update(); |
| 557 if (detailed_.get()) | 563 if (detailed_) |
| 558 detailed_->Update(); | 564 detailed_->Update(); |
| 559 } | 565 } |
| 560 | 566 |
| 561 } // namespace internal | 567 } // namespace internal |
| 562 } // namespace ash | 568 } // namespace ash |
| OLD | NEW |