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

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

Issue 2118593002: mash: Migrate ShellDelegate ownership and access to WmShell. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cleanup. Created 4 years, 5 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/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_delegate.h"
11 #include "ash/common/shell_window_ids.h" 12 #include "ash/common/shell_window_ids.h"
12 #include "ash/common/system/tray/system_tray_delegate.h" 13 #include "ash/common/system/tray/system_tray_delegate.h"
13 #include "ash/common/system/tray/tray_constants.h" 14 #include "ash/common/system/tray/tray_constants.h"
14 #include "ash/common/system/tray/tray_popup_label_button.h" 15 #include "ash/common/system/tray/tray_popup_label_button.h"
15 #include "ash/common/system/tray/tray_popup_label_button_border.h" 16 #include "ash/common/system/tray/tray_popup_label_button_border.h"
16 #include "ash/common/system/user/button_from_view.h" 17 #include "ash/common/system/user/button_from_view.h"
17 #include "ash/common/system/user/login_status.h" 18 #include "ash/common/system/user/login_status.h"
18 #include "ash/common/system/user/rounded_image_view.h" 19 #include "ash/common/system/user/rounded_image_view.h"
19 #include "ash/common/wm_lookup.h" 20 #include "ash/common/wm_lookup.h"
20 #include "ash/common/wm_root_window_controller.h" 21 #include "ash/common/wm_root_window_controller.h"
21 #include "ash/common/wm_shell.h" 22 #include "ash/common/wm_shell.h"
22 #include "ash/common/wm_window.h" 23 #include "ash/common/wm_window.h"
23 #include "ash/multi_profile_uma.h" 24 #include "ash/multi_profile_uma.h"
24 #include "ash/popup_message.h" 25 #include "ash/popup_message.h"
25 #include "ash/shell.h"
26 #include "ash/shell_delegate.h"
27 #include "ash/system/tray/system_tray.h" 26 #include "ash/system/tray/system_tray.h"
28 #include "ash/system/user/user_card_view.h" 27 #include "ash/system/user/user_card_view.h"
29 #include "components/signin/core/account_id/account_id.h" 28 #include "components/signin/core/account_id/account_id.h"
30 #include "components/user_manager/user_info.h" 29 #include "components/user_manager/user_info.h"
31 #include "grit/ash_resources.h" 30 #include "grit/ash_resources.h"
32 #include "grit/ash_strings.h" 31 #include "grit/ash_strings.h"
33 #include "ui/base/l10n/l10n_util.h" 32 #include "ui/base/l10n/l10n_util.h"
34 #include "ui/base/resource/resource_bundle.h" 33 #include "ui/base/resource/resource_bundle.h"
35 #include "ui/views/layout/fill_layout.h" 34 #include "ui/views/layout/fill_layout.h"
36 #include "ui/views/painter.h" 35 #include "ui/views/painter.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 if (delegate->IsUserSessionBlocked()) 77 if (delegate->IsUserSessionBlocked())
79 return; 78 return;
80 79
81 DCHECK(user_index > 0); 80 DCHECK(user_index > 0);
82 MultiProfileUMA::RecordSwitchActiveUser( 81 MultiProfileUMA::RecordSwitchActiveUser(
83 MultiProfileUMA::SWITCH_ACTIVE_USER_BY_TRAY); 82 MultiProfileUMA::SWITCH_ACTIVE_USER_BY_TRAY);
84 delegate->SwitchActiveUser(delegate->GetUserInfo(user_index)->GetAccountId()); 83 delegate->SwitchActiveUser(delegate->GetUserInfo(user_index)->GetAccountId());
85 } 84 }
86 85
87 bool IsMultiProfileSupportedAndUserActive() { 86 bool IsMultiProfileSupportedAndUserActive() {
88 return Shell::GetInstance()->delegate()->IsMultiProfilesEnabled() && 87 return WmShell::Get()->delegate()->IsMultiProfilesEnabled() &&
89 !WmShell::Get()->GetSessionStateDelegate()->IsUserSessionBlocked(); 88 !WmShell::Get()->GetSessionStateDelegate()->IsUserSessionBlocked();
90 } 89 }
91 90
92 class UserViewMouseWatcherHost : public views::MouseWatcherHost { 91 class UserViewMouseWatcherHost : public views::MouseWatcherHost {
93 public: 92 public:
94 explicit UserViewMouseWatcherHost(const gfx::Rect& screen_area) 93 explicit UserViewMouseWatcherHost(const gfx::Rect& screen_area)
95 : screen_area_(screen_area) {} 94 : screen_area_(screen_area) {}
96 ~UserViewMouseWatcherHost() override {} 95 ~UserViewMouseWatcherHost() override {}
97 96
98 // Implementation of MouseWatcherHost. 97 // Implementation of MouseWatcherHost.
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after
513 focus_manager_ = NULL; 512 focus_manager_ = NULL;
514 if (user_card_view_->GetFocusManager()) 513 if (user_card_view_->GetFocusManager())
515 user_card_view_->GetFocusManager()->ClearFocus(); 514 user_card_view_->GetFocusManager()->ClearFocus();
516 popup_message_.reset(); 515 popup_message_.reset();
517 mouse_watcher_.reset(); 516 mouse_watcher_.reset();
518 add_menu_option_.reset(); 517 add_menu_option_.reset();
519 } 518 }
520 519
521 } // namespace tray 520 } // namespace tray
522 } // namespace ash 521 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698