Add new certificateProvider extension API.
[chromium-blink-merge.git] / chrome / browser / extensions / api / bookmarks / bookmark_api_helpers.h
blobdc32387c2fa1508c39ace1e150be3d0d297b0f68
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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_EXTENSIONS_API_BOOKMARKS_BOOKMARK_API_HELPERS_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_BOOKMARKS_BOOKMARK_API_HELPERS_H_
8 #include <string>
9 #include <vector>
11 #include "base/basictypes.h"
12 #include "chrome/common/extensions/api/bookmarks.h"
14 namespace bookmarks {
15 class BookmarkModel;
16 class BookmarkNode;
17 class ManagedBookmarkService;
20 // Helper functions.
21 namespace extensions {
22 namespace bookmark_api_helpers {
24 // The returned value is owned by the caller.
25 api::bookmarks::BookmarkTreeNode* GetBookmarkTreeNode(
26 bookmarks::ManagedBookmarkService* managed,
27 const bookmarks::BookmarkNode* node,
28 bool recurse,
29 bool only_folders);
31 // Adds a JSON representation of |node| to the JSON |nodes|.
32 void AddNode(bookmarks::ManagedBookmarkService* managed,
33 const bookmarks::BookmarkNode* node,
34 std::vector<linked_ptr<api::bookmarks::BookmarkTreeNode>>* nodes,
35 bool recurse);
37 // Adds a JSON representation of |node| of folder type to the JSON |nodes|.
38 void AddNodeFoldersOnly(
39 bookmarks::ManagedBookmarkService* managed,
40 const bookmarks::BookmarkNode* node,
41 std::vector<linked_ptr<api::bookmarks::BookmarkTreeNode>>* nodes,
42 bool recurse);
44 // Remove node of |id|.
45 bool RemoveNode(bookmarks::BookmarkModel* model,
46 bookmarks::ManagedBookmarkService* managed,
47 int64 id,
48 bool recursive,
49 std::string* error);
51 // Get meta info from |node| and all it's children recursively.
52 void GetMetaInfo(const bookmarks::BookmarkNode& node,
53 base::DictionaryValue* id_to_meta_info_map);
55 } // namespace bookmark_api_helpers
56 } // namespace extensions
58 #endif // CHROME_BROWSER_EXTENSIONS_API_BOOKMARKS_BOOKMARK_API_HELPERS_H_