OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef UI_BASE_X_WORK_AREA_WATCHER_X_H_ | |
6 #define UI_BASE_X_WORK_AREA_WATCHER_X_H_ | |
7 #pragma once | |
8 | |
9 #include "base/memory/singleton.h" | |
10 #include "base/observer_list.h" | |
11 #include "ui/base/ui_export.h" | |
12 #include "ui/base/x/x11_util.h" | |
13 | |
14 namespace ui { | |
15 | |
16 // This is a helper class that is used to keep track of changes to work area. | |
17 // Add an observer to track changes. | |
18 class UI_EXPORT WorkAreaWatcherX { | |
19 public: | |
20 class Observer { | |
sky
2011/11/18 17:54:22
Move this into it's own header.
prasadt
2011/11/18 22:31:42
I see nested classes being in the same header as a
sky
2011/11/18 22:44:58
From the style guide: 'Prefer putting delegate cla
prasadt
2011/11/21 23:36:49
Done.
| |
21 public: | |
22 virtual void WorkAreaChanged() = 0; | |
23 | |
24 protected: | |
25 virtual ~Observer() {} | |
26 }; | |
27 | |
28 static WorkAreaWatcherX* GetInstance(); | |
29 static void AddObserver(Observer* observer); | |
30 static void RemoveObserver(Observer* observer); | |
31 static Atom GetPropertyAtom(); | |
32 | |
33 // Sends a notification out through the NotificationService that the work | |
34 // area has changed. | |
35 static void Notify(); | |
36 | |
37 private: | |
38 friend struct DefaultSingletonTraits<WorkAreaWatcherX>; | |
39 | |
40 WorkAreaWatcherX() { } | |
sky
2011/11/18 17:54:22
Don't inline these.
prasadt
2011/11/18 22:31:42
Done.
| |
41 ~WorkAreaWatcherX() { } | |
42 void NotifyWorkAreaChanged(); | |
43 | |
44 ObserverList<Observer> observers_; | |
45 | |
46 DISALLOW_COPY_AND_ASSIGN(WorkAreaWatcherX); | |
47 }; | |
48 | |
49 } // namespace ui | |
50 | |
51 #endif // UI_BASE_X_WORK_AREA_WATCHER_X_H_ | |
OLD | NEW |