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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
127 if (node->is_folder() && !node->empty() && !recursive) { | 127 if (node->is_folder() && !node->empty() && !recursive) { |
128 *error = keys::kFolderNotEmptyError; | 128 *error = keys::kFolderNotEmptyError; |
129 return false; | 129 return false; |
130 } | 130 } |
131 | 131 |
132 const BookmarkNode* parent = node->parent(); | 132 const BookmarkNode* parent = node->parent(); |
133 model->Remove(parent, parent->GetIndexOf(node)); | 133 model->Remove(parent, parent->GetIndexOf(node)); |
134 return true; | 134 return true; |
135 } | 135 } |
136 | 136 |
137 void GetMetaInfo(const BookmarkNode* node, | |
138 base::DictionaryValue* id_to_meta_info_map) { | |
139 if (node->IsVisible()) { | |
140 const BookmarkNode::MetaInfoMap* meta_info = node->GetMetaInfoMap(); | |
141 base::DictionaryValue* value = new base::DictionaryValue(); | |
142 if (meta_info) { | |
143 BookmarkNode::MetaInfoMap::const_iterator itr; | |
144 for (itr = meta_info->begin(); itr != meta_info->end(); itr++) | |
145 value->SetStringWithoutPathExpansion(itr->first, itr->second); | |
146 } | |
147 id_to_meta_info_map->Set(base::Int64ToString(node->id()), value); | |
148 | |
149 if (node->is_folder()) { | |
150 for (int i = 0; i < node->child_count(); ++i) { | |
151 GetMetaInfo(node->GetChild(i), id_to_meta_info_map); | |
152 } | |
not at google - send to devlin
2014/06/16 19:09:13
be consistent, either use {} on 1-line ifs/fors or
yefimt
2014/06/16 21:47:29
Done.
| |
153 } | |
154 } | |
155 } | |
156 | |
137 } // namespace bookmark_api_helpers | 157 } // namespace bookmark_api_helpers |
138 } // namespace extensions | 158 } // namespace extensions |
OLD | NEW |