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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 // Javascript Date wants milliseconds since the epoch, ToDoubleT is seconds. | 125 // Javascript Date wants milliseconds since the epoch, ToDoubleT is seconds. |
126 dict->SetDouble(keys::kDateAddedKey, | 126 dict->SetDouble(keys::kDateAddedKey, |
127 floor(node->date_added().ToDoubleT() * 1000)); | 127 floor(node->date_added().ToDoubleT() * 1000)); |
128 } | 128 } |
129 | 129 |
130 if (recurse && node->is_folder()) { | 130 if (recurse && node->is_folder()) { |
131 base::ListValue* children = new base::ListValue; | 131 base::ListValue* children = new base::ListValue; |
132 for (int i = 0; i < node->child_count(); ++i) { | 132 for (int i = 0; i < node->child_count(); ++i) { |
133 const BookmarkNode* child = node->GetChild(i); | 133 const BookmarkNode* child = node->GetChild(i); |
134 if (child->IsVisible() && (!only_folders || child->is_folder())) { | 134 if (child->IsVisible() && (!only_folders || child->is_folder())) { |
135 DictionaryValue* dict = GetNodeDictionary(child, true, only_folders); | 135 base::DictionaryValue* dict = |
| 136 GetNodeDictionary(child, true, only_folders); |
136 children->Append(dict); | 137 children->Append(dict); |
137 } | 138 } |
138 } | 139 } |
139 dict->Set(keys::kChildrenKey, children); | 140 dict->Set(keys::kChildrenKey, children); |
140 } | 141 } |
141 return dict; | 142 return dict; |
142 } | 143 } |
143 | 144 |
144 void AddNode(const BookmarkNode* node, | 145 void AddNode(const BookmarkNode* node, |
145 std::vector<linked_ptr<BookmarkTreeNode> >* nodes, | 146 std::vector<linked_ptr<BookmarkTreeNode> >* nodes, |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 return false; | 182 return false; |
182 } | 183 } |
183 | 184 |
184 const BookmarkNode* parent = node->parent(); | 185 const BookmarkNode* parent = node->parent(); |
185 model->Remove(parent, parent->GetIndexOf(node)); | 186 model->Remove(parent, parent->GetIndexOf(node)); |
186 return true; | 187 return true; |
187 } | 188 } |
188 | 189 |
189 } // namespace bookmark_api_helpers | 190 } // namespace bookmark_api_helpers |
190 } // namespace extensions | 191 } // namespace extensions |
OLD | NEW |