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

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

Issue 6251001: Move chrome/browser/gtk/ to chrome/browser/ui/gtk/... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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
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
8 // singleton behavior for you. It also handles the object and widget
9 // lifetimes, destroying everything and possibly committing any changes when
10 // the bubble is closed.
11
12 #ifndef CHROME_BROWSER_GTK_BOOKMARK_BUBBLE_GTK_H_ 5 #ifndef CHROME_BROWSER_GTK_BOOKMARK_BUBBLE_GTK_H_
13 #define CHROME_BROWSER_GTK_BOOKMARK_BUBBLE_GTK_H_ 6 #define CHROME_BROWSER_GTK_BOOKMARK_BUBBLE_GTK_H_
14 #pragma once 7 #pragma once
15 8
16 #include <string> 9 #include "chrome/browser/ui/gtk/bookmark_bubble_gtk.h"
17 #include <vector> 10 // TODO(msw): remove this file once all includes have been updated.
18
19 #include "app/gtk_signal.h"
20 #include "base/basictypes.h"
21 #include "base/scoped_ptr.h"
22 #include "base/task.h"
23 #include "chrome/browser/gtk/info_bubble_gtk.h"
24 #include "chrome/common/notification_observer.h"
25 #include "chrome/common/notification_registrar.h"
26 #include "googleurl/src/gurl.h"
27
28 class BookmarkNode;
29 class Profile;
30 class RecentlyUsedFoldersComboModel;
31
32 typedef struct _GtkWidget GtkWidget;
33 typedef struct _GParamSpec GParamSpec;
34
35 class BookmarkBubbleGtk : public InfoBubbleGtkDelegate,
36 public NotificationObserver {
37 public:
38 // Shows the bookmark bubble, pointing at |anchor_widget|.
39 static void Show(GtkWidget* anchor_widget,
40 Profile* profile,
41 const GURL& url,
42 bool newly_bookmarked);
43
44 // Implements the InfoBubbleGtkDelegate. We are notified when the bubble
45 // is about to be closed, so we have a chance to save any state / input in
46 // our widgets before they are destroyed.
47 virtual void InfoBubbleClosing(InfoBubbleGtk* info_bubble,
48 bool closed_by_escape);
49
50 // Overridden from NotificationObserver:
51 virtual void Observe(NotificationType type,
52 const NotificationSource& source,
53 const NotificationDetails& details);
54
55 private:
56 BookmarkBubbleGtk(GtkWidget* anchor,
57 Profile* profile,
58 const GURL& url,
59 bool newly_bookmarked);
60 ~BookmarkBubbleGtk();
61
62 // Notified when |content_| is destroyed so we can delete our instance.
63 CHROMEGTK_CALLBACK_0(BookmarkBubbleGtk, void, OnDestroy);
64 CHROMEGTK_CALLBACK_0(BookmarkBubbleGtk, void, OnNameActivate);
65 CHROMEGTK_CALLBACK_0(BookmarkBubbleGtk, void, OnFolderChanged);
66 CHROMEGTK_CALLBACK_1(BookmarkBubbleGtk, void, OnFolderPopupShown,
67 GParamSpec*);
68 CHROMEGTK_CALLBACK_0(BookmarkBubbleGtk, void, OnEditClicked);
69 CHROMEGTK_CALLBACK_0(BookmarkBubbleGtk, void, OnCloseClicked);
70 CHROMEGTK_CALLBACK_0(BookmarkBubbleGtk, void, OnRemoveClicked);
71
72 // Update the bookmark with any edits that have been made.
73 void ApplyEdits();
74
75 // Open the bookmark editor for the current url and close the bubble.
76 void ShowEditor();
77
78 // Return the UTF8 encoded title for the current |url_|.
79 std::string GetTitle();
80
81 void InitFolderComboModel();
82
83 // The URL of the bookmark.
84 GURL url_;
85 // Our current profile (used to access the bookmark system).
86 Profile* profile_;
87
88 // Provides colors and stuff.
89 GtkThemeProvider* theme_provider_;
90
91 // The widget relative to which we are positioned.
92 GtkWidget* anchor_;
93
94 // We let the InfoBubble own our content, and then we delete ourself
95 // when the widget is destroyed (when the InfoBubble is destroyed).
96 GtkWidget* content_;
97
98 // The button that removes the bookmark.
99 GtkWidget* remove_button_;
100
101 // The various labels in the interface. We keep track of them for theme
102 // changes.
103 std::vector<GtkWidget*> labels_;
104
105 // The GtkEntry for editing the bookmark name / title.
106 GtkWidget* name_entry_;
107
108 // The combo box for selecting the bookmark folder.
109 GtkWidget* folder_combo_;
110 scoped_ptr<RecentlyUsedFoldersComboModel> folder_combo_model_;
111
112 InfoBubbleGtk* bubble_;
113
114 // We need to push some things on the back of the message loop, so we have
115 // a factory attached to our instance to manage task lifetimes.
116 ScopedRunnableMethodFactory<BookmarkBubbleGtk> factory_;
117
118 // Whether the bubble is creating or editing an existing bookmark.
119 bool newly_bookmarked_;
120 // When closing the window, whether we should update or remove the bookmark.
121 bool apply_edits_;
122 bool remove_bookmark_;
123
124 NotificationRegistrar registrar_;
125
126 DISALLOW_COPY_AND_ASSIGN(BookmarkBubbleGtk);
127 };
128 11
129 #endif // CHROME_BROWSER_GTK_BOOKMARK_BUBBLE_GTK_H_ 12 #endif // CHROME_BROWSER_GTK_BOOKMARK_BUBBLE_GTK_H_
OLDNEW
« no previous file with comments | « chrome/browser/gtk/bookmark_bar_instructions_gtk.cc ('k') | chrome/browser/gtk/bookmark_bubble_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698