| 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/user_manager/user_id.h" |
| 23 #include "components/user_manager/user_info.h" | 24 #include "components/user_manager/user_info.h" |
| 24 #include "grit/ash_strings.h" | 25 #include "grit/ash_strings.h" |
| 25 #include "ui/aura/window.h" | 26 #include "ui/aura/window.h" |
| 26 #include "ui/base/l10n/l10n_util.h" | 27 #include "ui/base/l10n/l10n_util.h" |
| 27 #include "ui/gfx/image/image.h" | 28 #include "ui/gfx/image/image.h" |
| 28 #include "ui/views/border.h" | 29 #include "ui/views/border.h" |
| 29 #include "ui/views/controls/label.h" | 30 #include "ui/views/controls/label.h" |
| 30 #include "ui/views/layout/box_layout.h" | 31 #include "ui/views/layout/box_layout.h" |
| 31 #include "ui/views/view.h" | 32 #include "ui/views/view.h" |
| 32 #include "ui/views/widget/widget.h" | 33 #include "ui/views/widget/widget.h" |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 | 107 |
| 107 // Do not show more UserView's then there are logged in users. | 108 // Do not show more UserView's then there are logged in users. |
| 108 if (multiprofile_index_ >= logged_in_users) | 109 if (multiprofile_index_ >= logged_in_users) |
| 109 return nullptr; | 110 return nullptr; |
| 110 | 111 |
| 111 user_ = new tray::UserView(this, status, multiprofile_index_, false); | 112 user_ = new tray::UserView(this, status, multiprofile_index_, false); |
| 112 return user_; | 113 return user_; |
| 113 } | 114 } |
| 114 | 115 |
| 115 views::View* TrayUser::CreateDetailedView(user::LoginStatus status) { | 116 views::View* TrayUser::CreateDetailedView(user::LoginStatus status) { |
| 116 std::string user_id = Shell::GetInstance() | 117 const user_manager::UserID user_id = Shell::GetInstance() |
| 117 ->session_state_delegate() | 118 ->session_state_delegate() |
| 118 ->GetUserInfo(0) | 119 ->GetUserInfo(0) |
| 119 ->GetUserID(); | 120 ->GetUserID(); |
| 120 tray::UserAccountsDelegate* delegate = | 121 tray::UserAccountsDelegate* delegate = |
| 121 Shell::GetInstance()->system_tray_delegate()->GetUserAccountsDelegate( | 122 Shell::GetInstance()->system_tray_delegate()->GetUserAccountsDelegate( |
| 122 user_id); | 123 user_id); |
| 123 if (!delegate) | 124 if (!delegate) |
| 124 return nullptr; | 125 return nullptr; |
| 125 return new tray::AccountsDetailedView(this, status, delegate); | 126 return new tray::AccountsDetailedView(this, status, delegate); |
| 126 } | 127 } |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 void TrayUser::UpdateLayoutOfItem() { | 292 void TrayUser::UpdateLayoutOfItem() { |
| 292 RootWindowController* controller = GetRootWindowController( | 293 RootWindowController* controller = GetRootWindowController( |
| 293 system_tray()->GetWidget()->GetNativeWindow()->GetRootWindow()); | 294 system_tray()->GetWidget()->GetNativeWindow()->GetRootWindow()); |
| 294 if (controller && controller->shelf()) { | 295 if (controller && controller->shelf()) { |
| 295 UpdateAfterShelfAlignmentChange( | 296 UpdateAfterShelfAlignmentChange( |
| 296 controller->GetShelfLayoutManager()->GetAlignment()); | 297 controller->GetShelfLayoutManager()->GetAlignment()); |
| 297 } | 298 } |
| 298 } | 299 } |
| 299 | 300 |
| 300 } // namespace ash | 301 } // namespace ash |
| OLD | NEW |