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

Unified Diff: ui/base/x/work_area_watcher_x.h

Issue 8595003: Have panels respond to changes in work area on Linux. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Code review feedback. Created 9 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: ui/base/x/work_area_watcher_x.h
diff --git a/ui/base/x/work_area_watcher_x.h b/ui/base/x/work_area_watcher_x.h
new file mode 100644
index 0000000000000000000000000000000000000000..428f851ea6cd153cd62633e33f90add3809820f6
--- /dev/null
+++ b/ui/base/x/work_area_watcher_x.h
@@ -0,0 +1,53 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef UI_BASE_X_WORK_AREA_WATCHER_X_H_
+#define UI_BASE_X_WORK_AREA_WATCHER_X_H_
+#pragma once
+
+#include "base/memory/singleton.h"
+#include "base/observer_list.h"
+#include "ui/base/ui_export.h"
+#include "ui/base/x/x11_util.h"
+
+namespace ui {
+
+// This is a helper class that is used to keep track of changes to work area.
+// Add an observer to track changes.
+class UI_EXPORT WorkAreaWatcherX {
+ public:
+ class Observer {
+ public:
+ virtual void WorkAreaChanged() = 0;
+
+ protected:
+ virtual ~Observer();
+ };
+
+ static WorkAreaWatcherX* GetInstance();
+ static void AddObserver(Observer* observer);
+ static void RemoveObserver(Observer* observer);
+
+ // Gets the atom for the default display for the propert this class is
+ // watching for.
+ static Atom GetPropertyAtom();
+
+ // Notify observers that the work area has changed.
+ static void Notify();
+
+ private:
+ friend struct DefaultSingletonTraits<WorkAreaWatcherX>;
+
+ WorkAreaWatcherX();
+ ~WorkAreaWatcherX();
+ void NotifyWorkAreaChanged();
+
+ ObserverList<Observer> observers_;
+
+ DISALLOW_COPY_AND_ASSIGN(WorkAreaWatcherX);
+};
+
+} // namespace ui
+
+#endif // UI_BASE_X_WORK_AREA_WATCHER_X_H_

Powered by Google App Engine
This is Rietveld 408576698