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" |
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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 | 106 |
106 // Do not show more UserView's then there are logged in users. | 107 // Do not show more UserView's then there are logged in users. |
107 if (user_index_ >= logged_in_users) | 108 if (user_index_ >= logged_in_users) |
108 return nullptr; | 109 return nullptr; |
109 | 110 |
110 user_ = new tray::UserView(this, status, user_index_, false); | 111 user_ = new tray::UserView(this, status, user_index_, false); |
111 return user_; | 112 return user_; |
112 } | 113 } |
113 | 114 |
114 views::View* TrayUser::CreateDetailedView(user::LoginStatus status) { | 115 views::View* TrayUser::CreateDetailedView(user::LoginStatus status) { |
115 std::string user_id = Shell::GetInstance() | 116 const AccountId account_id = Shell::GetInstance() |
116 ->session_state_delegate() | 117 ->session_state_delegate() |
117 ->GetUserInfo(0) | 118 ->GetUserInfo(0) |
118 ->GetUserID(); | 119 ->GetAccountId(); |
119 tray::UserAccountsDelegate* delegate = | 120 tray::UserAccountsDelegate* delegate = |
120 Shell::GetInstance()->system_tray_delegate()->GetUserAccountsDelegate( | 121 Shell::GetInstance()->system_tray_delegate()->GetUserAccountsDelegate( |
121 user_id); | 122 account_id.GetUserEmail()); |
122 if (!delegate) | 123 if (!delegate) |
123 return nullptr; | 124 return nullptr; |
124 return new tray::AccountsDetailedView(this, status, delegate); | 125 return new tray::AccountsDetailedView(this, status, delegate); |
125 } | 126 } |
126 | 127 |
127 void TrayUser::DestroyTrayView() { | 128 void TrayUser::DestroyTrayView() { |
128 layout_view_ = nullptr; | 129 layout_view_ = nullptr; |
129 avatar_ = nullptr; | 130 avatar_ = nullptr; |
130 label_ = nullptr; | 131 label_ = nullptr; |
131 } | 132 } |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 void TrayUser::UpdateLayoutOfItem() { | 291 void TrayUser::UpdateLayoutOfItem() { |
291 RootWindowController* controller = GetRootWindowController( | 292 RootWindowController* controller = GetRootWindowController( |
292 system_tray()->GetWidget()->GetNativeWindow()->GetRootWindow()); | 293 system_tray()->GetWidget()->GetNativeWindow()->GetRootWindow()); |
293 if (controller && controller->shelf()) { | 294 if (controller && controller->shelf()) { |
294 UpdateAfterShelfAlignmentChange( | 295 UpdateAfterShelfAlignmentChange( |
295 controller->GetShelfLayoutManager()->GetAlignment()); | 296 controller->GetShelfLayoutManager()->GetAlignment()); |
296 } | 297 } |
297 } | 298 } |
298 | 299 |
299 } // namespace ash | 300 } // namespace ash |
OLD | NEW |