Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(206)

Side by Side Diff: ash/common/system/user/tray_user.cc

Issue 2639203007: Update SetPaintToLayer to accept LayerType (Closed)
Patch Set: Refactor Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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" 7 #include "ash/common/material_design/material_design_controller.h"
8 #include "ash/common/session/session_state_delegate.h" 8 #include "ash/common/session/session_state_delegate.h"
9 #include "ash/common/shelf/wm_shelf_util.h" 9 #include "ash/common/shelf/wm_shelf_util.h"
10 #include "ash/common/system/tray/system_tray.h" 10 #include "ash/common/system/tray/system_tray.h"
11 #include "ash/common/system/tray/system_tray_delegate.h" 11 #include "ash/common/system/tray/system_tray_delegate.h"
12 #include "ash/common/system/tray/system_tray_notifier.h" 12 #include "ash/common/system/tray/system_tray_notifier.h"
13 #include "ash/common/system/tray/tray_constants.h" 13 #include "ash/common/system/tray/tray_constants.h"
14 #include "ash/common/system/tray/tray_item_view.h" 14 #include "ash/common/system/tray/tray_item_view.h"
15 #include "ash/common/system/tray/tray_utils.h" 15 #include "ash/common/system/tray/tray_utils.h"
16 #include "ash/common/system/user/rounded_image_view.h" 16 #include "ash/common/system/user/rounded_image_view.h"
17 #include "ash/common/system/user/user_view.h" 17 #include "ash/common/system/user/user_view.h"
18 #include "ash/common/wm_shell.h" 18 #include "ash/common/wm_shell.h"
19 #include "base/logging.h" 19 #include "base/logging.h"
20 #include "base/strings/string16.h" 20 #include "base/strings/string16.h"
21 #include "components/signin/core/account_id/account_id.h" 21 #include "components/signin/core/account_id/account_id.h"
22 #include "components/user_manager/user_info.h" 22 #include "components/user_manager/user_info.h"
23 #include "grit/ash_strings.h" 23 #include "grit/ash_strings.h"
24 #include "ui/base/l10n/l10n_util.h" 24 #include "ui/base/l10n/l10n_util.h"
25 #include "ui/compositor/layer_type.h"
25 #include "ui/gfx/image/image.h" 26 #include "ui/gfx/image/image.h"
26 #include "ui/views/border.h" 27 #include "ui/views/border.h"
27 #include "ui/views/controls/label.h" 28 #include "ui/views/controls/label.h"
28 #include "ui/views/layout/box_layout.h" 29 #include "ui/views/layout/box_layout.h"
29 #include "ui/views/view.h" 30 #include "ui/views/view.h"
30 #include "ui/views/widget/widget.h" 31 #include "ui/views/widget/widget.h"
31 32
32 namespace { 33 namespace {
33 34
34 const int kUserLabelToIconPadding = 5; 35 const int kUserLabelToIconPadding = 5;
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 if (need_label) { 152 if (need_label) {
152 label_ = new views::Label; 153 label_ = new views::Label;
153 SetupLabelForTray(label_); 154 SetupLabelForTray(label_);
154 layout_view_->AddChildView(label_); 155 layout_view_->AddChildView(label_);
155 } else { 156 } else {
156 label_ = nullptr; 157 label_ = nullptr;
157 } 158 }
158 if (need_avatar) { 159 if (need_avatar) {
159 avatar_ = new tray::RoundedImageView(kTrayRoundedBorderRadius, true); 160 avatar_ = new tray::RoundedImageView(kTrayRoundedBorderRadius, true);
160 if (MaterialDesignController::IsShelfMaterial()) { 161 if (MaterialDesignController::IsShelfMaterial()) {
161 avatar_->SetPaintToLayer(true); 162 avatar_->SetPaintToLayer(ui::LAYER_TEXTURED);
162 avatar_->layer()->SetFillsBoundsOpaquely(false); 163 avatar_->layer()->SetFillsBoundsOpaquely(false);
163 } 164 }
164 layout_view_->AddChildView(avatar_); 165 layout_view_->AddChildView(avatar_);
165 } else { 166 } else {
166 avatar_ = nullptr; 167 avatar_ = nullptr;
167 } 168 }
168 } 169 }
169 170
170 if (delegate->IsUserSupervised()) { 171 if (delegate->IsUserSupervised()) {
171 label_->SetText( 172 label_->SetText(
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 // Unit tests might come here with no images for some users. 257 // Unit tests might come here with no images for some users.
257 if (avatar_->size().IsEmpty()) 258 if (avatar_->size().IsEmpty())
258 avatar_->SetSize(gfx::Size(kTrayItemSize, kTrayItemSize)); 259 avatar_->SetSize(gfx::Size(kTrayItemSize, kTrayItemSize));
259 } 260 }
260 261
261 void TrayUser::UpdateLayoutOfItem() { 262 void TrayUser::UpdateLayoutOfItem() {
262 UpdateAfterShelfAlignmentChange(system_tray()->shelf_alignment()); 263 UpdateAfterShelfAlignmentChange(system_tray()->shelf_alignment());
263 } 264 }
264 265
265 } // namespace ash 266 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698