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, | |
not at google - send to devlin
2014/06/18 17:05:01
better to pass in a const ref here to imply non-nu
yefimt
2014/06/18 17:29:28
Done.
| |
138 base::DictionaryValue* id_to_meta_info_map) { | |
139 if (node->IsVisible()) { | |
not at google - send to devlin
2014/06/18 17:05:01
nit: can you early-return here? rather that than t
yefimt
2014/06/18 17:29:28
Done.
| |
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++) { | |
not at google - send to devlin
2014/06/18 17:05:01
++itr not itr++
also I personally don't like decl
yefimt
2014/06/18 17:29:28
Done
| |
145 value->SetStringWithoutPathExpansion(itr->first, itr->second); | |
146 } | |
147 } | |
148 id_to_meta_info_map->Set(base::Int64ToString(node->id()), value); | |
149 | |
150 if (node->is_folder()) { | |
151 for (int i = 0; i < node->child_count(); ++i) { | |
152 GetMetaInfo(node->GetChild(i), id_to_meta_info_map); | |
153 } | |
154 } | |
155 } | |
156 } | |
157 | |
137 } // namespace bookmark_api_helpers | 158 } // namespace bookmark_api_helpers |
138 } // namespace extensions | 159 } // namespace extensions |
OLD | NEW |