| OLD | NEW |
| 1 // Copyright (c) 2011 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 | 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_UI_GTK_BOOKMARKS_BOOKMARK_BUBBLE_GTK_H_ | 12 #ifndef CHROME_BROWSER_UI_GTK_BOOKMARKS_BOOKMARK_BUBBLE_GTK_H_ |
| 13 #define CHROME_BROWSER_UI_GTK_BOOKMARKS_BOOKMARK_BUBBLE_GTK_H_ | 13 #define CHROME_BROWSER_UI_GTK_BOOKMARKS_BOOKMARK_BUBBLE_GTK_H_ |
| 14 #pragma once | 14 #pragma once |
| 15 | 15 |
| 16 #include <string> | 16 #include <string> |
| 17 #include <vector> | 17 #include <vector> |
| 18 | 18 |
| 19 #include "base/basictypes.h" | 19 #include "base/basictypes.h" |
| 20 #include "base/compiler_specific.h" | 20 #include "base/compiler_specific.h" |
| 21 #include "base/memory/scoped_ptr.h" | 21 #include "base/memory/scoped_ptr.h" |
| 22 #include "base/memory/weak_ptr.h" | 22 #include "base/memory/weak_ptr.h" |
| 23 #include "base/task.h" | 23 #include "base/task.h" |
| 24 #include "chrome/browser/ui/gtk/bubble/bubble_gtk.h" | 24 #include "chrome/browser/ui/gtk/bubble/bubble_gtk.h" |
| 25 #include "content/public/browser/notification_observer.h" | 25 #include "content/public/browser/notification_observer.h" |
| 26 #include "content/public/browser/notification_registrar.h" | 26 #include "content/public/browser/notification_registrar.h" |
| 27 #include "googleurl/src/gurl.h" | 27 #include "googleurl/src/gurl.h" |
| 28 #include "ui/base/gtk/gtk_signal.h" | 28 #include "ui/base/gtk/gtk_signal.h" |
| 29 | 29 |
| 30 class BookmarkModel; |
| 30 class BookmarkNode; | 31 class BookmarkNode; |
| 31 class Profile; | 32 class Profile; |
| 32 class RecentlyUsedFoldersComboModel; | 33 class RecentlyUsedFoldersComboModel; |
| 33 | 34 |
| 34 typedef struct _GtkWidget GtkWidget; | 35 typedef struct _GtkWidget GtkWidget; |
| 35 typedef struct _GParamSpec GParamSpec; | 36 typedef struct _GParamSpec GParamSpec; |
| 36 | 37 |
| 37 class BookmarkBubbleGtk : public BubbleDelegateGtk, | 38 class BookmarkBubbleGtk : public BubbleDelegateGtk, |
| 38 public content::NotificationObserver { | 39 public content::NotificationObserver { |
| 39 public: | 40 public: |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 // Open the bookmark editor for the current url and close the bubble. | 75 // Open the bookmark editor for the current url and close the bubble. |
| 75 void ShowEditor(); | 76 void ShowEditor(); |
| 76 | 77 |
| 77 // Return the UTF8 encoded title for the current |url_|. | 78 // Return the UTF8 encoded title for the current |url_|. |
| 78 std::string GetTitle(); | 79 std::string GetTitle(); |
| 79 | 80 |
| 80 void InitFolderComboModel(); | 81 void InitFolderComboModel(); |
| 81 | 82 |
| 82 // The URL of the bookmark. | 83 // The URL of the bookmark. |
| 83 GURL url_; | 84 GURL url_; |
| 85 |
| 84 // Our current profile (used to access the bookmark system). | 86 // Our current profile (used to access the bookmark system). |
| 85 Profile* profile_; | 87 Profile* profile_; |
| 86 | 88 |
| 89 // This is owned by the Profile. |
| 90 BookmarkModel* model_; |
| 91 |
| 87 // Provides colors and stuff. | 92 // Provides colors and stuff. |
| 88 GtkThemeService* theme_service_; | 93 GtkThemeService* theme_service_; |
| 89 | 94 |
| 90 // The widget relative to which we are positioned. | 95 // The widget relative to which we are positioned. |
| 91 GtkWidget* anchor_; | 96 GtkWidget* anchor_; |
| 92 | 97 |
| 93 // We let the BubbleGtk own our content, and then we delete ourself | 98 // We let the BubbleGtk own our content, and then we delete ourself |
| 94 // when the widget is destroyed (when the BubbleGtk is destroyed). | 99 // when the widget is destroyed (when the BubbleGtk is destroyed). |
| 95 GtkWidget* content_; | 100 GtkWidget* content_; |
| 96 | 101 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 119 // When closing the window, whether we should update or remove the bookmark. | 124 // When closing the window, whether we should update or remove the bookmark. |
| 120 bool apply_edits_; | 125 bool apply_edits_; |
| 121 bool remove_bookmark_; | 126 bool remove_bookmark_; |
| 122 | 127 |
| 123 content::NotificationRegistrar registrar_; | 128 content::NotificationRegistrar registrar_; |
| 124 | 129 |
| 125 DISALLOW_COPY_AND_ASSIGN(BookmarkBubbleGtk); | 130 DISALLOW_COPY_AND_ASSIGN(BookmarkBubbleGtk); |
| 126 }; | 131 }; |
| 127 | 132 |
| 128 #endif // CHROME_BROWSER_UI_GTK_BOOKMARKS_BOOKMARK_BUBBLE_GTK_H_ | 133 #endif // CHROME_BROWSER_UI_GTK_BOOKMARKS_BOOKMARK_BUBBLE_GTK_H_ |
| OLD | NEW |