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

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

Issue 2573703003: chromeos: Fix shelf appearing at login screen under mash (Closed)
Patch Set: rebase on session change, fix tests Created 4 years 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 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 #ifndef ASH_COMMON_WM_SHELL_H_ 5 #ifndef ASH_COMMON_WM_SHELL_H_
6 #define ASH_COMMON_WM_SHELL_H_ 6 #define ASH_COMMON_WM_SHELL_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
11 #include <vector> 11 #include <vector>
12 12
13 #include "ash/ash_export.h" 13 #include "ash/ash_export.h"
14 #include "ash/common/metrics/gesture_action_type.h" 14 #include "ash/common/metrics/gesture_action_type.h"
15 #include "ash/common/metrics/user_metrics_action.h" 15 #include "ash/common/metrics/user_metrics_action.h"
16 #include "ash/common/session/session_state_observer.h"
16 #include "ash/common/wm/lock_state_observer.h" 17 #include "ash/common/wm/lock_state_observer.h"
17 #include "base/observer_list.h" 18 #include "base/observer_list.h"
18 #include "components/ui_devtools/devtools_server.h" 19 #include "components/ui_devtools/devtools_server.h"
19 #include "ui/base/ui_base_types.h" 20 #include "ui/base/ui_base_types.h"
20 #include "ui/compositor/layer_type.h" 21 #include "ui/compositor/layer_type.h"
21 #include "ui/wm/public/window_types.h" 22 #include "ui/wm/public/window_types.h"
22 23
23 namespace app_list { 24 namespace app_list {
24 class AppList; 25 class AppList;
25 } 26 }
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 class MaximizeModeEventHandler; 94 class MaximizeModeEventHandler;
94 class WindowState; 95 class WindowState;
95 } 96 }
96 97
97 #if defined(OS_CHROMEOS) 98 #if defined(OS_CHROMEOS)
98 class LogoutConfirmationController; 99 class LogoutConfirmationController;
99 class VpnList; 100 class VpnList;
100 #endif 101 #endif
101 102
102 // Similar to ash::Shell. Eventually the two will be merged. 103 // Similar to ash::Shell. Eventually the two will be merged.
103 class ASH_EXPORT WmShell { 104 class ASH_EXPORT WmShell : public SessionStateObserver {
msw 2016/12/16 16:26:20 Hmm, this is a little unfortunate; how tough would
James Cook 2016/12/20 04:02:42 I don't have an elegant way to get rid of this. I
msw 2016/12/20 15:37:30 I guess it's okay for the shell to observe session
James Cook 2016/12/20 17:27:18 Per offline discussion, keeping as-is. We also mi
104 public: 105 public:
105 // This is necessary for a handful of places that is difficult to plumb 106 // This is necessary for a handful of places that is difficult to plumb
106 // through context. 107 // through context.
107 static void Set(WmShell* instance); 108 static void Set(WmShell* instance);
108 static WmShell* Get(); 109 static WmShell* Get();
109 static bool HasInstance() { return instance_ != nullptr; } 110 static bool HasInstance() { return instance_ != nullptr; }
110 111
111 void Initialize(const scoped_refptr<base::SequencedWorkerPool>& pool); 112 void Initialize(const scoped_refptr<base::SequencedWorkerPool>& pool);
112 virtual void Shutdown(); 113 virtual void Shutdown();
113 114
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 CreateScopedDisableInternalMouseAndKeyboard() = 0; 337 CreateScopedDisableInternalMouseAndKeyboard() = 0;
337 338
338 virtual std::unique_ptr<ImmersiveFullscreenController> 339 virtual std::unique_ptr<ImmersiveFullscreenController>
339 CreateImmersiveFullscreenController() = 0; 340 CreateImmersiveFullscreenController() = 0;
340 341
341 virtual std::unique_ptr<KeyEventWatcher> CreateKeyEventWatcher() = 0; 342 virtual std::unique_ptr<KeyEventWatcher> CreateKeyEventWatcher() = 0;
342 343
343 // Initializes the appropriate shelves. Does nothing for any existing shelves. 344 // Initializes the appropriate shelves. Does nothing for any existing shelves.
344 void CreateShelf(); 345 void CreateShelf();
345 346
346 // Show shelf view if it was created hidden (before session has started).
347 void ShowShelf();
348
349 void CreateShelfDelegate(); 347 void CreateShelfDelegate();
350 348
351 // Called after maximize mode has started, windows might still animate though. 349 // Called after maximize mode has started, windows might still animate though.
352 void OnMaximizeModeStarted(); 350 void OnMaximizeModeStarted();
353 351
354 // Called after maximize mode has ended, windows might still be returning to 352 // Called after maximize mode has ended, windows might still be returning to
355 // their original position. 353 // their original position.
356 void OnMaximizeModeEnded(); 354 void OnMaximizeModeEnded();
357 355
358 // Called when the overview mode is about to be started (before the windows 356 // Called when the overview mode is about to be started (before the windows
359 // get re-arranged). 357 // get re-arranged).
360 virtual void OnOverviewModeStarting() = 0; 358 virtual void OnOverviewModeStarting() = 0;
361 359
362 // Called after overview mode has ended. 360 // Called after overview mode has ended.
363 virtual void OnOverviewModeEnded() = 0; 361 virtual void OnOverviewModeEnded() = 0;
364 362
363 // Called after the initial user logs in and again after each additional user
364 // is added to the session. See session_manager::SessionState::ACTIVE.
365 virtual void OnUserSessionStateActive() = 0;
msw 2016/12/16 16:26:20 This is a bit odd; if we do indeed keep WmShell as
James Cook 2016/12/20 04:02:43 Removed.
366
365 // Called when the login status changes. 367 // Called when the login status changes.
366 // TODO(oshima): Investigate if we can merge this and |OnLoginStateChanged|. 368 // TODO(oshima): Investigate if we can merge this and |OnLoginStateChanged|.
367 void UpdateAfterLoginStatusChange(LoginStatus status); 369 void UpdateAfterLoginStatusChange(LoginStatus status);
368 370
369 // Notify observers that fullscreen mode has changed for |root_window|. 371 // Notify observers that fullscreen mode has changed for |root_window|.
370 void NotifyFullscreenStateChanged(bool is_fullscreen, WmWindow* root_window); 372 void NotifyFullscreenStateChanged(bool is_fullscreen, WmWindow* root_window);
371 373
372 // Notify observers that |pinned_window| changed its pinned window state. 374 // Notify observers that |pinned_window| changed its pinned window state.
373 void NotifyPinnedStateChanged(WmWindow* pinned_window); 375 void NotifyPinnedStateChanged(WmWindow* pinned_window);
374 376
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 441
440 // TODO(jamescook): Remove this when VirtualKeyboardController has been moved. 442 // TODO(jamescook): Remove this when VirtualKeyboardController has been moved.
441 virtual void ToggleIgnoreExternalKeyboard() = 0; 443 virtual void ToggleIgnoreExternalKeyboard() = 0;
442 444
443 // Enable or disable the laser pointer. 445 // Enable or disable the laser pointer.
444 virtual void SetLaserPointerEnabled(bool enabled) = 0; 446 virtual void SetLaserPointerEnabled(bool enabled) = 0;
445 #endif 447 #endif
446 448
447 protected: 449 protected:
448 explicit WmShell(std::unique_ptr<ShellDelegate> shell_delegate); 450 explicit WmShell(std::unique_ptr<ShellDelegate> shell_delegate);
449 virtual ~WmShell(); 451 ~WmShell() override;
450 452
451 base::ObserverList<ShellObserver>* shell_observers() { 453 base::ObserverList<ShellObserver>* shell_observers() {
452 return &shell_observers_; 454 return &shell_observers_;
453 } 455 }
454 456
455 void SetKeyboardUI(std::unique_ptr<KeyboardUI> keyboard_ui); 457 void SetKeyboardUI(std::unique_ptr<KeyboardUI> keyboard_ui);
456 458
457 // Helpers to set (and initialize) or destroy various delegates. 459 // Helpers to set (and initialize) or destroy various delegates.
458 // TODO(msw|jamescook): Remove these once ShellDelegate, etc. are ported. 460 // TODO(msw|jamescook): Remove these once ShellDelegate, etc. are ported.
459 void SetSystemTrayDelegate(std::unique_ptr<SystemTrayDelegate> delegate); 461 void SetSystemTrayDelegate(std::unique_ptr<SystemTrayDelegate> delegate);
(...skipping 13 matching lines...) Expand all
473 475
474 void SetAcceleratorController( 476 void SetAcceleratorController(
475 std::unique_ptr<AcceleratorController> accelerator_controller); 477 std::unique_ptr<AcceleratorController> accelerator_controller);
476 478
477 private: 479 private:
478 friend class AcceleratorControllerTest; 480 friend class AcceleratorControllerTest;
479 friend class ScopedRootWindowForNewWindows; 481 friend class ScopedRootWindowForNewWindows;
480 friend class Shell; 482 friend class Shell;
481 friend class WmShellTestApi; 483 friend class WmShellTestApi;
482 484
485 // SessionStateObserver:
486 void SessionStateChanged(session_manager::SessionState state) override;
487
483 static WmShell* instance_; 488 static WmShell* instance_;
484 489
485 base::ObserverList<ShellObserver> shell_observers_; 490 base::ObserverList<ShellObserver> shell_observers_;
486 std::unique_ptr<ShellDelegate> delegate_; 491 std::unique_ptr<ShellDelegate> delegate_;
487 492
488 std::unique_ptr<AcceleratorController> accelerator_controller_; 493 std::unique_ptr<AcceleratorController> accelerator_controller_;
489 std::unique_ptr<AccessibilityDelegate> accessibility_delegate_; 494 std::unique_ptr<AccessibilityDelegate> accessibility_delegate_;
490 std::unique_ptr<app_list::AppList> app_list_; 495 std::unique_ptr<app_list::AppList> app_list_;
491 std::unique_ptr<BrightnessControlDelegate> brightness_control_delegate_; 496 std::unique_ptr<BrightnessControlDelegate> brightness_control_delegate_;
492 std::unique_ptr<CastConfigController> cast_config_; 497 std::unique_ptr<CastConfigController> cast_config_;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 533
529 #if defined(OS_CHROMEOS) 534 #if defined(OS_CHROMEOS)
530 std::unique_ptr<LogoutConfirmationController> logout_confirmation_controller_; 535 std::unique_ptr<LogoutConfirmationController> logout_confirmation_controller_;
531 std::unique_ptr<VpnList> vpn_list_; 536 std::unique_ptr<VpnList> vpn_list_;
532 #endif 537 #endif
533 }; 538 };
534 539
535 } // namespace ash 540 } // namespace ash
536 541
537 #endif // ASH_COMMON_WM_SHELL_H_ 542 #endif // ASH_COMMON_WM_SHELL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698