diff options
author | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-17 22:18:50 +0000 |
---|---|---|
committer | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-17 22:18:50 +0000 |
commit | 9521c61f5588480d8cd6134144db7137630f2529 (patch) | |
tree | 74c0458f3d5b3dedfac7baf68b7e440e8bd6b542 /chrome/browser/gtk/extension_shelf_gtk.h | |
parent | 128740bbcd5abb0c75254e6eb57b46192c1f47d1 (diff) | |
download | chromium_src-9521c61f5588480d8cd6134144db7137630f2529.zip chromium_src-9521c61f5588480d8cd6134144db7137630f2529.tar.gz chromium_src-9521c61f5588480d8cd6134144db7137630f2529.tar.bz2 |
Begin work on extension shelf for Linux.
For now it displays only a placeholder text, but knows when to display (it's connected to the ExtensionShelfModel).
TEST=none
http://crbug.com/16759
Review URL: http://codereview.chromium.org/159019
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@21014 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/gtk/extension_shelf_gtk.h')
-rw-r--r-- | chrome/browser/gtk/extension_shelf_gtk.h | 90 |
1 files changed, 90 insertions, 0 deletions
diff --git a/chrome/browser/gtk/extension_shelf_gtk.h b/chrome/browser/gtk/extension_shelf_gtk.h new file mode 100644 index 0000000..849bc90 --- /dev/null +++ b/chrome/browser/gtk/extension_shelf_gtk.h @@ -0,0 +1,90 @@ +// Copyright (c) 2009 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_GTK_EXTENSION_SHELF_GTK_H_ +#define CHROME_BROWSER_GTK_EXTENSION_SHELF_GTK_H_ + +#include <gtk/gtk.h> + +#include "base/scoped_ptr.h" +#include "chrome/browser/extensions/extension_shelf_model.h" +#include "chrome/common/notification_observer.h" +#include "chrome/common/notification_registrar.h" +#include "chrome/common/owned_widget_gtk.h" + +class Browser; +class BrowserWindowGtk; +class CustomContainerButton; +class NineBox; +class Profile; +struct GtkThemeProvider; + +class ExtensionShelfGtk : public ExtensionShelfModelObserver, + public NotificationObserver { + public: + ExtensionShelfGtk(Profile* profile, Browser* browser); + virtual ~ExtensionShelfGtk(); + + // Adds this GTK shelf into a sizing box. + void AddShelfToBox(GtkWidget* box); + + // Change the visibility of the bookmarks bar. (Starts out hidden, per GTK's + // default behaviour). + void Show(); + void Hide(); + + // ExtensionShelfModelObserver + virtual void ToolstripInsertedAt(ExtensionHost* toolstrip, int index); + virtual void ToolstripRemovingAt(ExtensionHost* toolstrip, int index); + virtual void ToolstripMoved(ExtensionHost* toolstrip, + int from_index, + int to_index); + virtual void ToolstripChangedAt(ExtensionHost* toolstrip, int index); + virtual void ExtensionShelfEmpty(); + virtual void ShelfModelReloaded(); + + private: + // Create the contents of the extension shelf. + void Init(Profile* profile); + + // Overridden from NotificationObserver: + virtual void Observe(NotificationType type, + const NotificationSource& source, + const NotificationDetails& details); + + // Loads the background image into memory, or does nothing if already loaded. + void InitBackground(); + + // Determines what is our target height and sets it. + void AdjustHeight(); + + // GtkHBox callbacks. + static gboolean OnHBoxExpose(GtkWidget* widget, GdkEventExpose* event, + ExtensionShelfGtk* window); + + Browser* browser_; + + // Contains |shelf_hbox_|. Event box exists to prevent leakage of + // background color from the toplevel application window's GDK window. + OwnedWidgetGtk event_box_; + + // Used to position all children. + GtkWidget* shelf_hbox_; + + // Label for placeholder text. + // TODO(phajdan.jr): Remove the placeholder label when we have real contents. + GtkWidget* label_; + + GtkThemeProvider* theme_provider_; + + // Paints the background for our bookmark bar. + scoped_ptr<NineBox> background_ninebox_; + + NotificationRegistrar registrar_; + + // The model representing the toolstrips on the shelf. + scoped_ptr<ExtensionShelfModel> model_; +}; + +#endif // CHROME_BROWSER_EXTENSION_SHELF_GTK_H_ |