| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_UI_GTK_BOOKMARKS_BOOKMARK_UTILS_GTK_H_ | 5 #ifndef CHROME_BROWSER_UI_GTK_BOOKMARKS_BOOKMARK_UTILS_GTK_H_ |
| 6 #define CHROME_BROWSER_UI_GTK_BOOKMARKS_BOOKMARK_UTILS_GTK_H_ | 6 #define CHROME_BROWSER_UI_GTK_BOOKMARKS_BOOKMARK_UTILS_GTK_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/string16.h" | 12 #include "base/string16.h" |
| 13 #include "ui/base/glib/glib_integers.h" | 13 #include "ui/base/glib/glib_integers.h" |
| 14 | 14 |
| 15 class BookmarkModel; | 15 class BookmarkModel; |
| 16 class BookmarkNode; | 16 class BookmarkNode; |
| 17 class GtkThemeService; | 17 class ThemeServiceGtk; |
| 18 class Profile; | 18 class Profile; |
| 19 | 19 |
| 20 typedef struct _GdkDragContext GdkDragContext; | 20 typedef struct _GdkDragContext GdkDragContext; |
| 21 typedef struct _GdkPixbuf GdkPixbuf; | 21 typedef struct _GdkPixbuf GdkPixbuf; |
| 22 typedef struct _GtkSelectionData GtkSelectionData; | 22 typedef struct _GtkSelectionData GtkSelectionData; |
| 23 typedef struct _GtkWidget GtkWidget; | 23 typedef struct _GtkWidget GtkWidget; |
| 24 | 24 |
| 25 namespace bookmark_utils { | 25 namespace bookmark_utils { |
| 26 | 26 |
| 27 extern const char kBookmarkNode[]; | 27 extern const char kBookmarkNode[]; |
| 28 | 28 |
| 29 // Get the image that is used to represent the node. This function adds a ref | 29 // Get the image that is used to represent the node. This function adds a ref |
| 30 // to the returned pixbuf, so it requires a matching call to g_object_unref(). | 30 // to the returned pixbuf, so it requires a matching call to g_object_unref(). |
| 31 GdkPixbuf* GetPixbufForNode(const BookmarkNode* node, BookmarkModel* model, | 31 GdkPixbuf* GetPixbufForNode(const BookmarkNode* node, BookmarkModel* model, |
| 32 bool native); | 32 bool native); |
| 33 | 33 |
| 34 // Returns a GtkWindow with a visual hierarchy for passing to | 34 // Returns a GtkWindow with a visual hierarchy for passing to |
| 35 // gtk_drag_set_icon_widget(). | 35 // gtk_drag_set_icon_widget(). |
| 36 GtkWidget* GetDragRepresentation(GdkPixbuf* pixbuf, | 36 GtkWidget* GetDragRepresentation(GdkPixbuf* pixbuf, |
| 37 const string16& title, | 37 const string16& title, |
| 38 GtkThemeService* provider); | 38 ThemeServiceGtk* provider); |
| 39 GtkWidget* GetDragRepresentationForNode(const BookmarkNode* node, | 39 GtkWidget* GetDragRepresentationForNode(const BookmarkNode* node, |
| 40 BookmarkModel* model, | 40 BookmarkModel* model, |
| 41 GtkThemeService* provider); | 41 ThemeServiceGtk* provider); |
| 42 | 42 |
| 43 // Helper function that sets visual properties of GtkButton |button| to the | 43 // Helper function that sets visual properties of GtkButton |button| to the |
| 44 // contents of |node|. | 44 // contents of |node|. |
| 45 void ConfigureButtonForNode(const BookmarkNode* node, BookmarkModel* model, | 45 void ConfigureButtonForNode(const BookmarkNode* node, BookmarkModel* model, |
| 46 GtkWidget* button, GtkThemeService* provider); | 46 GtkWidget* button, ThemeServiceGtk* provider); |
| 47 | 47 |
| 48 // Returns the tooltip. | 48 // Returns the tooltip. |
| 49 std::string BuildTooltipFor(const BookmarkNode* node); | 49 std::string BuildTooltipFor(const BookmarkNode* node); |
| 50 | 50 |
| 51 // Returns the label that should be in pull down menus. | 51 // Returns the label that should be in pull down menus. |
| 52 std::string BuildMenuLabelFor(const BookmarkNode* node); | 52 std::string BuildMenuLabelFor(const BookmarkNode* node); |
| 53 | 53 |
| 54 // Returns the "bookmark-node" property of |widget| casted to the correct type. | 54 // Returns the "bookmark-node" property of |widget| casted to the correct type. |
| 55 const BookmarkNode* BookmarkNodeForWidget(GtkWidget* widget); | 55 const BookmarkNode* BookmarkNodeForWidget(GtkWidget* widget); |
| 56 | 56 |
| 57 // Set the colors on |label| as per the theme. | 57 // Set the colors on |label| as per the theme. |
| 58 void SetButtonTextColors(GtkWidget* label, GtkThemeService* provider); | 58 void SetButtonTextColors(GtkWidget* label, ThemeServiceGtk* provider); |
| 59 | 59 |
| 60 // Drag and drop. -------------------------------------------------------------- | 60 // Drag and drop. -------------------------------------------------------------- |
| 61 | 61 |
| 62 // Get the DnD target mask for a bookmark drag. This will vary based on whether | 62 // Get the DnD target mask for a bookmark drag. This will vary based on whether |
| 63 // the node in question is a folder. | 63 // the node in question is a folder. |
| 64 int GetCodeMask(bool folder); | 64 int GetCodeMask(bool folder); |
| 65 | 65 |
| 66 // Pickle a node into a GtkSelection. | 66 // Pickle a node into a GtkSelection. |
| 67 void WriteBookmarkToSelection(const BookmarkNode* node, | 67 void WriteBookmarkToSelection(const BookmarkNode* node, |
| 68 GtkSelectionData* selection_data, | 68 GtkSelectionData* selection_data, |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 // Add the "url\ntitle" combination into the model at the given position. | 104 // Add the "url\ntitle" combination into the model at the given position. |
| 105 bool CreateNewBookmarkFromNetscapeURL( | 105 bool CreateNewBookmarkFromNetscapeURL( |
| 106 GtkSelectionData* selection_data, | 106 GtkSelectionData* selection_data, |
| 107 BookmarkModel* model, | 107 BookmarkModel* model, |
| 108 const BookmarkNode* parent, | 108 const BookmarkNode* parent, |
| 109 int idx); | 109 int idx); |
| 110 | 110 |
| 111 } // namespace bookmark_utils | 111 } // namespace bookmark_utils |
| 112 | 112 |
| 113 #endif // CHROME_BROWSER_UI_GTK_BOOKMARKS_BOOKMARK_UTILS_GTK_H_ | 113 #endif // CHROME_BROWSER_UI_GTK_BOOKMARKS_BOOKMARK_UTILS_GTK_H_ |
| OLD | NEW |