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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 SchedulePaint(); | 67 SchedulePaint(); |
68 } | 68 } |
69 } | 69 } |
70 | 70 |
71 // Overridden from views::View. | 71 // Overridden from views::View. |
72 virtual gfx::Size GetPreferredSize() OVERRIDE { | 72 virtual gfx::Size GetPreferredSize() OVERRIDE { |
73 return gfx::Size(image_size_.width() + GetInsets().width(), | 73 return gfx::Size(image_size_.width() + GetInsets().width(), |
74 image_size_.height() + GetInsets().height()); | 74 image_size_.height() + GetInsets().height()); |
75 } | 75 } |
76 | 76 |
77 virtual void VisibilityChanged(views::View* starting_from, | |
78 bool is_visible) OVERRIDE { | |
79 if (starting_from == this && GetWidget()) | |
80 GetWidget()->SetSize(GetWidget()->GetContentsView()->GetPreferredSize()); | |
81 } | |
82 | |
83 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE { | 77 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE { |
84 View::OnPaint(canvas); | 78 View::OnPaint(canvas); |
85 gfx::Rect image_bounds(GetPreferredSize()); | 79 gfx::Rect image_bounds(GetPreferredSize()); |
86 image_bounds = gfx::Rect(size()).Center(image_bounds.size()); | 80 image_bounds = gfx::Rect(size()).Center(image_bounds.size()); |
87 image_bounds.Inset(GetInsets()); | 81 image_bounds.Inset(GetInsets()); |
88 const SkScalar kRadius = SkIntToScalar(corner_radius_); | 82 const SkScalar kRadius = SkIntToScalar(corner_radius_); |
89 SkPath path; | 83 SkPath path; |
90 path.addRoundRect(gfx::RectToSkRect(image_bounds), kRadius, kRadius); | 84 path.addRoundRect(gfx::RectToSkRect(image_bounds), kRadius, kRadius); |
91 | 85 |
92 SkPaint paint; | 86 SkPaint paint; |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 } | 306 } |
313 | 307 |
314 void TrayUser::OnUserUpdate() { | 308 void TrayUser::OnUserUpdate() { |
315 avatar_->SetImage( | 309 avatar_->SetImage( |
316 ash::Shell::GetInstance()->tray_delegate()->GetUserImage(), | 310 ash::Shell::GetInstance()->tray_delegate()->GetUserImage(), |
317 gfx::Size(kUserIconSize, kUserIconSize)); | 311 gfx::Size(kUserIconSize, kUserIconSize)); |
318 } | 312 } |
319 | 313 |
320 } // namespace internal | 314 } // namespace internal |
321 } // namespace ash | 315 } // namespace ash |
OLD | NEW |