| 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 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 } | 256 } |
| 257 | 257 |
| 258 int UserView::GetHeightForWidth(int width) const { | 258 int UserView::GetHeightForWidth(int width) const { |
| 259 return GetPreferredSize().height(); | 259 return GetPreferredSize().height(); |
| 260 } | 260 } |
| 261 | 261 |
| 262 void UserView::ButtonPressed(views::Button* sender, const ui::Event& event) { | 262 void UserView::ButtonPressed(views::Button* sender, const ui::Event& event) { |
| 263 if (sender == logout_button_) { | 263 if (sender == logout_button_) { |
| 264 WmShell::Get()->RecordUserMetricsAction(UMA_STATUS_AREA_SIGN_OUT); | 264 WmShell::Get()->RecordUserMetricsAction(UMA_STATUS_AREA_SIGN_OUT); |
| 265 RemoveAddUserMenuOption(); | 265 RemoveAddUserMenuOption(); |
| 266 WmShell::Get()->system_tray_controller()->SignOut(); | 266 Shell::Get()->system_tray_controller()->SignOut(); |
| 267 } else if (sender == user_card_view_ && | 267 } else if (sender == user_card_view_ && |
| 268 IsMultiProfileSupportedAndUserActive()) { | 268 IsMultiProfileSupportedAndUserActive()) { |
| 269 if (IsActiveUser()) { | 269 if (IsActiveUser()) { |
| 270 ToggleAddUserMenuOption(); | 270 ToggleAddUserMenuOption(); |
| 271 } else { | 271 } else { |
| 272 RemoveAddUserMenuOption(); | 272 RemoveAddUserMenuOption(); |
| 273 SwitchUser(user_index_); | 273 SwitchUser(user_index_); |
| 274 // Since the user list is about to change the system menu should get | 274 // Since the user list is about to change the system menu should get |
| 275 // closed. | 275 // closed. |
| 276 owner_->system_tray()->CloseSystemBubble(); | 276 owner_->system_tray()->CloseSystemBubble(); |
| 277 } | 277 } |
| 278 } else if (add_menu_option_ && | 278 } else if (add_menu_option_ && |
| 279 sender->GetWidget() == add_menu_option_.get()) { | 279 sender->GetWidget() == add_menu_option_.get()) { |
| 280 RemoveAddUserMenuOption(); | 280 RemoveAddUserMenuOption(); |
| 281 // Let the user add another account to the session. | 281 // Let the user add another account to the session. |
| 282 MultiProfileUMA::RecordSigninUser(MultiProfileUMA::SIGNIN_USER_BY_TRAY); | 282 MultiProfileUMA::RecordSigninUser(MultiProfileUMA::SIGNIN_USER_BY_TRAY); |
| 283 WmShell::Get()->system_tray_delegate()->ShowUserLogin(); | 283 Shell::Get()->system_tray_delegate()->ShowUserLogin(); |
| 284 owner_->system_tray()->CloseSystemBubble(); | 284 owner_->system_tray()->CloseSystemBubble(); |
| 285 } else { | 285 } else { |
| 286 NOTREACHED(); | 286 NOTREACHED(); |
| 287 } | 287 } |
| 288 } | 288 } |
| 289 | 289 |
| 290 void UserView::OnWillChangeFocus(View* focused_before, View* focused_now) { | 290 void UserView::OnWillChangeFocus(View* focused_before, View* focused_now) { |
| 291 if (focused_now) | 291 if (focused_now) |
| 292 RemoveAddUserMenuOption(); | 292 RemoveAddUserMenuOption(); |
| 293 } | 293 } |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 392 return; | 392 return; |
| 393 focus_manager_->RemoveFocusChangeListener(this); | 393 focus_manager_->RemoveFocusChangeListener(this); |
| 394 focus_manager_ = nullptr; | 394 focus_manager_ = nullptr; |
| 395 if (user_card_view_->GetFocusManager()) | 395 if (user_card_view_->GetFocusManager()) |
| 396 user_card_view_->GetFocusManager()->ClearFocus(); | 396 user_card_view_->GetFocusManager()->ClearFocus(); |
| 397 add_menu_option_.reset(); | 397 add_menu_option_.reset(); |
| 398 } | 398 } |
| 399 | 399 |
| 400 } // namespace tray | 400 } // namespace tray |
| 401 } // namespace ash | 401 } // namespace ash |
| OLD | NEW |