OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/enhanced_bookmarks/metadata_accessor.h" | 5 #include "components/enhanced_bookmarks/metadata_accessor.h" |
6 | 6 |
7 #include <iomanip> | 7 #include <iomanip> |
8 | 8 |
9 #include "base/base64.h" | 9 #include "base/base64.h" |
10 #include "base/rand_util.h" | 10 #include "base/rand_util.h" |
11 #include "components/bookmarks/browser/bookmark_model.h" | 11 #include "components/bookmarks/browser/bookmark_model.h" |
12 #include "components/enhanced_bookmarks/proto/metadata.pb.h" | 12 #include "components/enhanced_bookmarks/proto/metadata.pb.h" |
13 #include "ui/base/models/tree_node_iterator.h" | 13 #include "ui/base/models/tree_node_iterator.h" |
14 | 14 |
15 using namespace image::collections; | 15 using namespace image::collections; |
16 using bookmarks::BookmarkModel; | 16 using bookmarks::BookmarkModel; |
| 17 using bookmarks::BookmarkNode; |
17 | 18 |
18 namespace { | 19 namespace { |
19 | 20 |
20 // Helper method for working with bookmark metainfo. | 21 // Helper method for working with bookmark metainfo. |
21 std::string DataForMetaInfoField(const BookmarkNode* node, | 22 std::string DataForMetaInfoField(const BookmarkNode* node, |
22 const std::string& field) { | 23 const std::string& field) { |
23 const BookmarkNode::MetaInfoMap* map = node->GetMetaInfoMap(); | 24 const BookmarkNode::MetaInfoMap* map = node->GetMetaInfoMap(); |
24 if (!map) | 25 if (!map) |
25 return ""; | 26 return ""; |
26 | 27 |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 if (!result) | 249 if (!result) |
249 return false; | 250 return false; |
250 | 251 |
251 std::string encoded; | 252 std::string encoded; |
252 base::Base64Encode(output, &encoded); | 253 base::Base64Encode(output, &encoded); |
253 bookmark_model->SetNodeMetaInfo(node, kImageDataKey, encoded); | 254 bookmark_model->SetNodeMetaInfo(node, kImageDataKey, encoded); |
254 return true; | 255 return true; |
255 } | 256 } |
256 | 257 |
257 } // namespace enhanced_bookmarks | 258 } // namespace enhanced_bookmarks |
OLD | NEW |