OLD | NEW |
1 // Copyright (c) 2012 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_BOOKMARKS_BOOKMARK_UTILS_H_ | 5 #ifndef CHROME_BROWSER_BOOKMARKS_BOOKMARK_UTILS_H_ |
6 #define CHROME_BROWSER_BOOKMARKS_BOOKMARK_UTILS_H_ | 6 #define CHROME_BROWSER_BOOKMARKS_BOOKMARK_UTILS_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/string16.h" | 11 #include "base/string16.h" |
12 #include "chrome/browser/bookmarks/bookmark_editor.h" | 12 #include "chrome/browser/bookmarks/bookmark_editor.h" |
13 #include "chrome/browser/bookmarks/bookmark_node_data.h" | 13 #include "chrome/browser/bookmarks/bookmark_node_data.h" |
14 #include "chrome/browser/history/snippet.h" | 14 #include "chrome/browser/history/snippet.h" |
15 | 15 |
16 class BookmarkModel; | 16 class BookmarkModel; |
17 class BookmarkNode; | 17 class BookmarkNode; |
| 18 |
| 19 namespace user_prefs { |
18 class PrefRegistrySyncable; | 20 class PrefRegistrySyncable; |
| 21 } |
19 | 22 |
20 // A collection of bookmark utility functions used by various parts of the UI | 23 // A collection of bookmark utility functions used by various parts of the UI |
21 // that show bookmarks: bookmark manager, bookmark bar view ... | 24 // that show bookmarks: bookmark manager, bookmark bar view ... |
22 namespace bookmark_utils { | 25 namespace bookmark_utils { |
23 | 26 |
24 // Clones bookmark node, adding newly created nodes to |parent| starting at | 27 // Clones bookmark node, adding newly created nodes to |parent| starting at |
25 // |index_to_add_at|. | 28 // |index_to_add_at|. |
26 void CloneBookmarkNode(BookmarkModel* model, | 29 void CloneBookmarkNode(BookmarkModel* model, |
27 const std::vector<BookmarkNodeData::Element>& elements, | 30 const std::vector<BookmarkNodeData::Element>& elements, |
28 const BookmarkNode* parent, | 31 const BookmarkNode* parent, |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 // changed and the node will need to be removed and reinserted. If a new node | 104 // changed and the node will need to be removed and reinserted. If a new node |
102 // is explicitly being added, returns a pointer to the new node that was | 105 // is explicitly being added, returns a pointer to the new node that was |
103 // created. Otherwise the return value is identically |node|. | 106 // created. Otherwise the return value is identically |node|. |
104 const BookmarkNode* ApplyEditsWithPossibleFolderChange( | 107 const BookmarkNode* ApplyEditsWithPossibleFolderChange( |
105 BookmarkModel* model, | 108 BookmarkModel* model, |
106 const BookmarkNode* new_parent, | 109 const BookmarkNode* new_parent, |
107 const BookmarkEditor::EditDetails& details, | 110 const BookmarkEditor::EditDetails& details, |
108 const string16& new_title, | 111 const string16& new_title, |
109 const GURL& new_url); | 112 const GURL& new_url); |
110 | 113 |
111 // Register user preferences for BookmarksBar. | 114 // Register user preferences for Bookmarks Bar. |
112 void RegisterUserPrefs(PrefRegistrySyncable* registry); | 115 void RegisterUserPrefs(user_prefs::PrefRegistrySyncable* registry); |
113 | 116 |
114 // Returns the parent for newly created folders/bookmarks. If |selection| has | 117 // Returns the parent for newly created folders/bookmarks. If |selection| has |
115 // one element and it is a folder, |selection[0]| is returned, otherwise | 118 // one element and it is a folder, |selection[0]| is returned, otherwise |
116 // |parent| is returned. If |index| is non-null it is set to the index newly | 119 // |parent| is returned. If |index| is non-null it is set to the index newly |
117 // added nodes should be added at. | 120 // added nodes should be added at. |
118 const BookmarkNode* GetParentForNewNodes( | 121 const BookmarkNode* GetParentForNewNodes( |
119 const BookmarkNode* parent, | 122 const BookmarkNode* parent, |
120 const std::vector<const BookmarkNode*>& selection, | 123 const std::vector<const BookmarkNode*>& selection, |
121 int* index); | 124 int* index); |
122 | 125 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 | 171 |
169 // Records the user opening a folder of bookmarks for UMA purposes. | 172 // Records the user opening a folder of bookmarks for UMA purposes. |
170 void RecordBookmarkFolderOpen(BookmarkLaunchLocation location); | 173 void RecordBookmarkFolderOpen(BookmarkLaunchLocation location); |
171 | 174 |
172 // Records the user opening the apps page for UMA purposes. | 175 // Records the user opening the apps page for UMA purposes. |
173 void RecordAppsPageOpen(BookmarkLaunchLocation location); | 176 void RecordAppsPageOpen(BookmarkLaunchLocation location); |
174 | 177 |
175 } // namespace bookmark_utils | 178 } // namespace bookmark_utils |
176 | 179 |
177 #endif // CHROME_BROWSER_BOOKMARKS_BOOKMARK_UTILS_H_ | 180 #endif // CHROME_BROWSER_BOOKMARKS_BOOKMARK_UTILS_H_ |
OLD | NEW |