Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(378)

Side by Side Diff: ash/common/system/user/user_view.cc

Issue 2741273002: chromeos: Promotes more from WmShell to Shell (Closed)
Patch Set: feedback Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_shell.h" 23 #include "ash/common/wm_shell.h"
24 #include "ash/common/wm_window.h" 24 #include "ash/common/wm_window.h"
25 #include "ash/public/cpp/shell_window_ids.h" 25 #include "ash/public/cpp/shell_window_ids.h"
26 #include "ash/resources/grit/ash_resources.h" 26 #include "ash/resources/grit/ash_resources.h"
27 #include "ash/resources/vector_icons/vector_icons.h" 27 #include "ash/resources/vector_icons/vector_icons.h"
28 #include "ash/root_window_controller.h" 28 #include "ash/root_window_controller.h"
29 #include "ash/shell.h"
29 #include "ash/strings/grit/ash_strings.h" 30 #include "ash/strings/grit/ash_strings.h"
30 #include "base/memory/ptr_util.h" 31 #include "base/memory/ptr_util.h"
31 #include "components/signin/core/account_id/account_id.h" 32 #include "components/signin/core/account_id/account_id.h"
32 #include "components/user_manager/user_info.h" 33 #include "components/user_manager/user_info.h"
33 #include "ui/base/l10n/l10n_util.h" 34 #include "ui/base/l10n/l10n_util.h"
34 #include "ui/base/resource/resource_bundle.h" 35 #include "ui/base/resource/resource_bundle.h"
35 #include "ui/gfx/canvas.h" 36 #include "ui/gfx/canvas.h"
36 #include "ui/gfx/geometry/insets.h" 37 #include "ui/gfx/geometry/insets.h"
37 #include "ui/gfx/paint_vector_icon.h" 38 #include "ui/gfx/paint_vector_icon.h"
38 #include "ui/views/controls/button/label_button.h" 39 #include "ui/views/controls/button/label_button.h"
(...skipping 14 matching lines...) Expand all
53 if (delegate->IsUserSessionBlocked()) 54 if (delegate->IsUserSessionBlocked())
54 return; 55 return;
55 56
56 DCHECK(user_index > 0); 57 DCHECK(user_index > 0);
57 MultiProfileUMA::RecordSwitchActiveUser( 58 MultiProfileUMA::RecordSwitchActiveUser(
58 MultiProfileUMA::SWITCH_ACTIVE_USER_BY_TRAY); 59 MultiProfileUMA::SWITCH_ACTIVE_USER_BY_TRAY);
59 delegate->SwitchActiveUser(delegate->GetUserInfo(user_index)->GetAccountId()); 60 delegate->SwitchActiveUser(delegate->GetUserInfo(user_index)->GetAccountId());
60 } 61 }
61 62
62 bool IsMultiProfileSupportedAndUserActive() { 63 bool IsMultiProfileSupportedAndUserActive() {
63 return WmShell::Get()->delegate()->IsMultiProfilesEnabled() && 64 return Shell::Get()->shell_delegate()->IsMultiProfilesEnabled() &&
64 !WmShell::Get()->GetSessionStateDelegate()->IsUserSessionBlocked(); 65 !WmShell::Get()->GetSessionStateDelegate()->IsUserSessionBlocked();
65 } 66 }
66 67
67 // Creates the view shown in the user switcher popup ("AddUserMenuOption"). 68 // Creates the view shown in the user switcher popup ("AddUserMenuOption").
68 views::View* CreateAddUserView(AddUserSessionPolicy policy, 69 views::View* CreateAddUserView(AddUserSessionPolicy policy,
69 views::ButtonListener* listener) { 70 views::ButtonListener* listener) {
70 auto* view = new views::View; 71 auto* view = new views::View;
71 const int icon_padding = (kMenuButtonSize - kMenuIconSize) / 2; 72 const int icon_padding = (kMenuButtonSize - kMenuIconSize) / 2;
72 auto* layout = 73 auto* layout =
73 new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, 74 new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0,
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 return; 392 return;
392 focus_manager_->RemoveFocusChangeListener(this); 393 focus_manager_->RemoveFocusChangeListener(this);
393 focus_manager_ = nullptr; 394 focus_manager_ = nullptr;
394 if (user_card_view_->GetFocusManager()) 395 if (user_card_view_->GetFocusManager())
395 user_card_view_->GetFocusManager()->ClearFocus(); 396 user_card_view_->GetFocusManager()->ClearFocus();
396 add_menu_option_.reset(); 397 add_menu_option_.reset();
397 } 398 }
398 399
399 } // namespace tray 400 } // namespace tray
400 } // namespace ash 401 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/system/user/tray_user_unittest.cc ('k') | ash/common/wallpaper/wallpaper_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698