| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/common/system/user/user_view.h" | 5 #include "ash/common/system/user/user_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "ash/common/multi_profile_uma.h" | 10 #include "ash/common/multi_profile_uma.h" |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 } | 262 } |
| 263 | 263 |
| 264 int UserView::GetHeightForWidth(int width) const { | 264 int UserView::GetHeightForWidth(int width) const { |
| 265 return GetPreferredSize().height(); | 265 return GetPreferredSize().height(); |
| 266 } | 266 } |
| 267 | 267 |
| 268 void UserView::ButtonPressed(views::Button* sender, const ui::Event& event) { | 268 void UserView::ButtonPressed(views::Button* sender, const ui::Event& event) { |
| 269 if (sender == logout_button_) { | 269 if (sender == logout_button_) { |
| 270 WmShell::Get()->RecordUserMetricsAction(UMA_STATUS_AREA_SIGN_OUT); | 270 WmShell::Get()->RecordUserMetricsAction(UMA_STATUS_AREA_SIGN_OUT); |
| 271 RemoveAddUserMenuOption(); | 271 RemoveAddUserMenuOption(); |
| 272 WmShell::Get()->system_tray_controller()->SignOut(); | 272 Shell::Get()->system_tray_controller()->SignOut(); |
| 273 } else if (sender == user_card_view_ && | 273 } else if (sender == user_card_view_ && |
| 274 IsMultiProfileSupportedAndUserActive()) { | 274 IsMultiProfileSupportedAndUserActive()) { |
| 275 if (IsActiveUser()) { | 275 if (IsActiveUser()) { |
| 276 ToggleAddUserMenuOption(); | 276 ToggleAddUserMenuOption(); |
| 277 } else { | 277 } else { |
| 278 RemoveAddUserMenuOption(); | 278 RemoveAddUserMenuOption(); |
| 279 SwitchUser(user_index_); | 279 SwitchUser(user_index_); |
| 280 // Since the user list is about to change the system menu should get | 280 // Since the user list is about to change the system menu should get |
| 281 // closed. | 281 // closed. |
| 282 owner_->system_tray()->CloseSystemBubble(); | 282 owner_->system_tray()->CloseSystemBubble(); |
| 283 } | 283 } |
| 284 } else if (add_menu_option_ && | 284 } else if (add_menu_option_ && |
| 285 sender->GetWidget() == add_menu_option_.get()) { | 285 sender->GetWidget() == add_menu_option_.get()) { |
| 286 RemoveAddUserMenuOption(); | 286 RemoveAddUserMenuOption(); |
| 287 // Let the user add another account to the session. | 287 // Let the user add another account to the session. |
| 288 MultiProfileUMA::RecordSigninUser(MultiProfileUMA::SIGNIN_USER_BY_TRAY); | 288 MultiProfileUMA::RecordSigninUser(MultiProfileUMA::SIGNIN_USER_BY_TRAY); |
| 289 WmShell::Get()->system_tray_delegate()->ShowUserLogin(); | 289 Shell::Get()->system_tray_delegate()->ShowUserLogin(); |
| 290 owner_->system_tray()->CloseSystemBubble(); | 290 owner_->system_tray()->CloseSystemBubble(); |
| 291 } else { | 291 } else { |
| 292 NOTREACHED(); | 292 NOTREACHED(); |
| 293 } | 293 } |
| 294 } | 294 } |
| 295 | 295 |
| 296 void UserView::OnWillChangeFocus(View* focused_before, View* focused_now) { | 296 void UserView::OnWillChangeFocus(View* focused_before, View* focused_now) { |
| 297 if (focused_now) | 297 if (focused_now) |
| 298 RemoveAddUserMenuOption(); | 298 RemoveAddUserMenuOption(); |
| 299 } | 299 } |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 396 return; | 396 return; |
| 397 focus_manager_->RemoveFocusChangeListener(this); | 397 focus_manager_->RemoveFocusChangeListener(this); |
| 398 focus_manager_ = nullptr; | 398 focus_manager_ = nullptr; |
| 399 if (user_card_view_->GetFocusManager()) | 399 if (user_card_view_->GetFocusManager()) |
| 400 user_card_view_->GetFocusManager()->ClearFocus(); | 400 user_card_view_->GetFocusManager()->ClearFocus(); |
| 401 add_menu_option_.reset(); | 401 add_menu_option_.reset(); |
| 402 } | 402 } |
| 403 | 403 |
| 404 } // namespace tray | 404 } // namespace tray |
| 405 } // namespace ash | 405 } // namespace ash |
| OLD | NEW |