| 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/system/user/user_view.h" | 5 #include "ash/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/session/session_state_delegate.h" | 10 #include "ash/common/session/session_state_delegate.h" |
| 11 #include "ash/common/shell_window_ids.h" | 11 #include "ash/common/shell_window_ids.h" |
| 12 #include "ash/common/system/tray/system_tray_delegate.h" | 12 #include "ash/common/system/tray/system_tray_delegate.h" |
| 13 #include "ash/common/wm_lookup.h" | 13 #include "ash/common/wm_lookup.h" |
| 14 #include "ash/common/wm_root_window_controller.h" | 14 #include "ash/common/wm_root_window_controller.h" |
| 15 #include "ash/common/wm_shell.h" |
| 15 #include "ash/common/wm_window.h" | 16 #include "ash/common/wm_window.h" |
| 16 #include "ash/multi_profile_uma.h" | 17 #include "ash/multi_profile_uma.h" |
| 17 #include "ash/popup_message.h" | 18 #include "ash/popup_message.h" |
| 18 #include "ash/shell.h" | 19 #include "ash/shell.h" |
| 19 #include "ash/shell_delegate.h" | 20 #include "ash/shell_delegate.h" |
| 20 #include "ash/system/tray/system_tray.h" | 21 #include "ash/system/tray/system_tray.h" |
| 21 #include "ash/system/tray/tray_popup_label_button.h" | 22 #include "ash/system/tray/tray_popup_label_button.h" |
| 22 #include "ash/system/tray/tray_popup_label_button_border.h" | 23 #include "ash/system/tray/tray_popup_label_button_border.h" |
| 23 #include "ash/system/user/button_from_view.h" | 24 #include "ash/system/user/button_from_view.h" |
| 24 #include "ash/system/user/rounded_image_view.h" | 25 #include "ash/system/user/rounded_image_view.h" |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 } else if (logout_button_) { | 292 } else if (logout_button_) { |
| 292 logout_button_->SetBoundsRect(contents_area); | 293 logout_button_->SetBoundsRect(contents_area); |
| 293 } | 294 } |
| 294 } | 295 } |
| 295 | 296 |
| 296 void UserView::ButtonPressed(views::Button* sender, const ui::Event& event) { | 297 void UserView::ButtonPressed(views::Button* sender, const ui::Event& event) { |
| 297 if (sender == logout_button_) { | 298 if (sender == logout_button_) { |
| 298 Shell::GetInstance()->metrics()->RecordUserMetricsAction( | 299 Shell::GetInstance()->metrics()->RecordUserMetricsAction( |
| 299 ash::UMA_STATUS_AREA_SIGN_OUT); | 300 ash::UMA_STATUS_AREA_SIGN_OUT); |
| 300 RemoveAddUserMenuOption(); | 301 RemoveAddUserMenuOption(); |
| 301 Shell::GetInstance()->system_tray_delegate()->SignOut(); | 302 WmShell::Get()->system_tray_delegate()->SignOut(); |
| 302 } else if (sender == user_card_view_ && | 303 } else if (sender == user_card_view_ && |
| 303 IsMultiProfileSupportedAndUserActive()) { | 304 IsMultiProfileSupportedAndUserActive()) { |
| 304 if (!user_index_) { | 305 if (!user_index_) { |
| 305 ToggleAddUserMenuOption(); | 306 ToggleAddUserMenuOption(); |
| 306 } else { | 307 } else { |
| 307 RemoveAddUserMenuOption(); | 308 RemoveAddUserMenuOption(); |
| 308 SwitchUser(user_index_); | 309 SwitchUser(user_index_); |
| 309 // Since the user list is about to change the system menu should get | 310 // Since the user list is about to change the system menu should get |
| 310 // closed. | 311 // closed. |
| 311 owner_->system_tray()->CloseSystemBubble(); | 312 owner_->system_tray()->CloseSystemBubble(); |
| 312 } | 313 } |
| 313 } else if (add_menu_option_.get() && | 314 } else if (add_menu_option_.get() && |
| 314 sender == add_menu_option_->GetContentsView()) { | 315 sender == add_menu_option_->GetContentsView()) { |
| 315 RemoveAddUserMenuOption(); | 316 RemoveAddUserMenuOption(); |
| 316 // Let the user add another account to the session. | 317 // Let the user add another account to the session. |
| 317 MultiProfileUMA::RecordSigninUser(MultiProfileUMA::SIGNIN_USER_BY_TRAY); | 318 MultiProfileUMA::RecordSigninUser(MultiProfileUMA::SIGNIN_USER_BY_TRAY); |
| 318 Shell::GetInstance()->system_tray_delegate()->ShowUserLogin(); | 319 WmShell::Get()->system_tray_delegate()->ShowUserLogin(); |
| 319 owner_->system_tray()->CloseSystemBubble(); | 320 owner_->system_tray()->CloseSystemBubble(); |
| 320 } else { | 321 } else { |
| 321 NOTREACHED(); | 322 NOTREACHED(); |
| 322 } | 323 } |
| 323 } | 324 } |
| 324 | 325 |
| 325 void UserView::OnWillChangeFocus(View* focused_before, View* focused_now) { | 326 void UserView::OnWillChangeFocus(View* focused_before, View* focused_now) { |
| 326 if (focused_now) | 327 if (focused_now) |
| 327 RemoveAddUserMenuOption(); | 328 RemoveAddUserMenuOption(); |
| 328 } | 329 } |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 523 focus_manager_ = NULL; | 524 focus_manager_ = NULL; |
| 524 if (user_card_view_->GetFocusManager()) | 525 if (user_card_view_->GetFocusManager()) |
| 525 user_card_view_->GetFocusManager()->ClearFocus(); | 526 user_card_view_->GetFocusManager()->ClearFocus(); |
| 526 popup_message_.reset(); | 527 popup_message_.reset(); |
| 527 mouse_watcher_.reset(); | 528 mouse_watcher_.reset(); |
| 528 add_menu_option_.reset(); | 529 add_menu_option_.reset(); |
| 529 } | 530 } |
| 530 | 531 |
| 531 } // namespace tray | 532 } // namespace tray |
| 532 } // namespace ash | 533 } // namespace ash |
| OLD | NEW |