OLD | NEW |
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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 | 95 |
95 enum class LoginStatus; | 96 enum class LoginStatus; |
96 enum class TaskSwitchSource; | 97 enum class TaskSwitchSource; |
97 | 98 |
98 namespace wm { | 99 namespace wm { |
99 class MaximizeModeEventHandler; | 100 class MaximizeModeEventHandler; |
100 class WindowState; | 101 class WindowState; |
101 } | 102 } |
102 | 103 |
103 // Similar to ash::Shell. Eventually the two will be merged. | 104 // Similar to ash::Shell. Eventually the two will be merged. |
104 class ASH_EXPORT WmShell { | 105 class ASH_EXPORT WmShell : public SessionStateObserver { |
105 public: | 106 public: |
106 // This is necessary for a handful of places that is difficult to plumb | 107 // This is necessary for a handful of places that is difficult to plumb |
107 // through context. | 108 // through context. |
108 static void Set(WmShell* instance); | 109 static void Set(WmShell* instance); |
109 static WmShell* Get(); | 110 static WmShell* Get(); |
110 static bool HasInstance() { return instance_ != nullptr; } | 111 static bool HasInstance() { return instance_ != nullptr; } |
111 | 112 |
112 void Initialize(const scoped_refptr<base::SequencedWorkerPool>& pool); | 113 void Initialize(const scoped_refptr<base::SequencedWorkerPool>& pool); |
113 virtual void Shutdown(); | 114 virtual void Shutdown(); |
114 | 115 |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
346 WmWindow* workspace_window) = 0; | 347 WmWindow* workspace_window) = 0; |
347 | 348 |
348 virtual std::unique_ptr<ScopedDisableInternalMouseAndKeyboard> | 349 virtual std::unique_ptr<ScopedDisableInternalMouseAndKeyboard> |
349 CreateScopedDisableInternalMouseAndKeyboard() = 0; | 350 CreateScopedDisableInternalMouseAndKeyboard() = 0; |
350 | 351 |
351 virtual std::unique_ptr<ImmersiveFullscreenController> | 352 virtual std::unique_ptr<ImmersiveFullscreenController> |
352 CreateImmersiveFullscreenController() = 0; | 353 CreateImmersiveFullscreenController() = 0; |
353 | 354 |
354 virtual std::unique_ptr<KeyEventWatcher> CreateKeyEventWatcher() = 0; | 355 virtual std::unique_ptr<KeyEventWatcher> CreateKeyEventWatcher() = 0; |
355 | 356 |
356 // Initializes the appropriate shelves. Does nothing for any existing shelves. | 357 // Creates the ShelfView for each display and populates it with items. |
| 358 // TODO(jamescook): Rename this. http://crbug.com/679925 |
357 void CreateShelf(); | 359 void CreateShelf(); |
358 | 360 |
359 // Show shelf view if it was created hidden (before session has started). | |
360 void ShowShelf(); | |
361 | |
362 void CreateShelfDelegate(); | 361 void CreateShelfDelegate(); |
363 | 362 |
364 // Called after maximize mode has started, windows might still animate though. | 363 // Called after maximize mode has started, windows might still animate though. |
365 void OnMaximizeModeStarted(); | 364 void OnMaximizeModeStarted(); |
366 | 365 |
367 // Called after maximize mode has ended, windows might still be returning to | 366 // Called after maximize mode has ended, windows might still be returning to |
368 // their original position. | 367 // their original position. |
369 void OnMaximizeModeEnded(); | 368 void OnMaximizeModeEnded(); |
370 | 369 |
371 // Called when the overview mode is about to be started (before the windows | 370 // Called when the overview mode is about to be started (before the windows |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
440 virtual bool IsTouchDown() = 0; | 439 virtual bool IsTouchDown() = 0; |
441 | 440 |
442 // TODO(jamescook): Remove this when VirtualKeyboardController has been moved. | 441 // TODO(jamescook): Remove this when VirtualKeyboardController has been moved. |
443 virtual void ToggleIgnoreExternalKeyboard() = 0; | 442 virtual void ToggleIgnoreExternalKeyboard() = 0; |
444 | 443 |
445 // Enable or disable the laser pointer. | 444 // Enable or disable the laser pointer. |
446 virtual void SetLaserPointerEnabled(bool enabled) = 0; | 445 virtual void SetLaserPointerEnabled(bool enabled) = 0; |
447 | 446 |
448 protected: | 447 protected: |
449 explicit WmShell(std::unique_ptr<ShellDelegate> shell_delegate); | 448 explicit WmShell(std::unique_ptr<ShellDelegate> shell_delegate); |
450 virtual ~WmShell(); | 449 ~WmShell() override; |
451 | 450 |
452 base::ObserverList<ShellObserver>* shell_observers() { | 451 base::ObserverList<ShellObserver>* shell_observers() { |
453 return &shell_observers_; | 452 return &shell_observers_; |
454 } | 453 } |
455 | 454 |
456 void SetKeyboardUI(std::unique_ptr<KeyboardUI> keyboard_ui); | 455 void SetKeyboardUI(std::unique_ptr<KeyboardUI> keyboard_ui); |
457 | 456 |
458 // Helpers to set (and initialize) or destroy various delegates. | 457 // Helpers to set (and initialize) or destroy various delegates. |
459 // TODO(msw|jamescook): Remove these once ShellDelegate, etc. are ported. | 458 // TODO(msw|jamescook): Remove these once ShellDelegate, etc. are ported. |
460 void SetSystemTrayDelegate(std::unique_ptr<SystemTrayDelegate> delegate); | 459 void SetSystemTrayDelegate(std::unique_ptr<SystemTrayDelegate> delegate); |
461 void DeleteSystemTrayDelegate(); | 460 void DeleteSystemTrayDelegate(); |
462 | 461 |
463 void DeleteWindowCycleController(); | 462 void DeleteWindowCycleController(); |
464 | 463 |
465 void DeleteWindowSelectorController(); | 464 void DeleteWindowSelectorController(); |
466 | 465 |
467 void CreateMaximizeModeController(); | 466 void CreateMaximizeModeController(); |
468 void DeleteMaximizeModeController(); | 467 void DeleteMaximizeModeController(); |
469 | 468 |
470 void CreateMruWindowTracker(); | 469 void CreateMruWindowTracker(); |
471 void DeleteMruWindowTracker(); | 470 void DeleteMruWindowTracker(); |
472 | 471 |
473 void DeleteToastManager(); | 472 void DeleteToastManager(); |
474 | 473 |
475 void SetAcceleratorController( | 474 void SetAcceleratorController( |
476 std::unique_ptr<AcceleratorController> accelerator_controller); | 475 std::unique_ptr<AcceleratorController> accelerator_controller); |
477 | 476 |
| 477 // SessionStateObserver: |
| 478 void SessionStateChanged(session_manager::SessionState state) override; |
| 479 |
478 private: | 480 private: |
479 friend class AcceleratorControllerTest; | 481 friend class AcceleratorControllerTest; |
480 friend class ScopedRootWindowForNewWindows; | 482 friend class ScopedRootWindowForNewWindows; |
481 friend class Shell; | 483 friend class Shell; |
482 friend class WmShellTestApi; | 484 friend class WmShellTestApi; |
483 | 485 |
484 static WmShell* instance_; | 486 static WmShell* instance_; |
485 | 487 |
486 base::ObserverList<ShellObserver> shell_observers_; | 488 base::ObserverList<ShellObserver> shell_observers_; |
487 std::unique_ptr<ShellDelegate> delegate_; | 489 std::unique_ptr<ShellDelegate> delegate_; |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
528 WmWindow* scoped_root_window_for_new_windows_ = nullptr; | 530 WmWindow* scoped_root_window_for_new_windows_ = nullptr; |
529 | 531 |
530 bool simulate_modal_window_open_for_testing_ = false; | 532 bool simulate_modal_window_open_for_testing_ = false; |
531 | 533 |
532 scoped_refptr<base::SequencedWorkerPool> blocking_pool_; | 534 scoped_refptr<base::SequencedWorkerPool> blocking_pool_; |
533 }; | 535 }; |
534 | 536 |
535 } // namespace ash | 537 } // namespace ash |
536 | 538 |
537 #endif // ASH_COMMON_WM_SHELL_H_ | 539 #endif // ASH_COMMON_WM_SHELL_H_ |
OLD | NEW |