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

Side by Side Diff: chrome/browser/gtk/extension_shelf_gtk.h

Issue 155957: Populate the Linux extension shelf with placeholder labels containing each extension's name. (Closed)
Patch Set: Created 11 years, 5 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/gtk/extension_shelf_gtk.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_GTK_EXTENSION_SHELF_GTK_H_ 5 #ifndef CHROME_BROWSER_GTK_EXTENSION_SHELF_GTK_H_
6 #define CHROME_BROWSER_GTK_EXTENSION_SHELF_GTK_H_ 6 #define CHROME_BROWSER_GTK_EXTENSION_SHELF_GTK_H_
7 7
8 #include <gtk/gtk.h> 8 #include <gtk/gtk.h>
9 9
10 #include <set>
11
10 #include "base/scoped_ptr.h" 12 #include "base/scoped_ptr.h"
11 #include "chrome/browser/extensions/extension_shelf_model.h" 13 #include "chrome/browser/extensions/extension_shelf_model.h"
12 #include "chrome/common/notification_observer.h" 14 #include "chrome/common/notification_observer.h"
13 #include "chrome/common/notification_registrar.h" 15 #include "chrome/common/notification_registrar.h"
14 #include "chrome/common/owned_widget_gtk.h" 16 #include "chrome/common/owned_widget_gtk.h"
15 17
16 class Browser; 18 class Browser;
17 class BrowserWindowGtk; 19 class BrowserWindowGtk;
18 class CustomContainerButton; 20 class CustomContainerButton;
19 class NineBox; 21 class NineBox;
20 class Profile; 22 class Profile;
21 struct GtkThemeProvider; 23 struct GtkThemeProvider;
22 24
23 class ExtensionShelfGtk : public ExtensionShelfModelObserver, 25 class ExtensionShelfGtk : public ExtensionShelfModelObserver,
24 public NotificationObserver { 26 public NotificationObserver {
25 public: 27 public:
26 ExtensionShelfGtk(Profile* profile, Browser* browser); 28 ExtensionShelfGtk(Profile* profile, Browser* browser);
27 virtual ~ExtensionShelfGtk(); 29 virtual ~ExtensionShelfGtk();
28 30
29 // Adds this GTK shelf into a sizing box. 31 // Adds this GTK shelf into a sizing box.
30 void AddShelfToBox(GtkWidget* box); 32 void AddShelfToBox(GtkWidget* box);
31 33
32 // Change the visibility of the bookmarks bar. (Starts out hidden, per GTK's 34 // Change the visibility of the bookmarks bar. (Starts out hidden, per GTK's
33 // default behaviour). 35 // default behaviour).
34 void Show(); 36 void Show();
35 void Hide(); 37 void Hide();
36 38
37 // ExtensionShelfModelObserver 39 // ExtensionShelfModelObserver
38 virtual void ToolstripInsertedAt(ExtensionHost* toolstrip, int index); 40 virtual void ToolstripInsertedAt(ExtensionHost* host, int index);
39 virtual void ToolstripRemovingAt(ExtensionHost* toolstrip, int index); 41 virtual void ToolstripRemovingAt(ExtensionHost* host, int index);
40 virtual void ToolstripMoved(ExtensionHost* toolstrip, 42 virtual void ToolstripMoved(ExtensionHost* host,
41 int from_index, 43 int from_index,
42 int to_index); 44 int to_index);
43 virtual void ToolstripChangedAt(ExtensionHost* toolstrip, int index); 45 virtual void ToolstripChangedAt(ExtensionHost* host, int index);
44 virtual void ExtensionShelfEmpty(); 46 virtual void ExtensionShelfEmpty();
45 virtual void ShelfModelReloaded(); 47 virtual void ShelfModelReloaded();
46 48
47 private: 49 private:
50 class Toolstrip;
51
48 // Create the contents of the extension shelf. 52 // Create the contents of the extension shelf.
49 void Init(Profile* profile); 53 void Init(Profile* profile);
50 54
51 // Overridden from NotificationObserver: 55 // Overridden from NotificationObserver:
52 virtual void Observe(NotificationType type, 56 virtual void Observe(NotificationType type,
53 const NotificationSource& source, 57 const NotificationSource& source,
54 const NotificationDetails& details); 58 const NotificationDetails& details);
55 59
56 // Loads the background image into memory, or does nothing if already loaded. 60 // Loads the background image into memory, or does nothing if already loaded.
57 void InitBackground(); 61 void InitBackground();
58 62
59 // Determines what is our target height and sets it. 63 // Determines what is our target height and sets it.
60 void AdjustHeight(); 64 void AdjustHeight();
61 65
66 void LoadFromModel();
67
68 Toolstrip* ToolstripAtIndex(int index);
69
62 // GtkHBox callbacks. 70 // GtkHBox callbacks.
63 static gboolean OnHBoxExpose(GtkWidget* widget, GdkEventExpose* event, 71 static gboolean OnHBoxExpose(GtkWidget* widget, GdkEventExpose* event,
64 ExtensionShelfGtk* window); 72 ExtensionShelfGtk* window);
65 73
66 Browser* browser_; 74 Browser* browser_;
67 75
68 // Contains |shelf_hbox_|. Event box exists to prevent leakage of 76 // Contains |shelf_hbox_|. Event box exists to prevent leakage of
69 // background color from the toplevel application window's GDK window. 77 // background color from the toplevel application window's GDK window.
70 OwnedWidgetGtk event_box_; 78 OwnedWidgetGtk event_box_;
71 79
72 // Used to position all children. 80 // Used to position all children.
73 GtkWidget* shelf_hbox_; 81 GtkWidget* shelf_hbox_;
74 82
75 // Label for placeholder text.
76 // TODO(phajdan.jr): Remove the placeholder label when we have real contents.
77 GtkWidget* label_;
78
79 GtkThemeProvider* theme_provider_; 83 GtkThemeProvider* theme_provider_;
80 84
81 // Paints the background for our bookmark bar. 85 // Paints the background for our bookmark bar.
82 scoped_ptr<NineBox> background_ninebox_; 86 scoped_ptr<NineBox> background_ninebox_;
83 87
84 NotificationRegistrar registrar_; 88 NotificationRegistrar registrar_;
85 89
86 // The model representing the toolstrips on the shelf. 90 // The model representing the toolstrips on the shelf.
87 scoped_ptr<ExtensionShelfModel> model_; 91 scoped_ptr<ExtensionShelfModel> model_;
92
93 // Set of toolstrip views which are really on the shelf.
94 std::set<Toolstrip*> toolstrips_;
95
96 DISALLOW_COPY_AND_ASSIGN(ExtensionShelfGtk);
88 }; 97 };
89 98
90 #endif // CHROME_BROWSER_EXTENSION_SHELF_GTK_H_ 99 #endif // CHROME_BROWSER_EXTENSION_SHELF_GTK_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/gtk/extension_shelf_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698