| 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/system/user/tray_user.h" | 5 #include "ash/system/user/tray_user.h" |
| 6 | 6 |
| 7 #include "ash/ash_switches.h" | 7 #include "ash/ash_switches.h" |
| 8 #include "ash/root_window_controller.h" | 8 #include "ash/root_window_controller.h" |
| 9 #include "ash/session/session_state_delegate.h" | 9 #include "ash/session/session_state_delegate.h" |
| 10 #include "ash/shelf/shelf_layout_manager.h" | 10 #include "ash/shelf/shelf_layout_manager.h" |
| 11 #include "ash/shell_delegate.h" | 11 #include "ash/shell_delegate.h" |
| 12 #include "ash/system/tray/system_tray.h" | 12 #include "ash/system/tray/system_tray.h" |
| 13 #include "ash/system/tray/system_tray_delegate.h" | 13 #include "ash/system/tray/system_tray_delegate.h" |
| 14 #include "ash/system/tray/system_tray_notifier.h" | 14 #include "ash/system/tray/system_tray_notifier.h" |
| 15 #include "ash/system/tray/tray_constants.h" | 15 #include "ash/system/tray/tray_constants.h" |
| 16 #include "ash/system/tray/tray_item_view.h" | 16 #include "ash/system/tray/tray_item_view.h" |
| 17 #include "ash/system/tray/tray_utils.h" | 17 #include "ash/system/tray/tray_utils.h" |
| 18 #include "ash/system/user/accounts_detailed_view.h" | 18 #include "ash/system/user/accounts_detailed_view.h" |
| 19 #include "ash/system/user/rounded_image_view.h" | 19 #include "ash/system/user/rounded_image_view.h" |
| 20 #include "ash/system/user/user_view.h" | 20 #include "ash/system/user/user_view.h" |
| 21 #include "base/logging.h" | 21 #include "base/logging.h" |
| 22 #include "base/strings/string16.h" | 22 #include "base/strings/string16.h" |
| 23 #include "components/signin/core/account_id/account_id.h" | |
| 24 #include "components/user_manager/user_info.h" | 23 #include "components/user_manager/user_info.h" |
| 25 #include "grit/ash_strings.h" | 24 #include "grit/ash_strings.h" |
| 26 #include "ui/aura/window.h" | 25 #include "ui/aura/window.h" |
| 27 #include "ui/base/l10n/l10n_util.h" | 26 #include "ui/base/l10n/l10n_util.h" |
| 28 #include "ui/gfx/image/image.h" | 27 #include "ui/gfx/image/image.h" |
| 29 #include "ui/views/border.h" | 28 #include "ui/views/border.h" |
| 30 #include "ui/views/controls/label.h" | 29 #include "ui/views/controls/label.h" |
| 31 #include "ui/views/layout/box_layout.h" | 30 #include "ui/views/layout/box_layout.h" |
| 32 #include "ui/views/view.h" | 31 #include "ui/views/view.h" |
| 33 #include "ui/views/widget/widget.h" | 32 #include "ui/views/widget/widget.h" |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 | 105 |
| 107 // Do not show more UserView's then there are logged in users. | 106 // Do not show more UserView's then there are logged in users. |
| 108 if (user_index_ >= logged_in_users) | 107 if (user_index_ >= logged_in_users) |
| 109 return nullptr; | 108 return nullptr; |
| 110 | 109 |
| 111 user_ = new tray::UserView(this, status, user_index_, false); | 110 user_ = new tray::UserView(this, status, user_index_, false); |
| 112 return user_; | 111 return user_; |
| 113 } | 112 } |
| 114 | 113 |
| 115 views::View* TrayUser::CreateDetailedView(user::LoginStatus status) { | 114 views::View* TrayUser::CreateDetailedView(user::LoginStatus status) { |
| 116 const AccountId account_id = Shell::GetInstance() | 115 std::string user_id = Shell::GetInstance() |
| 117 ->session_state_delegate() | 116 ->session_state_delegate() |
| 118 ->GetUserInfo(0) | 117 ->GetUserInfo(0) |
| 119 ->GetAccountId(); | 118 ->GetUserID(); |
| 120 tray::UserAccountsDelegate* delegate = | 119 tray::UserAccountsDelegate* delegate = |
| 121 Shell::GetInstance()->system_tray_delegate()->GetUserAccountsDelegate( | 120 Shell::GetInstance()->system_tray_delegate()->GetUserAccountsDelegate( |
| 122 account_id.GetUserEmail()); | 121 user_id); |
| 123 if (!delegate) | 122 if (!delegate) |
| 124 return nullptr; | 123 return nullptr; |
| 125 return new tray::AccountsDetailedView(this, status, delegate); | 124 return new tray::AccountsDetailedView(this, status, delegate); |
| 126 } | 125 } |
| 127 | 126 |
| 128 void TrayUser::DestroyTrayView() { | 127 void TrayUser::DestroyTrayView() { |
| 129 layout_view_ = nullptr; | 128 layout_view_ = nullptr; |
| 130 avatar_ = nullptr; | 129 avatar_ = nullptr; |
| 131 label_ = nullptr; | 130 label_ = nullptr; |
| 132 } | 131 } |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 void TrayUser::UpdateLayoutOfItem() { | 290 void TrayUser::UpdateLayoutOfItem() { |
| 292 RootWindowController* controller = GetRootWindowController( | 291 RootWindowController* controller = GetRootWindowController( |
| 293 system_tray()->GetWidget()->GetNativeWindow()->GetRootWindow()); | 292 system_tray()->GetWidget()->GetNativeWindow()->GetRootWindow()); |
| 294 if (controller && controller->shelf()) { | 293 if (controller && controller->shelf()) { |
| 295 UpdateAfterShelfAlignmentChange( | 294 UpdateAfterShelfAlignmentChange( |
| 296 controller->GetShelfLayoutManager()->GetAlignment()); | 295 controller->GetShelfLayoutManager()->GetAlignment()); |
| 297 } | 296 } |
| 298 } | 297 } |
| 299 | 298 |
| 300 } // namespace ash | 299 } // namespace ash |
| OLD | NEW |