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

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

Issue 2721553004: Remove auto raw pointer deduction from non-linux specific code. (Closed)
Patch Set: rebase 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/update/tray_update.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 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 285
286 } // namespace 286 } // namespace
287 287
288 UserCardView::UserCardView(LoginStatus login_status, 288 UserCardView::UserCardView(LoginStatus login_status,
289 int max_width, 289 int max_width,
290 int user_index) 290 int user_index)
291 : user_index_(user_index), 291 : user_index_(user_index),
292 user_name_(nullptr), 292 user_name_(nullptr),
293 media_capture_label_(nullptr), 293 media_capture_label_(nullptr),
294 media_capture_icon_(nullptr) { 294 media_capture_icon_(nullptr) {
295 auto layout = new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, 295 auto* layout = new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0,
296 kTrayPopupLabelHorizontalPadding); 296 kTrayPopupLabelHorizontalPadding);
297 SetLayoutManager(layout); 297 SetLayoutManager(layout);
298 layout->set_minimum_cross_axis_size(kTrayPopupItemMinHeight); 298 layout->set_minimum_cross_axis_size(kTrayPopupItemMinHeight);
299 layout->set_cross_axis_alignment( 299 layout->set_cross_axis_alignment(
300 views::BoxLayout::CROSS_AXIS_ALIGNMENT_CENTER); 300 views::BoxLayout::CROSS_AXIS_ALIGNMENT_CENTER);
301 // For active users, the left inset is provided by ActiveUserBorder, which 301 // For active users, the left inset is provided by ActiveUserBorder, which
302 // 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.
303 // 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
304 // extend all the way to the edges of the menu. 304 // extend all the way to the edges of the menu.
305 if (!is_active_user()) 305 if (!is_active_user())
306 SetBorder(views::CreateEmptyBorder(0, kMenuExtraMarginFromLeftEdge, 0, 0)); 306 SetBorder(views::CreateEmptyBorder(0, kMenuExtraMarginFromLeftEdge, 0, 0));
(...skipping 20 matching lines...) Expand all
327 } 327 }
328 328
329 void UserCardView::GetAccessibleNodeData(ui::AXNodeData* node_data) { 329 void UserCardView::GetAccessibleNodeData(ui::AXNodeData* node_data) {
330 node_data->role = ui::AX_ROLE_STATIC_TEXT; 330 node_data->role = ui::AX_ROLE_STATIC_TEXT;
331 std::vector<base::string16> labels; 331 std::vector<base::string16> labels;
332 332
333 // Construct the name by concatenating descendants' names. 333 // Construct the name by concatenating descendants' names.
334 std::list<views::View*> descendants; 334 std::list<views::View*> descendants;
335 descendants.push_back(this); 335 descendants.push_back(this);
336 while (!descendants.empty()) { 336 while (!descendants.empty()) {
337 auto view = descendants.front(); 337 auto* view = descendants.front();
338 descendants.pop_front(); 338 descendants.pop_front();
339 if (view != this) { 339 if (view != this) {
340 ui::AXNodeData descendant_data; 340 ui::AXNodeData descendant_data;
341 view->GetAccessibleNodeData(&descendant_data); 341 view->GetAccessibleNodeData(&descendant_data);
342 base::string16 label = 342 base::string16 label =
343 descendant_data.GetString16Attribute(ui::AX_ATTR_NAME); 343 descendant_data.GetString16Attribute(ui::AX_ATTR_NAME);
344 // If we find a non-empty name, use that and don't descend further into 344 // If we find a non-empty name, use that and don't descend further into
345 // the tree. 345 // the tree.
346 if (!label.empty()) { 346 if (!label.empty()) {
347 labels.push_back(label); 347 labels.push_back(label);
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 user_name_->SetHorizontalAlignment(gfx::ALIGN_LEFT); 404 user_name_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
405 TrayPopupItemStyle user_name_style( 405 TrayPopupItemStyle user_name_style(
406 TrayPopupItemStyle::FontStyle::DEFAULT_VIEW_LABEL); 406 TrayPopupItemStyle::FontStyle::DEFAULT_VIEW_LABEL);
407 user_name_style.SetupLabel(user_name_); 407 user_name_style.SetupLabel(user_name_);
408 408
409 TrayPopupItemStyle user_email_style(TrayPopupItemStyle::FontStyle::CAPTION); 409 TrayPopupItemStyle user_email_style(TrayPopupItemStyle::FontStyle::CAPTION);
410 // Only the active user's email label is lightened (for the inactive user, the 410 // Only the active user's email label is lightened (for the inactive user, the
411 // label starts as black and the entire row is 54% opacity). 411 // label starts as black and the entire row is 54% opacity).
412 if (is_active_user()) 412 if (is_active_user())
413 user_email_style.set_color_style(TrayPopupItemStyle::ColorStyle::INACTIVE); 413 user_email_style.set_color_style(TrayPopupItemStyle::ColorStyle::INACTIVE);
414 auto user_email = new views::Label(); 414 auto* user_email = new views::Label();
415 base::string16 user_email_string; 415 base::string16 user_email_string;
416 if (login_status != LoginStatus::GUEST) { 416 if (login_status != LoginStatus::GUEST) {
417 user_email_string = 417 user_email_string =
418 WmShell::Get()->system_tray_delegate()->IsUserSupervised() 418 WmShell::Get()->system_tray_delegate()->IsUserSupervised()
419 ? l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_SUPERVISED_LABEL) 419 ? l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_SUPERVISED_LABEL)
420 : base::UTF8ToUTF16( 420 : base::UTF8ToUTF16(
421 delegate->GetUserInfo(user_index_)->GetDisplayEmail()); 421 delegate->GetUserInfo(user_index_)->GetDisplayEmail());
422 } 422 }
423 user_email->SetText(user_email_string); 423 user_email->SetText(user_email_string);
424 user_email->SetHorizontalAlignment(gfx::ALIGN_LEFT); 424 user_email->SetHorizontalAlignment(gfx::ALIGN_LEFT);
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 461
462 media_capture_icon_->set_id(VIEW_ID_USER_VIEW_MEDIA_INDICATOR); 462 media_capture_icon_->set_id(VIEW_ID_USER_VIEW_MEDIA_INDICATOR);
463 AddChildView(media_capture_icon_); 463 AddChildView(media_capture_icon_);
464 464
465 WmShell::Get()->media_controller()->RequestCaptureState(); 465 WmShell::Get()->media_controller()->RequestCaptureState();
466 } 466 }
467 } 467 }
468 468
469 } // namespace tray 469 } // namespace tray
470 } // namespace ash 470 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/system/update/tray_update.cc ('k') | ash/common/system/user/user_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698