| 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/common/system/user/tray_user.h" | 5 #include "ash/common/system/user/tray_user.h" |
| 6 | 6 |
| 7 #include "ash/common/material_design/material_design_controller.h" | |
| 8 #include "ash/common/session/session_state_delegate.h" | 7 #include "ash/common/session/session_state_delegate.h" |
| 9 #include "ash/common/shelf/wm_shelf_util.h" | 8 #include "ash/common/shelf/wm_shelf_util.h" |
| 10 #include "ash/common/system/tray/system_tray.h" | 9 #include "ash/common/system/tray/system_tray.h" |
| 11 #include "ash/common/system/tray/system_tray_delegate.h" | 10 #include "ash/common/system/tray/system_tray_delegate.h" |
| 12 #include "ash/common/system/tray/system_tray_notifier.h" | 11 #include "ash/common/system/tray/system_tray_notifier.h" |
| 13 #include "ash/common/system/tray/tray_constants.h" | 12 #include "ash/common/system/tray/tray_constants.h" |
| 14 #include "ash/common/system/tray/tray_item_view.h" | 13 #include "ash/common/system/tray/tray_item_view.h" |
| 15 #include "ash/common/system/tray/tray_utils.h" | 14 #include "ash/common/system/tray/tray_utils.h" |
| 16 #include "ash/common/system/user/rounded_image_view.h" | 15 #include "ash/common/system/user/rounded_image_view.h" |
| 17 #include "ash/common/system/user/user_view.h" | 16 #include "ash/common/system/user/user_view.h" |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 delete avatar_; | 148 delete avatar_; |
| 150 | 149 |
| 151 if (need_label) { | 150 if (need_label) { |
| 152 label_ = new views::Label; | 151 label_ = new views::Label; |
| 153 SetupLabelForTray(label_); | 152 SetupLabelForTray(label_); |
| 154 layout_view_->AddChildView(label_); | 153 layout_view_->AddChildView(label_); |
| 155 } else { | 154 } else { |
| 156 label_ = nullptr; | 155 label_ = nullptr; |
| 157 } | 156 } |
| 158 if (need_avatar) { | 157 if (need_avatar) { |
| 159 avatar_ = new tray::RoundedImageView(kTrayRoundedBorderRadius, true); | 158 avatar_ = new tray::RoundedImageView(kTrayRoundedBorderRadius); |
| 160 if (MaterialDesignController::IsShelfMaterial()) { | 159 avatar_->SetPaintToLayer(); |
| 161 avatar_->SetPaintToLayer(); | 160 avatar_->layer()->SetFillsBoundsOpaquely(false); |
| 162 avatar_->layer()->SetFillsBoundsOpaquely(false); | |
| 163 } | |
| 164 layout_view_->AddChildView(avatar_); | 161 layout_view_->AddChildView(avatar_); |
| 165 } else { | 162 } else { |
| 166 avatar_ = nullptr; | 163 avatar_ = nullptr; |
| 167 } | 164 } |
| 168 } | 165 } |
| 169 | 166 |
| 170 if (delegate->IsUserSupervised()) { | 167 if (delegate->IsUserSupervised()) { |
| 171 label_->SetText( | 168 label_->SetText( |
| 172 l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_SUPERVISED_LABEL)); | 169 l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_SUPERVISED_LABEL)); |
| 173 } else if (status == LoginStatus::GUEST) { | 170 } else if (status == LoginStatus::GUEST) { |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 // Unit tests might come here with no images for some users. | 253 // Unit tests might come here with no images for some users. |
| 257 if (avatar_->size().IsEmpty()) | 254 if (avatar_->size().IsEmpty()) |
| 258 avatar_->SetSize(gfx::Size(kTrayItemSize, kTrayItemSize)); | 255 avatar_->SetSize(gfx::Size(kTrayItemSize, kTrayItemSize)); |
| 259 } | 256 } |
| 260 | 257 |
| 261 void TrayUser::UpdateLayoutOfItem() { | 258 void TrayUser::UpdateLayoutOfItem() { |
| 262 UpdateAfterShelfAlignmentChange(system_tray()->shelf_alignment()); | 259 UpdateAfterShelfAlignmentChange(system_tray()->shelf_alignment()); |
| 263 } | 260 } |
| 264 | 261 |
| 265 } // namespace ash | 262 } // namespace ash |
| OLD | NEW |