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

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

Issue 2058173002: mash: Move SystemTrayDelegate ownership to WmShell (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review feedback Created 4 years, 6 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 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 14
15 namespace gfx { 15 namespace gfx {
16 class Rect; 16 class Rect;
17 } 17 }
18 18
19 namespace ash { 19 namespace ash {
20 20
21 class AccessibilityDelegate; 21 class AccessibilityDelegate;
22 class MruWindowTracker; 22 class MruWindowTracker;
23 class SessionStateDelegate; 23 class SessionStateDelegate;
24 class Shell;
msw 2016/06/10 20:48:10 nit: needed?
24 class ShellObserver; 25 class ShellObserver;
26 class SystemTrayDelegate;
25 class WindowResizer; 27 class WindowResizer;
26 class WmActivationObserver; 28 class WmActivationObserver;
27 class WmDisplayObserver; 29 class WmDisplayObserver;
28 class WmWindow; 30 class WmWindow;
29 31
30 namespace wm { 32 namespace wm {
31 33
32 class WindowState; 34 class WindowState;
33 35
34 enum class WmUserMetricsAction; 36 enum class WmUserMetricsAction;
35 } 37 }
36 38
37 // Similar to ash::Shell. Eventually the two will be merged. 39 // Similar to ash::Shell. Eventually the two will be merged.
38 class ASH_EXPORT WmShell { 40 class ASH_EXPORT WmShell {
39 public: 41 public:
40 // This is necessary for a handful of places that is difficult to plumb 42 // This is necessary for a handful of places that is difficult to plumb
41 // through context. 43 // through context.
42 static void Set(WmShell* instance); 44 static void Set(WmShell* instance);
43 static WmShell* Get(); 45 static WmShell* Get();
44 static bool HasInstance() { return instance_ != nullptr; } 46 static bool HasInstance() { return instance_ != nullptr; }
45 47
48 SystemTrayDelegate* system_tray_delegate() {
49 return system_tray_delegate_.get();
50 }
51
46 virtual MruWindowTracker* GetMruWindowTracker() = 0; 52 virtual MruWindowTracker* GetMruWindowTracker() = 0;
47 53
48 // Creates a new window used as a container of other windows. No painting is 54 // Creates a new window used as a container of other windows. No painting is
49 // done to the created window. 55 // done to the created window.
50 virtual WmWindow* NewContainerWindow() = 0; 56 virtual WmWindow* NewContainerWindow() = 0;
51 57
52 virtual WmWindow* GetFocusedWindow() = 0; 58 virtual WmWindow* GetFocusedWindow() = 0;
53 virtual WmWindow* GetActiveWindow() = 0; 59 virtual WmWindow* GetActiveWindow() = 0;
54 60
55 virtual WmWindow* GetPrimaryRootWindow() = 0; 61 virtual WmWindow* GetPrimaryRootWindow() = 0;
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 virtual void AddActivationObserver(WmActivationObserver* observer) = 0; 114 virtual void AddActivationObserver(WmActivationObserver* observer) = 0;
109 virtual void RemoveActivationObserver(WmActivationObserver* observer) = 0; 115 virtual void RemoveActivationObserver(WmActivationObserver* observer) = 0;
110 116
111 virtual void AddDisplayObserver(WmDisplayObserver* observer) = 0; 117 virtual void AddDisplayObserver(WmDisplayObserver* observer) = 0;
112 virtual void RemoveDisplayObserver(WmDisplayObserver* observer) = 0; 118 virtual void RemoveDisplayObserver(WmDisplayObserver* observer) = 0;
113 119
114 virtual void AddShellObserver(ShellObserver* observer) = 0; 120 virtual void AddShellObserver(ShellObserver* observer) = 0;
115 virtual void RemoveShellObserver(ShellObserver* observer) = 0; 121 virtual void RemoveShellObserver(ShellObserver* observer) = 0;
116 122
117 protected: 123 protected:
118 virtual ~WmShell() {} 124 WmShell();
125 virtual ~WmShell();
126
127 // If |delegate| is not null, sets and initializes the delegate. If |delegate|
128 // is null, shuts down and destroys the delegate.
129 void SetSystemTrayDelegate(std::unique_ptr<SystemTrayDelegate> delegate);
119 130
120 private: 131 private:
132 friend class Shell;
133
121 static WmShell* instance_; 134 static WmShell* instance_;
135
136 std::unique_ptr<SystemTrayDelegate> system_tray_delegate_;
122 }; 137 };
123 138
124 } // namespace ash 139 } // namespace ash
125 140
126 #endif // ASH_COMMON_WM_SHELL_H_ 141 #endif // ASH_COMMON_WM_SHELL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698