OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_BOOKMARK_EDITOR_GTK_H_ | 5 #ifndef CHROME_BROWSER_GTK_BOOKMARK_EDITOR_GTK_H_ |
6 #define CHROME_BROWSER_GTK_BOOKMARK_EDITOR_GTK_H_ | 6 #define CHROME_BROWSER_GTK_BOOKMARK_EDITOR_GTK_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "app/gtk_integers.h" | 9 #include "app/gtk_integers.h" |
10 #include "app/gtk_signal.h" | 10 #include "app/gtk_signal.h" |
11 #include "base/gtest_prod_util.h" | 11 #include "base/gtest_prod_util.h" |
12 #include "base/scoped_ptr.h" | |
13 #include "base/string16.h" | 12 #include "base/string16.h" |
14 #include "chrome/browser/bookmarks/bookmark_editor.h" | 13 #include "chrome/browser/bookmarks/bookmark_editor.h" |
15 #include "chrome/browser/bookmarks/bookmark_model_observer.h" | 14 #include "chrome/browser/bookmarks/bookmark_model_observer.h" |
16 | 15 |
17 class GURL; | 16 class GURL; |
18 | 17 |
19 typedef union _GdkEvent GdkEvent; | 18 typedef union _GdkEvent GdkEvent; |
20 typedef struct _GdkEventButton GdkEventButton; | |
21 typedef struct _GtkTreeIter GtkTreeIter; | 19 typedef struct _GtkTreeIter GtkTreeIter; |
22 typedef struct _GtkTreeSelection GtkTreeSelection; | 20 typedef struct _GtkTreeSelection GtkTreeSelection; |
23 typedef struct _GtkTreeStore GtkTreeStore; | 21 typedef struct _GtkTreeStore GtkTreeStore; |
24 typedef struct _GtkWidget GtkWidget; | 22 typedef struct _GtkWidget GtkWidget; |
25 | 23 |
26 // GTK version of the bookmark editor dialog. | 24 // GTK version of the bookmark editor dialog. |
27 class BookmarkEditorGtk : public BookmarkEditor, | 25 class BookmarkEditorGtk : public BookmarkEditor, |
28 public BookmarkModelObserver { | 26 public BookmarkModelObserver { |
29 FRIEND_TEST_ALL_PREFIXES(BookmarkEditorGtkTest, ChangeParent); | 27 FRIEND_TEST_ALL_PREFIXES(BookmarkEditorGtkTest, ChangeParent); |
30 FRIEND_TEST_ALL_PREFIXES(BookmarkEditorGtkTest, ChangeParentAndURL); | 28 FRIEND_TEST_ALL_PREFIXES(BookmarkEditorGtkTest, ChangeParentAndURL); |
(...skipping 11 matching lines...) Expand all Loading... |
42 const BookmarkNode* parent, | 40 const BookmarkNode* parent, |
43 const EditDetails& details, | 41 const EditDetails& details, |
44 BookmarkEditor::Configuration configuration); | 42 BookmarkEditor::Configuration configuration); |
45 | 43 |
46 virtual ~BookmarkEditorGtk(); | 44 virtual ~BookmarkEditorGtk(); |
47 | 45 |
48 void Show(); | 46 void Show(); |
49 void Close(); | 47 void Close(); |
50 | 48 |
51 private: | 49 private: |
52 class ContextMenuController; | |
53 friend class ContextMenuController; | |
54 | |
55 void Init(GtkWindow* parent_window); | 50 void Init(GtkWindow* parent_window); |
56 | 51 |
57 // BookmarkModel observer methods. Any structural change results in | 52 // BookmarkModel observer methods. Any structural change results in |
58 // resetting the tree model. | 53 // resetting the tree model. |
59 virtual void Loaded(BookmarkModel* model) { } | 54 virtual void Loaded(BookmarkModel* model) { } |
60 virtual void BookmarkNodeMoved(BookmarkModel* model, | 55 virtual void BookmarkNodeMoved(BookmarkModel* model, |
61 const BookmarkNode* old_parent, | 56 const BookmarkNode* old_parent, |
62 int old_index, | 57 int old_index, |
63 const BookmarkNode* new_parent, | 58 const BookmarkNode* new_parent, |
64 int new_index); | 59 int new_index); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 CHROMEGTK_CALLBACK_0(BookmarkEditorGtk, void, OnSelectionChanged); | 97 CHROMEGTK_CALLBACK_0(BookmarkEditorGtk, void, OnSelectionChanged); |
103 CHROMEGTK_CALLBACK_1(BookmarkEditorGtk, void, OnResponse, int); | 98 CHROMEGTK_CALLBACK_1(BookmarkEditorGtk, void, OnResponse, int); |
104 CHROMEGTK_CALLBACK_1(BookmarkEditorGtk, gboolean, OnWindowDeleteEvent, | 99 CHROMEGTK_CALLBACK_1(BookmarkEditorGtk, gboolean, OnWindowDeleteEvent, |
105 GdkEvent*); | 100 GdkEvent*); |
106 | 101 |
107 CHROMEGTK_CALLBACK_0(BookmarkEditorGtk, void, OnWindowDestroy); | 102 CHROMEGTK_CALLBACK_0(BookmarkEditorGtk, void, OnWindowDestroy); |
108 CHROMEGTK_CALLBACK_0(BookmarkEditorGtk, void, OnEntryChanged); | 103 CHROMEGTK_CALLBACK_0(BookmarkEditorGtk, void, OnEntryChanged); |
109 | 104 |
110 CHROMEGTK_CALLBACK_0(BookmarkEditorGtk, void, OnNewFolderClicked); | 105 CHROMEGTK_CALLBACK_0(BookmarkEditorGtk, void, OnNewFolderClicked); |
111 | 106 |
112 CHROMEGTK_CALLBACK_1(BookmarkEditorGtk, gboolean, OnTreeViewButtonPressEvent, | |
113 GdkEventButton*); | |
114 | |
115 void ShowContextMenu(); | |
116 | |
117 void NewFolder(); | |
118 | |
119 // Profile the entry is from. | 107 // Profile the entry is from. |
120 Profile* profile_; | 108 Profile* profile_; |
121 | 109 |
122 // The dialog to display on screen. | 110 // The dialog to display on screen. |
123 GtkWidget* dialog_; | 111 GtkWidget* dialog_; |
124 GtkWidget* name_entry_; | 112 GtkWidget* name_entry_; |
125 GtkWidget* url_entry_; // This is NULL if IsEditingFolder. | 113 GtkWidget* url_entry_; // This is NULL if IsEditingFolder. |
126 GtkWidget* tree_view_; | 114 GtkWidget* tree_view_; |
127 GtkWidget* new_folder_button_; | 115 GtkWidget* new_folder_button_; |
128 | 116 |
(...skipping 17 matching lines...) Expand all Loading... |
146 // Mode used to create nodes from. | 134 // Mode used to create nodes from. |
147 BookmarkModel* bb_model_; | 135 BookmarkModel* bb_model_; |
148 | 136 |
149 // If true, we're running the menu for the bookmark bar or other bookmarks | 137 // If true, we're running the menu for the bookmark bar or other bookmarks |
150 // nodes. | 138 // nodes. |
151 bool running_menu_for_root_; | 139 bool running_menu_for_root_; |
152 | 140 |
153 // Is the tree shown? | 141 // Is the tree shown? |
154 bool show_tree_; | 142 bool show_tree_; |
155 | 143 |
156 // The context menu controller. | |
157 scoped_ptr<ContextMenuController> menu_controller_; | |
158 | |
159 DISALLOW_COPY_AND_ASSIGN(BookmarkEditorGtk); | 144 DISALLOW_COPY_AND_ASSIGN(BookmarkEditorGtk); |
160 }; | 145 }; |
161 | 146 |
162 #endif // CHROME_BROWSER_GTK_BOOKMARK_EDITOR_GTK_H_ | 147 #endif // CHROME_BROWSER_GTK_BOOKMARK_EDITOR_GTK_H_ |
OLD | NEW |