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