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 #include "ui/base/x/work_area_watcher_x.h" |
| 6 |
| 7 #include "ui/base/x/root_window_property_watcher_x.h" |
| 8 #include "ui/base/x/x11_util.h" |
| 9 |
| 10 namespace ui { |
| 11 |
| 12 static const char* kNetWorkArea = "_NET_WORKAREA"; |
| 13 |
| 14 // static |
| 15 WorkAreaWatcherX* WorkAreaWatcherX::GetInstance() { |
| 16 return Singleton<WorkAreaWatcherX>::get(); |
| 17 } |
| 18 |
| 19 // static |
| 20 void WorkAreaWatcherX::AddObserver(Observer* observer) { |
| 21 // Ensure that RootWindowPropertyWatcherX exists. |
| 22 RootWindowPropertyWatcherX::GetInstance(); |
| 23 GetInstance()->observers_.AddObserver(observer); |
| 24 } |
| 25 |
| 26 // static |
| 27 void WorkAreaWatcherX::RemoveObserver(Observer* observer) { |
| 28 GetInstance()->observers_.RemoveObserver(observer); |
| 29 } |
| 30 |
| 31 // static |
| 32 void WorkAreaWatcherX::Notify() { |
| 33 GetInstance()->NotifyWorkAreaChanged(); |
| 34 } |
| 35 |
| 36 // static |
| 37 Atom WorkAreaWatcherX::GetPropertyAtom() { |
| 38 return GetAtomForScreenProperty(kNetWorkArea); |
| 39 } |
| 40 |
| 41 void WorkAreaWatcherX::NotifyWorkAreaChanged() { |
| 42 FOR_EACH_OBSERVER(Observer, observers_, WorkAreaChanged()); |
| 43 } |
| 44 |
| 45 } // namespace ui |
OLD | NEW |