| 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_EXTENSION_HELPERS_H_ | 5 #ifndef CHROME_BROWSER_BOOKMARKS_BOOKMARK_EXTENSION_HELPERS_H_ |
| 6 #define CHROME_BROWSER_BOOKMARKS_BOOKMARK_EXTENSION_HELPERS_H_ | 6 #define CHROME_BROWSER_BOOKMARKS_BOOKMARK_EXTENSION_HELPERS_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "chrome/common/extensions/api/bookmarks.h" | 12 #include "chrome/common/extensions/api/bookmarks.h" |
| 13 | 13 |
| 14 class BookmarkModel; | 14 class BookmarkModel; |
| 15 class BookmarkNode; | 15 class BookmarkNode; |
| 16 | 16 |
| 17 // Helper functions. | 17 // Helper functions. |
| 18 namespace bookmark_extension_helpers { | 18 namespace bookmark_extension_helpers { |
| 19 | 19 |
| 20 // The returned value is owned by the caller. | 20 // The returned value is owned by the caller. |
| 21 extensions::api::bookmarks::BookmarkTreeNode* GetBookmarkTreeNode( | 21 extensions::api::bookmarks::BookmarkTreeNode* GetBookmarkTreeNode( |
| 22 const BookmarkNode* node, | 22 const BookmarkNode* node, |
| 23 bool recurse, | 23 bool recurse, |
| 24 bool only_folders); | 24 bool only_folders); |
| 25 | 25 |
| 26 // TODO(mwrosen): Remove this function once chrome.experimental.bookmarkManager | 26 // TODO(mwrosen): Remove this function once chrome.bookmarkManagerPrivate is |
| 27 // is refactored to use the JSON schema compiler. | 27 // refactored to use the JSON schema compiler. |
| 28 base::DictionaryValue* GetNodeDictionary(const BookmarkNode* node, | 28 base::DictionaryValue* GetNodeDictionary(const BookmarkNode* node, |
| 29 bool recurse, | 29 bool recurse, |
| 30 bool only_folders); | 30 bool only_folders); |
| 31 | 31 |
| 32 // Add a JSON representation of |node| to the JSON |nodes|. | 32 // Add a JSON representation of |node| to the JSON |nodes|. |
| 33 void AddNode(const BookmarkNode* node, | 33 void AddNode(const BookmarkNode* node, |
| 34 std::vector<linked_ptr< | 34 std::vector<linked_ptr< |
| 35 extensions::api::bookmarks::BookmarkTreeNode> >* nodes, | 35 extensions::api::bookmarks::BookmarkTreeNode> >* nodes, |
| 36 bool recurse); | 36 bool recurse); |
| 37 | 37 |
| 38 void AddNodeFoldersOnly(const BookmarkNode* node, | 38 void AddNodeFoldersOnly(const BookmarkNode* node, |
| 39 std::vector<linked_ptr< | 39 std::vector<linked_ptr< |
| 40 extensions::api::bookmarks::BookmarkTreeNode> >* | 40 extensions::api::bookmarks::BookmarkTreeNode> >* |
| 41 nodes, | 41 nodes, |
| 42 bool recurse); | 42 bool recurse); |
| 43 | 43 |
| 44 // TODO(mwrosen): Remove this function once chrome.experimental.bookmarkManager | 44 // TODO(mwrosen): Remove this function once chrome.bookmarkManagerPrivate is |
| 45 // is refactored to use the JSON schema compiler. | 45 // refactored to use the JSON schema compiler. |
| 46 void AddNode(const BookmarkNode* node, | 46 void AddNode(const BookmarkNode* node, |
| 47 base::ListValue* list, | 47 base::ListValue* list, |
| 48 bool recurse); | 48 bool recurse); |
| 49 | 49 |
| 50 // TODO(mwrosen): Remove this function once chrome.experimental.bookmarkManager | 50 // TODO(mwrosen): Remove this function once chrome.bookmarkManagerPrivate is |
| 51 // is refactored to use the JSON schema compiler. | 51 // refactored to use the JSON schema compiler. |
| 52 void AddNodeFoldersOnly(const BookmarkNode* node, | 52 void AddNodeFoldersOnly(const BookmarkNode* node, |
| 53 base::ListValue* list, | 53 base::ListValue* list, |
| 54 bool recurse); | 54 bool recurse); |
| 55 | 55 |
| 56 bool RemoveNode(BookmarkModel* model, | 56 bool RemoveNode(BookmarkModel* model, |
| 57 int64 id, | 57 int64 id, |
| 58 bool recursive, | 58 bool recursive, |
| 59 std::string* error); | 59 std::string* error); |
| 60 | 60 |
| 61 } // namespace bookmark_extension_helpers | 61 } // namespace bookmark_extension_helpers |
| 62 | 62 |
| 63 #endif // CHROME_BROWSER_BOOKMARKS_BOOKMARK_EXTENSION_HELPERS_H_ | 63 #endif // CHROME_BROWSER_BOOKMARKS_BOOKMARK_EXTENSION_HELPERS_H_ |
| OLD | NEW |