| OLD | NEW |
| 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 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 layout->set_minimum_cross_axis_size(kTrayPopupItemMinHeight); | 299 layout->set_minimum_cross_axis_size(kTrayPopupItemMinHeight); |
| 300 layout->set_cross_axis_alignment( | 300 layout->set_cross_axis_alignment( |
| 301 views::BoxLayout::CROSS_AXIS_ALIGNMENT_CENTER); | 301 views::BoxLayout::CROSS_AXIS_ALIGNMENT_CENTER); |
| 302 // For active users, the left inset is provided by ActiveUserBorder, which | 302 // For active users, the left inset is provided by ActiveUserBorder, which |
| 303 // is necessary to make sure the ripple does not cover that part of the row. | 303 // is necessary to make sure the ripple does not cover that part of the row. |
| 304 // For inactive users, we set the inset here and this causes the ripple to | 304 // For inactive users, we set the inset here and this causes the ripple to |
| 305 // extend all the way to the edges of the menu. | 305 // extend all the way to the edges of the menu. |
| 306 if (!is_active_user()) | 306 if (!is_active_user()) |
| 307 SetBorder(views::CreateEmptyBorder(0, kMenuExtraMarginFromLeftEdge, 0, 0)); | 307 SetBorder(views::CreateEmptyBorder(0, kMenuExtraMarginFromLeftEdge, 0, 0)); |
| 308 | 308 |
| 309 WmShell::Get()->media_controller()->AddObserver(this); | 309 Shell::Get()->media_controller()->AddObserver(this); |
| 310 | 310 |
| 311 if (login_status == LoginStatus::PUBLIC) | 311 if (login_status == LoginStatus::PUBLIC) |
| 312 AddPublicModeUserContent(max_width); | 312 AddPublicModeUserContent(max_width); |
| 313 else | 313 else |
| 314 AddUserContent(layout, login_status); | 314 AddUserContent(layout, login_status); |
| 315 } | 315 } |
| 316 | 316 |
| 317 UserCardView::~UserCardView() { | 317 UserCardView::~UserCardView() { |
| 318 WmShell::Get()->media_controller()->RemoveObserver(this); | 318 Shell::Get()->media_controller()->RemoveObserver(this); |
| 319 } | 319 } |
| 320 | 320 |
| 321 void UserCardView::PaintChildren(const ui::PaintContext& context) { | 321 void UserCardView::PaintChildren(const ui::PaintContext& context) { |
| 322 if (!is_active_user()) { | 322 if (!is_active_user()) { |
| 323 ui::CompositingRecorder alpha(context, 0xFF / 2, true); | 323 ui::CompositingRecorder alpha(context, 0xFF / 2, true); |
| 324 View::PaintChildren(context); | 324 View::PaintChildren(context); |
| 325 } else { | 325 } else { |
| 326 View::PaintChildren(context); | 326 View::PaintChildren(context); |
| 327 } | 327 } |
| 328 } | 328 } |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 457 gfx::CreateVectorIcon(kSystemTrayRecordingIcon, gfx::kGoogleRed700)); | 457 gfx::CreateVectorIcon(kSystemTrayRecordingIcon, gfx::kGoogleRed700)); |
| 458 const int media_capture_width = kTrayPopupItemMinEndWidth; | 458 const int media_capture_width = kTrayPopupItemMinEndWidth; |
| 459 media_capture_icon_->SetBorder(views::CreateEmptyBorder( | 459 media_capture_icon_->SetBorder(views::CreateEmptyBorder( |
| 460 gfx::Insets(0, (media_capture_width - | 460 gfx::Insets(0, (media_capture_width - |
| 461 media_capture_icon_->GetPreferredSize().width()) / | 461 media_capture_icon_->GetPreferredSize().width()) / |
| 462 2))); | 462 2))); |
| 463 | 463 |
| 464 media_capture_icon_->set_id(VIEW_ID_USER_VIEW_MEDIA_INDICATOR); | 464 media_capture_icon_->set_id(VIEW_ID_USER_VIEW_MEDIA_INDICATOR); |
| 465 AddChildView(media_capture_icon_); | 465 AddChildView(media_capture_icon_); |
| 466 | 466 |
| 467 WmShell::Get()->media_controller()->RequestCaptureState(); | 467 Shell::Get()->media_controller()->RequestCaptureState(); |
| 468 } | 468 } |
| 469 } | 469 } |
| 470 | 470 |
| 471 } // namespace tray | 471 } // namespace tray |
| 472 } // namespace ash | 472 } // namespace ash |
| OLD | NEW |