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

Side by Side Diff: ash/common/wm_shell.cc

Issue 2619943002: Revert "chromeos: Fix shelf appearing at login screen under mash" (Closed)
Patch Set: Created 3 years, 11 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
« no previous file with comments | « ash/common/wm_shell.h ('k') | ash/mus/test/ash_test_impl_mus.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/wm_shell.h" 5 #include "ash/common/wm_shell.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "ash/common/accelerators/accelerator_controller.h" 9 #include "ash/common/accelerators/accelerator_controller.h"
10 #include "ash/common/accelerators/ash_focus_manager_factory.h" 10 #include "ash/common/accelerators/ash_focus_manager_factory.h"
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 void WmShell::CreateShelf() { 146 void WmShell::CreateShelf() {
147 // Must occur after SessionStateDelegate creation and user login. 147 // Must occur after SessionStateDelegate creation and user login.
148 DCHECK(GetSessionStateDelegate()); 148 DCHECK(GetSessionStateDelegate());
149 DCHECK_GT(GetSessionStateDelegate()->NumberOfLoggedInUsers(), 0); 149 DCHECK_GT(GetSessionStateDelegate()->NumberOfLoggedInUsers(), 0);
150 CreateShelfDelegate(); 150 CreateShelfDelegate();
151 151
152 for (WmWindow* root_window : GetAllRootWindows()) 152 for (WmWindow* root_window : GetAllRootWindows())
153 root_window->GetRootWindowController()->CreateShelf(); 153 root_window->GetRootWindowController()->CreateShelf();
154 } 154 }
155 155
156 void WmShell::ShowShelf() {
157 for (WmWindow* root_window : GetAllRootWindows())
158 root_window->GetRootWindowController()->ShowShelf();
159 }
160
156 void WmShell::CreateShelfDelegate() { 161 void WmShell::CreateShelfDelegate() {
157 // May be called multiple times as shelves are created and destroyed. 162 // May be called multiple times as shelves are created and destroyed.
158 if (shelf_delegate_) 163 if (shelf_delegate_)
159 return; 164 return;
160 // Must occur after SessionStateDelegate creation and user login because 165 // Must occur after SessionStateDelegate creation and user login because
161 // Chrome's implementation of ShelfDelegate assumes it can get information 166 // Chrome's implementation of ShelfDelegate assumes it can get information
162 // about multi-profile login state. 167 // about multi-profile login state.
163 DCHECK(GetSessionStateDelegate()); 168 DCHECK(GetSessionStateDelegate());
164 DCHECK_GT(GetSessionStateDelegate()->NumberOfLoggedInUsers(), 0); 169 DCHECK_GT(GetSessionStateDelegate()->NumberOfLoggedInUsers(), 0);
165 shelf_delegate_.reset(delegate_->CreateShelfDelegate(shelf_model())); 170 shelf_delegate_.reset(delegate_->CreateShelfDelegate(shelf_model()));
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 session_controller_(base::MakeUnique<SessionController>()), 267 session_controller_(base::MakeUnique<SessionController>()),
263 shelf_controller_(base::MakeUnique<ShelfController>()), 268 shelf_controller_(base::MakeUnique<ShelfController>()),
264 shutdown_controller_(base::MakeUnique<ShutdownController>()), 269 shutdown_controller_(base::MakeUnique<ShutdownController>()),
265 system_tray_controller_(base::MakeUnique<SystemTrayController>()), 270 system_tray_controller_(base::MakeUnique<SystemTrayController>()),
266 system_tray_notifier_(base::MakeUnique<SystemTrayNotifier>()), 271 system_tray_notifier_(base::MakeUnique<SystemTrayNotifier>()),
267 vpn_list_(base::MakeUnique<VpnList>()), 272 vpn_list_(base::MakeUnique<VpnList>()),
268 wallpaper_delegate_(delegate_->CreateWallpaperDelegate()), 273 wallpaper_delegate_(delegate_->CreateWallpaperDelegate()),
269 window_cycle_controller_(base::MakeUnique<WindowCycleController>()), 274 window_cycle_controller_(base::MakeUnique<WindowCycleController>()),
270 window_selector_controller_( 275 window_selector_controller_(
271 base::MakeUnique<WindowSelectorController>()) { 276 base::MakeUnique<WindowSelectorController>()) {
272 session_controller_->AddSessionStateObserver(this);
273 277
274 prefs::mojom::PreferencesManagerPtr pref_manager_ptr; 278 prefs::mojom::PreferencesManagerPtr pref_manager_ptr;
275 // Can be null in tests. 279 // Can be null in tests.
276 if (!delegate_->GetShellConnector()) 280 if (!delegate_->GetShellConnector())
277 return; 281 return;
278 delegate_->GetShellConnector()->BindInterface(prefs::mojom::kServiceName, 282 delegate_->GetShellConnector()->BindInterface(prefs::mojom::kServiceName,
279 &pref_manager_ptr); 283 &pref_manager_ptr);
280 pref_store_ = new preferences::PrefObserverStore(std::move(pref_manager_ptr)); 284 pref_store_ = new preferences::PrefObserverStore(std::move(pref_manager_ptr));
281 } 285 }
282 286
283 WmShell::~WmShell() { 287 WmShell::~WmShell() {}
284 session_controller_->RemoveSessionStateObserver(this);
285 }
286 288
287 WmRootWindowController* WmShell::GetPrimaryRootWindowController() { 289 WmRootWindowController* WmShell::GetPrimaryRootWindowController() {
288 return GetPrimaryRootWindow()->GetRootWindowController(); 290 return GetPrimaryRootWindow()->GetRootWindowController();
289 } 291 }
290 292
291 WmWindow* WmShell::GetRootWindowForNewWindows() { 293 WmWindow* WmShell::GetRootWindowForNewWindows() {
292 if (scoped_root_window_for_new_windows_) 294 if (scoped_root_window_for_new_windows_)
293 return scoped_root_window_for_new_windows_; 295 return scoped_root_window_for_new_windows_;
294 return root_window_for_new_windows_; 296 return root_window_for_new_windows_;
295 } 297 }
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 411
410 void WmShell::DeleteToastManager() { 412 void WmShell::DeleteToastManager() {
411 toast_manager_.reset(); 413 toast_manager_.reset();
412 } 414 }
413 415
414 void WmShell::SetAcceleratorController( 416 void WmShell::SetAcceleratorController(
415 std::unique_ptr<AcceleratorController> accelerator_controller) { 417 std::unique_ptr<AcceleratorController> accelerator_controller) {
416 accelerator_controller_ = std::move(accelerator_controller); 418 accelerator_controller_ = std::move(accelerator_controller);
417 } 419 }
418 420
419 void WmShell::SessionStateChanged(session_manager::SessionState state) {
420 // Create the shelf when a session becomes active. It's safe to do this
421 // multiple times (e.g. initial login vs. multiprofile add session).
422 if (state == session_manager::SessionState::ACTIVE)
423 CreateShelf();
424 }
425
426 } // namespace ash 421 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/wm_shell.h ('k') | ash/mus/test/ash_test_impl_mus.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698