| 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/user/tray_user.h" | 5 #include "ash/system/user/tray_user.h" |
| 6 | 6 |
| 7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
| 8 #include "ash/system/tray/system_tray_delegate.h" | 8 #include "ash/system/tray/system_tray_delegate.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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 virtual ~RoundedImageView() { | 52 virtual ~RoundedImageView() { |
| 53 } | 53 } |
| 54 | 54 |
| 55 // Set the image that should be displayed from a pointer. The pointer | 55 // Set the image that should be displayed from a pointer. The pointer |
| 56 // contents is copied in the receiver's image. | 56 // contents is copied in the receiver's image. |
| 57 void SetImage(const gfx::ImageSkia& img, const gfx::Size& size) { | 57 void SetImage(const gfx::ImageSkia& img, const gfx::Size& size) { |
| 58 image_ = img; | 58 image_ = img; |
| 59 image_size_ = size; | 59 image_size_ = size; |
| 60 | 60 |
| 61 // Try to get the best image quality for the avatar. | 61 // Try to get the best image quality for the avatar. |
| 62 resized_ = gfx::ImageSkiaOperations::CreateResizedImage(image_, size); | 62 resized_ = gfx::ImageSkiaOperations::CreateResizedImage(image_, |
| 63 skia::ImageOperations::RESIZE_BEST, size); |
| 63 if (GetWidget() && visible()) { | 64 if (GetWidget() && visible()) { |
| 64 PreferredSizeChanged(); | 65 PreferredSizeChanged(); |
| 65 SchedulePaint(); | 66 SchedulePaint(); |
| 66 } | 67 } |
| 67 } | 68 } |
| 68 | 69 |
| 69 // Overridden from views::View. | 70 // Overridden from views::View. |
| 70 virtual gfx::Size GetPreferredSize() OVERRIDE { | 71 virtual gfx::Size GetPreferredSize() OVERRIDE { |
| 71 return gfx::Size(image_size_.width() + GetInsets().width(), | 72 return gfx::Size(image_size_.width() + GetInsets().width(), |
| 72 image_size_.height() + GetInsets().height()); | 73 image_size_.height() + GetInsets().height()); |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 } | 301 } |
| 301 | 302 |
| 302 void TrayUser::OnUserUpdate() { | 303 void TrayUser::OnUserUpdate() { |
| 303 avatar_->SetImage( | 304 avatar_->SetImage( |
| 304 ash::Shell::GetInstance()->tray_delegate()->GetUserImage(), | 305 ash::Shell::GetInstance()->tray_delegate()->GetUserImage(), |
| 305 gfx::Size(kUserIconSize, kUserIconSize)); | 306 gfx::Size(kUserIconSize, kUserIconSize)); |
| 306 } | 307 } |
| 307 | 308 |
| 308 } // namespace internal | 309 } // namespace internal |
| 309 } // namespace ash | 310 } // namespace ash |
| OLD | NEW |