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

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

Issue 2709903004: Consolidate some more ash tray constants. (Closed)
Patch Set: rebase/review Created 3 years, 9 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
« no previous file with comments | « ash/common/system/tray/tray_utils.cc ('k') | ash/common/system/user/user_view.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/user_card_view.h" 5 #include "ash/common/system/user/user_card_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <memory> 8 #include <memory>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 if (login_status == LoginStatus::GUEST) { 61 if (login_status == LoginStatus::GUEST) {
62 gfx::ImageSkia icon = 62 gfx::ImageSkia icon =
63 gfx::CreateVectorIcon(kSystemMenuGuestIcon, kMenuIconColor); 63 gfx::CreateVectorIcon(kSystemMenuGuestIcon, kMenuIconColor);
64 image_view->SetImage(icon, icon.size()); 64 image_view->SetImage(icon, icon.size());
65 } else { 65 } else {
66 SessionStateDelegate* delegate = WmShell::Get()->GetSessionStateDelegate(); 66 SessionStateDelegate* delegate = WmShell::Get()->GetSessionStateDelegate();
67 image_view->SetImage(delegate->GetUserInfo(user_index)->GetImage(), 67 image_view->SetImage(delegate->GetUserInfo(user_index)->GetImage(),
68 gfx::Size(kTrayItemSize, kTrayItemSize)); 68 gfx::Size(kTrayItemSize, kTrayItemSize));
69 } 69 }
70 70
71 image_view->SetBorder(views::CreateEmptyBorder( 71 image_view->SetBorder(views::CreateEmptyBorder(gfx::Insets(
72 gfx::Insets((GetTrayConstant(TRAY_POPUP_ITEM_MAIN_IMAGE_CONTAINER_WIDTH) - 72 (kTrayPopupItemMinStartWidth - image_view->GetPreferredSize().width()) /
73 image_view->GetPreferredSize().width()) / 73 2)));
74 2)));
75 return image_view; 74 return image_view;
76 } 75 }
77 76
78 // The user details shown in public account mode. This is essentially a label 77 // The user details shown in public account mode. This is essentially a label
79 // but with custom painting code as the text is styled with multiple colors and 78 // but with custom painting code as the text is styled with multiple colors and
80 // contains a link. 79 // contains a link.
81 class PublicAccountUserDetails : public views::View, 80 class PublicAccountUserDetails : public views::View,
82 public views::LinkListener { 81 public views::LinkListener {
83 public: 82 public:
84 PublicAccountUserDetails(int max_width); 83 PublicAccountUserDetails(int max_width);
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 UserCardView::UserCardView(LoginStatus login_status, 288 UserCardView::UserCardView(LoginStatus login_status,
290 int max_width, 289 int max_width,
291 int user_index) 290 int user_index)
292 : user_index_(user_index), 291 : user_index_(user_index),
293 user_name_(nullptr), 292 user_name_(nullptr),
294 media_capture_label_(nullptr), 293 media_capture_label_(nullptr),
295 media_capture_icon_(nullptr) { 294 media_capture_icon_(nullptr) {
296 auto layout = new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, 295 auto layout = new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0,
297 kTrayPopupLabelHorizontalPadding); 296 kTrayPopupLabelHorizontalPadding);
298 SetLayoutManager(layout); 297 SetLayoutManager(layout);
299 layout->set_minimum_cross_axis_size( 298 layout->set_minimum_cross_axis_size(kTrayPopupItemMinHeight);
300 GetTrayConstant(TRAY_POPUP_ITEM_MIN_HEIGHT));
301 layout->set_cross_axis_alignment( 299 layout->set_cross_axis_alignment(
302 views::BoxLayout::CROSS_AXIS_ALIGNMENT_CENTER); 300 views::BoxLayout::CROSS_AXIS_ALIGNMENT_CENTER);
303 // For active users, the left inset is provided by ActiveUserBorder, which 301 // For active users, the left inset is provided by ActiveUserBorder, which
304 // is necessary to make sure the ripple does not cover that part of the row. 302 // is necessary to make sure the ripple does not cover that part of the row.
305 // For inactive users, we set the inset here and this causes the ripple to 303 // For inactive users, we set the inset here and this causes the ripple to
306 // extend all the way to the edges of the menu. 304 // extend all the way to the edges of the menu.
307 if (!is_active_user()) 305 if (!is_active_user())
308 SetBorder(views::CreateEmptyBorder(0, kMenuExtraMarginFromLeftEdge, 0, 0)); 306 SetBorder(views::CreateEmptyBorder(0, kMenuExtraMarginFromLeftEdge, 0, 0));
309 307
310 WmShell::Get()->media_controller()->AddObserver(this); 308 WmShell::Get()->media_controller()->AddObserver(this);
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 media_capture_label_ = new views::Label(); 446 media_capture_label_ = new views::Label();
449 media_capture_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); 447 media_capture_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
450 media_capture_label_->SetBorder( 448 media_capture_label_->SetBorder(
451 views::CreateEmptyBorder(0, 0, user_email_bottom_pad, 0)); 449 views::CreateEmptyBorder(0, 0, user_email_bottom_pad, 0));
452 user_email_style.SetupLabel(media_capture_label_); 450 user_email_style.SetupLabel(media_capture_label_);
453 stack_of_labels->AddChildView(media_capture_label_); 451 stack_of_labels->AddChildView(media_capture_label_);
454 452
455 media_capture_icon_ = new views::ImageView; 453 media_capture_icon_ = new views::ImageView;
456 media_capture_icon_->SetImage( 454 media_capture_icon_->SetImage(
457 gfx::CreateVectorIcon(kSystemTrayRecordingIcon, gfx::kGoogleRed700)); 455 gfx::CreateVectorIcon(kSystemTrayRecordingIcon, gfx::kGoogleRed700));
458 const int media_capture_width = 456 const int media_capture_width = kTrayPopupItemMinEndWidth;
459 GetTrayConstant(TRAY_POPUP_ITEM_MIN_END_WIDTH);
460 media_capture_icon_->SetBorder(views::CreateEmptyBorder( 457 media_capture_icon_->SetBorder(views::CreateEmptyBorder(
461 gfx::Insets(0, (media_capture_width - 458 gfx::Insets(0, (media_capture_width -
462 media_capture_icon_->GetPreferredSize().width()) / 459 media_capture_icon_->GetPreferredSize().width()) /
463 2))); 460 2)));
464 461
465 media_capture_icon_->set_id(VIEW_ID_USER_VIEW_MEDIA_INDICATOR); 462 media_capture_icon_->set_id(VIEW_ID_USER_VIEW_MEDIA_INDICATOR);
466 AddChildView(media_capture_icon_); 463 AddChildView(media_capture_icon_);
467 464
468 WmShell::Get()->media_controller()->RequestCaptureState(); 465 WmShell::Get()->media_controller()->RequestCaptureState();
469 } 466 }
470 } 467 }
471 468
472 } // namespace tray 469 } // namespace tray
473 } // namespace ash 470 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/system/tray/tray_utils.cc ('k') | ash/common/system/user/user_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698