| 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/tray/tray_image_item.h" | 5 #include "ash/system/tray/tray_image_item.h" |
| 6 | 6 |
| 7 #include "ash/resources/vector_icons/vector_icons.h" | 7 #include "ash/resources/vector_icons/vector_icons.h" |
| 8 #include "ash/system/tray/system_tray.h" | 8 #include "ash/system/tray/system_tray.h" |
| 9 #include "ash/system/tray/tray_constants.h" | 9 #include "ash/system/tray/tray_constants.h" |
| 10 #include "ash/system/tray/tray_item_view.h" | 10 #include "ash/system/tray/tray_item_view.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 TrayImageItem::~TrayImageItem() {} | 27 TrayImageItem::~TrayImageItem() {} |
| 28 | 28 |
| 29 views::View* TrayImageItem::tray_view() { | 29 views::View* TrayImageItem::tray_view() { |
| 30 return tray_view_; | 30 return tray_view_; |
| 31 } | 31 } |
| 32 | 32 |
| 33 views::View* TrayImageItem::CreateTrayView(LoginStatus status) { | 33 views::View* TrayImageItem::CreateTrayView(LoginStatus status) { |
| 34 CHECK(!tray_view_); | 34 CHECK(!tray_view_); |
| 35 tray_view_ = new TrayItemView(this); | 35 tray_view_ = new TrayItemView(this); |
| 36 tray_view_->CreateImageView(); | 36 tray_view_->CreateImageView(); |
| 37 UpdateImageOnImageView(); | 37 SetImageIcon(icon_); |
| 38 tray_view_->SetVisible(GetInitialVisibility()); | 38 tray_view_->SetVisible(GetInitialVisibility()); |
| 39 return tray_view_; | 39 return tray_view_; |
| 40 } | 40 } |
| 41 | 41 |
| 42 void TrayImageItem::DestroyTrayView() { | 42 void TrayImageItem::DestroyTrayView() { |
| 43 tray_view_ = nullptr; | 43 tray_view_ = nullptr; |
| 44 } | 44 } |
| 45 | 45 |
| 46 void TrayImageItem::SetIconColor(SkColor color) { | 46 void TrayImageItem::SetIconColor(SkColor color) { |
| 47 icon_color_ = color; | 47 icon_color_ = color; |
| 48 UpdateImageOnImageView(); | 48 SetImageIcon(icon_); |
| 49 } | 49 } |
| 50 | 50 |
| 51 void TrayImageItem::UpdateImageOnImageView() { | 51 void TrayImageItem::SetImageIcon(const gfx::VectorIcon& icon) { |
| 52 if (!tray_view_) | 52 if (!tray_view_) |
| 53 return; | 53 return; |
| 54 | 54 |
| 55 tray_view_->image_view()->SetImage( | 55 tray_view_->image_view()->SetImage( |
| 56 gfx::CreateVectorIcon(icon_, kTrayIconSize, icon_color_)); | 56 gfx::CreateVectorIcon(icon, kTrayIconSize, icon_color_)); |
| 57 } | 57 } |
| 58 | 58 |
| 59 } // namespace ash | 59 } // namespace ash |
| OLD | NEW |