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 #include "chrome/browser/extensions/api/bookmarks/bookmark_api_helpers.h" | 5 #include "chrome/browser/extensions/api/bookmarks/bookmark_api_helpers.h" |
6 | 6 |
7 #include <math.h> // For floor() | 7 #include <math.h> // For floor() |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 | 71 |
72 bookmark_tree_node->title = base::UTF16ToUTF8(node->GetTitle()); | 72 bookmark_tree_node->title = base::UTF16ToUTF8(node->GetTitle()); |
73 if (!node->date_added().is_null()) { | 73 if (!node->date_added().is_null()) { |
74 // Javascript Date wants milliseconds since the epoch, ToDoubleT is seconds. | 74 // Javascript Date wants milliseconds since the epoch, ToDoubleT is seconds. |
75 bookmark_tree_node->date_added.reset( | 75 bookmark_tree_node->date_added.reset( |
76 new double(floor(node->date_added().ToDoubleT() * 1000))); | 76 new double(floor(node->date_added().ToDoubleT() * 1000))); |
77 } | 77 } |
78 | 78 |
79 if (bookmarks::IsDescendantOf(node, client->managed_node()) || | 79 if (bookmarks::IsDescendantOf(node, client->managed_node()) || |
80 bookmarks::IsDescendantOf(node, client->supervised_node())) { | 80 bookmarks::IsDescendantOf(node, client->supervised_node())) { |
81 bookmark_tree_node->unmodifiable = BookmarkTreeNode::UNMODIFIABLE_MANAGED; | 81 bookmark_tree_node->unmodifiable = |
| 82 api::bookmarks::BOOKMARK_TREE_NODE_UNMODIFIABLE_MANAGED; |
82 } | 83 } |
83 | 84 |
84 if (recurse && node->is_folder()) { | 85 if (recurse && node->is_folder()) { |
85 std::vector<linked_ptr<BookmarkTreeNode> > children; | 86 std::vector<linked_ptr<BookmarkTreeNode> > children; |
86 for (int i = 0; i < node->child_count(); ++i) { | 87 for (int i = 0; i < node->child_count(); ++i) { |
87 const BookmarkNode* child = node->GetChild(i); | 88 const BookmarkNode* child = node->GetChild(i); |
88 if (child->IsVisible() && (!only_folders || child->is_folder())) { | 89 if (child->IsVisible() && (!only_folders || child->is_folder())) { |
89 linked_ptr<BookmarkTreeNode> child_node( | 90 linked_ptr<BookmarkTreeNode> child_node( |
90 GetBookmarkTreeNode(client, child, true, only_folders)); | 91 GetBookmarkTreeNode(client, child, true, only_folders)); |
91 children.push_back(child_node); | 92 children.push_back(child_node); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 | 158 |
158 if (node.is_folder()) { | 159 if (node.is_folder()) { |
159 for (int i = 0; i < node.child_count(); ++i) { | 160 for (int i = 0; i < node.child_count(); ++i) { |
160 GetMetaInfo(*(node.GetChild(i)), id_to_meta_info_map); | 161 GetMetaInfo(*(node.GetChild(i)), id_to_meta_info_map); |
161 } | 162 } |
162 } | 163 } |
163 } | 164 } |
164 | 165 |
165 } // namespace bookmark_api_helpers | 166 } // namespace bookmark_api_helpers |
166 } // namespace extensions | 167 } // namespace extensions |
OLD | NEW |