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