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 { |
| 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 |
| 32 // Gets the atom for the default display for the propert this class is |
| 33 // watching for. |
| 34 static Atom GetPropertyAtom(); |
| 35 |
| 36 // Notify observers that the work area has changed. |
| 37 static void Notify(); |
| 38 |
| 39 private: |
| 40 friend struct DefaultSingletonTraits<WorkAreaWatcherX>; |
| 41 |
| 42 WorkAreaWatcherX(); |
| 43 ~WorkAreaWatcherX(); |
| 44 void NotifyWorkAreaChanged(); |
| 45 |
| 46 ObserverList<Observer> observers_; |
| 47 |
| 48 DISALLOW_COPY_AND_ASSIGN(WorkAreaWatcherX); |
| 49 }; |
| 50 |
| 51 } // namespace ui |
| 52 |
| 53 #endif // UI_BASE_X_WORK_AREA_WATCHER_X_H_ |
OLD | NEW |