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 <algorithm> | 7 #include <algorithm> |
8 #include <climits> | 8 #include <climits> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 ash::SessionStateDelegate* delegate = | 127 ash::SessionStateDelegate* delegate = |
128 ash::Shell::GetInstance()->session_state_delegate(); | 128 ash::Shell::GetInstance()->session_state_delegate(); |
129 ash::MultiProfileUMA::RecordSwitchActiveUser( | 129 ash::MultiProfileUMA::RecordSwitchActiveUser( |
130 ash::MultiProfileUMA::SWITCH_ACTIVE_USER_BY_TRAY); | 130 ash::MultiProfileUMA::SWITCH_ACTIVE_USER_BY_TRAY); |
131 delegate->SwitchActiveUser(delegate->GetUserID(user_index)); | 131 delegate->SwitchActiveUser(delegate->GetUserID(user_index)); |
132 } | 132 } |
133 | 133 |
134 } // namespace | 134 } // namespace |
135 | 135 |
136 namespace ash { | 136 namespace ash { |
137 namespace internal { | |
138 | |
139 namespace tray { | 137 namespace tray { |
140 | 138 |
141 // A custom image view with rounded edges. | 139 // A custom image view with rounded edges. |
142 class RoundedImageView : public views::View { | 140 class RoundedImageView : public views::View { |
143 public: | 141 public: |
144 // Constructs a new rounded image view with rounded corners of radius | 142 // Constructs a new rounded image view with rounded corners of radius |
145 // |corner_radius|. If |active_user| is set, the icon will be drawn in | 143 // |corner_radius|. If |active_user| is set, the icon will be drawn in |
146 // full colors - otherwise it will fade into the background. | 144 // full colors - otherwise it will fade into the background. |
147 RoundedImageView(int corner_radius, bool active_user); | 145 RoundedImageView(int corner_radius, bool active_user); |
148 virtual ~RoundedImageView(); | 146 virtual ~RoundedImageView(); |
(...skipping 1200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1349 // If multi profile is not enabled we can use the normal index. | 1347 // If multi profile is not enabled we can use the normal index. |
1350 if (!shell->delegate()->IsMultiProfilesEnabled()) | 1348 if (!shell->delegate()->IsMultiProfilesEnabled()) |
1351 return multiprofile_index_; | 1349 return multiprofile_index_; |
1352 // In case of multi profile we need to mirror the indices since the system | 1350 // In case of multi profile we need to mirror the indices since the system |
1353 // tray items are in the reverse order then the menu items. | 1351 // tray items are in the reverse order then the menu items. |
1354 return shell->session_state_delegate()->GetMaximumNumberOfLoggedInUsers() - | 1352 return shell->session_state_delegate()->GetMaximumNumberOfLoggedInUsers() - |
1355 1 - multiprofile_index_; | 1353 1 - multiprofile_index_; |
1356 } | 1354 } |
1357 | 1355 |
1358 void TrayUser::UpdateLayoutOfItem() { | 1356 void TrayUser::UpdateLayoutOfItem() { |
1359 internal::RootWindowController* controller = | 1357 RootWindowController* controller = GetRootWindowController( |
1360 internal::GetRootWindowController( | 1358 system_tray()->GetWidget()->GetNativeWindow()->GetRootWindow()); |
1361 system_tray()->GetWidget()->GetNativeWindow()->GetRootWindow()); | |
1362 if (controller && controller->shelf()) { | 1359 if (controller && controller->shelf()) { |
1363 UpdateAfterShelfAlignmentChange( | 1360 UpdateAfterShelfAlignmentChange( |
1364 controller->GetShelfLayoutManager()->GetAlignment()); | 1361 controller->GetShelfLayoutManager()->GetAlignment()); |
1365 } | 1362 } |
1366 } | 1363 } |
1367 | 1364 |
1368 } // namespace internal | |
1369 } // namespace ash | 1365 } // namespace ash |
OLD | NEW |