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

Unified Diff: chrome/browser/ui/gtk/titlebar_listener.h

Issue 11338028: Add support for XFWM titlebar buttons. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/gtk/titlebar_listener.h
===================================================================
--- chrome/browser/ui/gtk/titlebar_listener.h (revision 0)
+++ chrome/browser/ui/gtk/titlebar_listener.h (revision 0)
@@ -0,0 +1,71 @@
+// Copyright (c) 2012 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 CHROME_BROWSER_UI_GTK_TITLEBAR_LISTENER_H_
+#define CHROME_BROWSER_UI_GTK_TITLEBAR_LISTENER_H_
+
+#include <set>
+#include <string>
+
+#include "base/basictypes.h"
+#include "base/memory/ref_counted.h"
+
+class BrowserTitlebar;
+template <typename T> struct DefaultSingletonTraits;
+
+// Meant to be used as a Singleton through base/memory/singleton.h's interface.
+class TitlebarListener {
+ public:
+ // Class to handle window manager specific changes to the button order.
+ class Delegate : public base::RefCountedThreadSafe<Delegate> {
+ public:
+ // Do all necessary initialization here. If initialization succeeds,
+ // return true. Otherwise return false and TitlebarListener will try a
+ // different Delegate if one is available and applicable.
+ virtual bool Init() = 0;
+
+ // Returns the current button order.
+ virtual std::string GetCurrentValue() = 0;
+
+ protected:
+ virtual ~Delegate() {}
+
+ private:
+ friend class base::RefCountedThreadSafe<Delegate>;
+ };
+
+ // Returns the singleton instance.
+ static TitlebarListener* GetInstance();
+
+ // Sets the current titlebar button order. Also subscribes to further
+ // notifications when the titlebar button order changes on supported
+ // desktop environments.
+ void SetTitlebarButtons(BrowserTitlebar* titlebar);
+
+ // Removes |titlebar| from the list of objects observing button order change
+ // notifications.
+ void RemoveObserver(BrowserTitlebar* titlebar);
+
+ // Sets all title bars that have subscribed to updates to |title_value|.
+ void SetTitleBars(const std::string& title_value);
+
+ protected:
+ ~TitlebarListener();
+
+ private:
+ friend struct DefaultSingletonTraits<TitlebarListener>;
+
+ // Private constructor to enforce singleton access.
+ TitlebarListener();
+
+ // The window manager specific delagate.
+ scoped_refptr<Delegate> delegate_;
+
+ // BrowserTitlebar objects which have subscribed to updates.
+ std::set<BrowserTitlebar*> titlebars_;
+
+ DISALLOW_COPY_AND_ASSIGN(TitlebarListener);
+};
+
+#endif // CHROME_BROWSER_UI_GTK_TITLEBAR_LISTENER_H_
Property changes on: chrome/browser/ui/gtk/titlebar_listener.h
___________________________________________________________________
Added: svn:eol-style
+ LF

Powered by Google App Engine
This is Rietveld 408576698