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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 std::string user_id = Shell::GetInstance() |
116 ->session_state_delegate() | 117 ->session_state_delegate() |
117 ->GetUserInfo(0) | 118 ->GetUserInfo(0) |
118 ->GetUserID(); | 119 ->GetUserID() |
120 .GetUserEmail(); | |
119 tray::UserAccountsDelegate* delegate = | 121 tray::UserAccountsDelegate* delegate = |
120 Shell::GetInstance()->system_tray_delegate()->GetUserAccountsDelegate( | 122 Shell::GetInstance()->system_tray_delegate()->GetUserAccountsDelegate( |
121 user_id); | 123 user_id); |
stevenjb
2015/10/22 17:52:36
Can we actually change GetUserAccountsDelegate to
Alexander Alekseev
2015/10/23 09:11:20
Let's leave this for another CL. This one replaces
stevenjb
2015/10/23 17:17:02
I suppose that is OK, although it does seem like w
| |
122 if (!delegate) | 124 if (!delegate) |
123 return nullptr; | 125 return nullptr; |
124 return new tray::AccountsDetailedView(this, status, delegate); | 126 return new tray::AccountsDetailedView(this, status, delegate); |
125 } | 127 } |
126 | 128 |
127 void TrayUser::DestroyTrayView() { | 129 void TrayUser::DestroyTrayView() { |
128 layout_view_ = nullptr; | 130 layout_view_ = nullptr; |
129 avatar_ = nullptr; | 131 avatar_ = nullptr; |
130 label_ = nullptr; | 132 label_ = nullptr; |
131 } | 133 } |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
290 void TrayUser::UpdateLayoutOfItem() { | 292 void TrayUser::UpdateLayoutOfItem() { |
291 RootWindowController* controller = GetRootWindowController( | 293 RootWindowController* controller = GetRootWindowController( |
292 system_tray()->GetWidget()->GetNativeWindow()->GetRootWindow()); | 294 system_tray()->GetWidget()->GetNativeWindow()->GetRootWindow()); |
293 if (controller && controller->shelf()) { | 295 if (controller && controller->shelf()) { |
294 UpdateAfterShelfAlignmentChange( | 296 UpdateAfterShelfAlignmentChange( |
295 controller->GetShelfLayoutManager()->GetAlignment()); | 297 controller->GetShelfLayoutManager()->GetAlignment()); |
296 } | 298 } |
297 } | 299 } |
298 | 300 |
299 } // namespace ash | 301 } // namespace ash |
OLD | NEW |