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

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

Issue 160025: GTK Themes: Theme the bookmark bubble. (And first run bubble). (Closed)
Patch Set: Remove text_color for estade 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/bookmark_bubble_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 // This is the GTK implementation of the bookmark bubble, the dialog box 5 // This is the GTK implementation of the bookmark bubble, the dialog box
6 // presented to create or edit a bookmark. There can only ever be a single 6 // presented to create or edit a bookmark. There can only ever be a single
7 // bubble open, so the class presents only static methods, and handles the 7 // bubble open, so the class presents only static methods, and handles the
8 // singleton behavior for you. It also handles the object and widget 8 // singleton behavior for you. It also handles the object and widget
9 // lifetimes, destroying everything and possibly committing any changes when 9 // lifetimes, destroying everything and possibly committing any changes when
10 // the bubble is closed. 10 // the bubble is closed.
11 11
12 #ifndef CHROME_BROWSER_GTK_BOOKMARK_BUBBLE_GTK_H_ 12 #ifndef CHROME_BROWSER_GTK_BOOKMARK_BUBBLE_GTK_H_
13 #define CHROME_BROWSER_GTK_BOOKMARK_BUBBLE_GTK_H_ 13 #define CHROME_BROWSER_GTK_BOOKMARK_BUBBLE_GTK_H_
14 14
15 #include <gtk/gtk.h> 15 #include <gtk/gtk.h>
16 16
17 #include <string>
17 #include <vector> 18 #include <vector>
18 19
19 #include "base/basictypes.h" 20 #include "base/basictypes.h"
20 #include "base/task.h" 21 #include "base/task.h"
21 #include "chrome/browser/gtk/info_bubble_gtk.h" 22 #include "chrome/browser/gtk/info_bubble_gtk.h"
23 #include "chrome/common/notification_observer.h"
24 #include "chrome/common/notification_registrar.h"
22 #include "googleurl/src/gurl.h" 25 #include "googleurl/src/gurl.h"
23 26
24 class BookmarkNode; 27 class BookmarkNode;
25 class Profile; 28 class Profile;
26 namespace gfx { 29 namespace gfx {
27 class Rect; 30 class Rect;
28 } 31 }
29 32
30 class BookmarkBubbleGtk : public InfoBubbleGtkDelegate { 33 class BookmarkBubbleGtk : public InfoBubbleGtkDelegate,
34 public NotificationObserver {
31 public: 35 public:
32 // Shows the bookmark bubble, pointing at |rect|. 36 // Shows the bookmark bubble, pointing at |rect|.
33 static void Show(GtkWindow* transient_toplevel, 37 static void Show(GtkWindow* transient_toplevel,
34 const gfx::Rect& rect, 38 const gfx::Rect& rect,
35 Profile* profile, 39 Profile* profile,
36 const GURL& url, 40 const GURL& url,
37 bool newly_bookmarked); 41 bool newly_bookmarked);
38 42
39 // Implements the InfoBubbleGtkDelegate. We are notified when the bubble 43 // Implements the InfoBubbleGtkDelegate. We are notified when the bubble
40 // is about to be closed, so we have a chance to save any state / input in 44 // is about to be closed, so we have a chance to save any state / input in
41 // our widgets before they are destroyed. 45 // our widgets before they are destroyed.
42 virtual void InfoBubbleClosing(InfoBubbleGtk* info_bubble, 46 virtual void InfoBubbleClosing(InfoBubbleGtk* info_bubble,
43 bool closed_by_escape); 47 bool closed_by_escape);
44 48
49 // Overridden from NotificationObserver:
50 virtual void Observe(NotificationType type,
51 const NotificationSource& source,
52 const NotificationDetails& details);
53
45 private: 54 private:
46 BookmarkBubbleGtk(GtkWindow* transient_toplevel, 55 BookmarkBubbleGtk(GtkWindow* transient_toplevel,
47 const gfx::Rect& rect, 56 const gfx::Rect& rect,
48 Profile* profile, 57 Profile* profile,
49 const GURL& url, 58 const GURL& url,
50 bool newly_bookmarked); 59 bool newly_bookmarked);
51 ~BookmarkBubbleGtk(); 60 ~BookmarkBubbleGtk();
52 61
53 static void HandleDestroyThunk(GtkWidget* widget, 62 static void HandleDestroyThunk(GtkWidget* widget,
54 gpointer userdata) { 63 gpointer userdata) {
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 void ShowEditor(); 109 void ShowEditor();
101 110
102 // Return the UTF8 encoded title for the current |url_|. 111 // Return the UTF8 encoded title for the current |url_|.
103 std::string GetTitle(); 112 std::string GetTitle();
104 113
105 // The URL of the bookmark. 114 // The URL of the bookmark.
106 GURL url_; 115 GURL url_;
107 // Our current profile (used to access the bookmark system). 116 // Our current profile (used to access the bookmark system).
108 Profile* profile_; 117 Profile* profile_;
109 118
119 // Provides colors and stuff.
120 GtkThemeProvider* theme_provider_;
121
110 // The toplevel window our dialogs should be transient for. 122 // The toplevel window our dialogs should be transient for.
111 GtkWindow* transient_toplevel_; 123 GtkWindow* transient_toplevel_;
112 124
113 // We let the InfoBubble own our content, and then we delete ourself 125 // We let the InfoBubble own our content, and then we delete ourself
114 // when the widget is destroyed (when the InfoBubble is destroyed). 126 // when the widget is destroyed (when the InfoBubble is destroyed).
115 GtkWidget* content_; 127 GtkWidget* content_;
116 128
129 // The various labels in the interface. We keep track of them for theme
130 // changes.
131 std::vector<GtkWidget*> labels_;
132
117 // The GtkEntry for editing the bookmark name / title. 133 // The GtkEntry for editing the bookmark name / title.
118 GtkWidget* name_entry_; 134 GtkWidget* name_entry_;
119 135
120 // The combo box for selecting the bookmark folder. 136 // The combo box for selecting the bookmark folder.
121 GtkWidget* folder_combo_; 137 GtkWidget* folder_combo_;
122 138
123 // The bookmark nodes in |folder_combo_|. 139 // The bookmark nodes in |folder_combo_|.
124 std::vector<const BookmarkNode*> folder_nodes_; 140 std::vector<const BookmarkNode*> folder_nodes_;
125 141
126 InfoBubbleGtk* bubble_; 142 InfoBubbleGtk* bubble_;
127 143
128 // We need to push some things on the back of the message loop, so we have 144 // We need to push some things on the back of the message loop, so we have
129 // a factory attached to our instance to manage task lifetimes. 145 // a factory attached to our instance to manage task lifetimes.
130 ScopedRunnableMethodFactory<BookmarkBubbleGtk> factory_; 146 ScopedRunnableMethodFactory<BookmarkBubbleGtk> factory_;
131 147
132 // Whether the bubble is creating or editing an existing bookmark. 148 // Whether the bubble is creating or editing an existing bookmark.
133 bool newly_bookmarked_; 149 bool newly_bookmarked_;
134 // When closing the window, whether we should update or remove the bookmark. 150 // When closing the window, whether we should update or remove the bookmark.
135 bool apply_edits_; 151 bool apply_edits_;
136 bool remove_bookmark_; 152 bool remove_bookmark_;
137 153
154 NotificationRegistrar registrar_;
155
138 DISALLOW_COPY_AND_ASSIGN(BookmarkBubbleGtk); 156 DISALLOW_COPY_AND_ASSIGN(BookmarkBubbleGtk);
139 }; 157 };
140 158
141 #endif // CHROME_BROWSER_GTK_BOOKMARK_BUBBLE_GTK_H_ 159 #endif // CHROME_BROWSER_GTK_BOOKMARK_BUBBLE_GTK_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/gtk/bookmark_bubble_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698