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

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: 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 ShellObserver; 24 class ShellObserver;
25 class SystemTrayDelegate;
25 class WindowResizer; 26 class WindowResizer;
26 class WmActivationObserver; 27 class WmActivationObserver;
27 class WmDisplayObserver; 28 class WmDisplayObserver;
28 class WmWindow; 29 class WmWindow;
29 30
30 namespace wm { 31 namespace wm {
31 32
32 class WindowState; 33 class WindowState;
33 34
34 enum class WmUserMetricsAction; 35 enum class WmUserMetricsAction;
35 } 36 }
36 37
37 // Similar to ash::Shell. Eventually the two will be merged. 38 // Similar to ash::Shell. Eventually the two will be merged.
38 class ASH_EXPORT WmShell { 39 class ASH_EXPORT WmShell {
39 public: 40 public:
40 // This is necessary for a handful of places that is difficult to plumb 41 // This is necessary for a handful of places that is difficult to plumb
41 // through context. 42 // through context.
42 static void Set(WmShell* instance); 43 static void Set(WmShell* instance);
43 static WmShell* Get(); 44 static WmShell* Get();
44 static bool HasInstance() { return instance_ != nullptr; } 45 static bool HasInstance() { return instance_ != nullptr; }
45 46
47 SystemTrayDelegate* system_tray_delegate() {
48 return system_tray_delegate_.get();
49 }
50
46 virtual MruWindowTracker* GetMruWindowTracker() = 0; 51 virtual MruWindowTracker* GetMruWindowTracker() = 0;
47 52
48 // Creates a new window used as a container of other windows. No painting is 53 // Creates a new window used as a container of other windows. No painting is
49 // done to the created window. 54 // done to the created window.
50 virtual WmWindow* NewContainerWindow() = 0; 55 virtual WmWindow* NewContainerWindow() = 0;
51 56
52 virtual WmWindow* GetFocusedWindow() = 0; 57 virtual WmWindow* GetFocusedWindow() = 0;
53 virtual WmWindow* GetActiveWindow() = 0; 58 virtual WmWindow* GetActiveWindow() = 0;
54 59
55 virtual WmWindow* GetPrimaryRootWindow() = 0; 60 virtual WmWindow* GetPrimaryRootWindow() = 0;
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 virtual void AddActivationObserver(WmActivationObserver* observer) = 0; 113 virtual void AddActivationObserver(WmActivationObserver* observer) = 0;
109 virtual void RemoveActivationObserver(WmActivationObserver* observer) = 0; 114 virtual void RemoveActivationObserver(WmActivationObserver* observer) = 0;
110 115
111 virtual void AddDisplayObserver(WmDisplayObserver* observer) = 0; 116 virtual void AddDisplayObserver(WmDisplayObserver* observer) = 0;
112 virtual void RemoveDisplayObserver(WmDisplayObserver* observer) = 0; 117 virtual void RemoveDisplayObserver(WmDisplayObserver* observer) = 0;
113 118
114 virtual void AddShellObserver(ShellObserver* observer) = 0; 119 virtual void AddShellObserver(ShellObserver* observer) = 0;
115 virtual void RemoveShellObserver(ShellObserver* observer) = 0; 120 virtual void RemoveShellObserver(ShellObserver* observer) = 0;
116 121
117 protected: 122 protected:
118 virtual ~WmShell() {} 123 WmShell();
124 virtual ~WmShell();
125
126 void SetSystemTrayDelegate(std::unique_ptr<SystemTrayDelegate> delegate);
119 127
120 private: 128 private:
129 friend class Shell;
130
121 static WmShell* instance_; 131 static WmShell* instance_;
132
133 std::unique_ptr<SystemTrayDelegate> system_tray_delegate_;
122 }; 134 };
123 135
124 } // namespace ash 136 } // namespace ash
125 137
126 #endif // ASH_COMMON_WM_SHELL_H_ 138 #endif // ASH_COMMON_WM_SHELL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698