| 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" |
| 11 #include "ash/common/session/session_state_delegate.h" | 11 #include "ash/common/session/session_state_delegate.h" |
| 12 #include "ash/common/shell_delegate.h" | 12 #include "ash/common/shell_delegate.h" |
| 13 #include "ash/common/system/tray/system_tray.h" | 13 #include "ash/common/system/tray/system_tray.h" |
| 14 #include "ash/common/system/tray/system_tray_controller.h" | 14 #include "ash/common/system/tray/system_tray_controller.h" |
| 15 #include "ash/common/system/tray/system_tray_delegate.h" | 15 #include "ash/common/system/tray/system_tray_delegate.h" |
| 16 #include "ash/common/system/tray/tray_constants.h" | 16 #include "ash/common/system/tray/tray_constants.h" |
| 17 #include "ash/common/system/tray/tray_popup_item_style.h" | 17 #include "ash/common/system/tray/tray_popup_item_style.h" |
| 18 #include "ash/common/system/tray/tray_popup_utils.h" | 18 #include "ash/common/system/tray/tray_popup_utils.h" |
| 19 #include "ash/common/system/user/button_from_view.h" | 19 #include "ash/common/system/user/button_from_view.h" |
| 20 #include "ash/common/system/user/login_status.h" | 20 #include "ash/common/system/user/login_status.h" |
| 21 #include "ash/common/system/user/rounded_image_view.h" | 21 #include "ash/common/system/user/rounded_image_view.h" |
| 22 #include "ash/common/system/user/user_card_view.h" | 22 #include "ash/common/system/user/user_card_view.h" |
| 23 #include "ash/common/wm_lookup.h" | |
| 24 #include "ash/common/wm_shell.h" | 23 #include "ash/common/wm_shell.h" |
| 25 #include "ash/common/wm_window.h" | 24 #include "ash/common/wm_window.h" |
| 26 #include "ash/public/cpp/shell_window_ids.h" | 25 #include "ash/public/cpp/shell_window_ids.h" |
| 27 #include "ash/resources/grit/ash_resources.h" | 26 #include "ash/resources/grit/ash_resources.h" |
| 28 #include "ash/resources/vector_icons/vector_icons.h" | 27 #include "ash/resources/vector_icons/vector_icons.h" |
| 29 #include "ash/root_window_controller.h" | 28 #include "ash/root_window_controller.h" |
| 30 #include "ash/strings/grit/ash_strings.h" | 29 #include "ash/strings/grit/ash_strings.h" |
| 31 #include "base/memory/ptr_util.h" | 30 #include "base/memory/ptr_util.h" |
| 32 #include "components/signin/core/account_id/account_id.h" | 31 #include "components/signin/core/account_id/account_id.h" |
| 33 #include "components/user_manager/user_info.h" | 32 #include "components/user_manager/user_info.h" |
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 331 // item since it will destroyed automatically before the menu / user menu item | 330 // item since it will destroyed automatically before the menu / user menu item |
| 332 // gets destroyed.. | 331 // gets destroyed.. |
| 333 add_menu_option_.reset(new views::Widget); | 332 add_menu_option_.reset(new views::Widget); |
| 334 views::Widget::InitParams params; | 333 views::Widget::InitParams params; |
| 335 params.type = views::Widget::InitParams::TYPE_TOOLTIP; | 334 params.type = views::Widget::InitParams::TYPE_TOOLTIP; |
| 336 params.keep_on_top = true; | 335 params.keep_on_top = true; |
| 337 params.accept_events = true; | 336 params.accept_events = true; |
| 338 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; | 337 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; |
| 339 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; | 338 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; |
| 340 params.name = "AddUserMenuOption"; | 339 params.name = "AddUserMenuOption"; |
| 341 WmLookup::Get() | 340 WmWindow::Get(GetWidget()->GetNativeWindow()) |
| 342 ->GetWindowForWidget(GetWidget()) | |
| 343 ->GetRootWindowController() | 341 ->GetRootWindowController() |
| 344 ->ConfigureWidgetInitParamsForContainer( | 342 ->ConfigureWidgetInitParamsForContainer( |
| 345 add_menu_option_.get(), kShellWindowId_DragImageAndTooltipContainer, | 343 add_menu_option_.get(), kShellWindowId_DragImageAndTooltipContainer, |
| 346 ¶ms); | 344 ¶ms); |
| 347 add_menu_option_->Init(params); | 345 add_menu_option_->Init(params); |
| 348 | 346 |
| 349 const SessionStateDelegate* delegate = | 347 const SessionStateDelegate* delegate = |
| 350 WmShell::Get()->GetSessionStateDelegate(); | 348 WmShell::Get()->GetSessionStateDelegate(); |
| 351 const AddUserSessionPolicy add_user_policy = | 349 const AddUserSessionPolicy add_user_policy = |
| 352 delegate->GetAddUserSessionPolicy(); | 350 delegate->GetAddUserSessionPolicy(); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 return; | 391 return; |
| 394 focus_manager_->RemoveFocusChangeListener(this); | 392 focus_manager_->RemoveFocusChangeListener(this); |
| 395 focus_manager_ = nullptr; | 393 focus_manager_ = nullptr; |
| 396 if (user_card_view_->GetFocusManager()) | 394 if (user_card_view_->GetFocusManager()) |
| 397 user_card_view_->GetFocusManager()->ClearFocus(); | 395 user_card_view_->GetFocusManager()->ClearFocus(); |
| 398 add_menu_option_.reset(); | 396 add_menu_option_.reset(); |
| 399 } | 397 } |
| 400 | 398 |
| 401 } // namespace tray | 399 } // namespace tray |
| 402 } // namespace ash | 400 } // namespace ash |
| OLD | NEW |