| 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
|
|
|
|
|