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/enhanced_bookmark_model.h" | 5 #include "components/enhanced_bookmarks/enhanced_bookmark_model.h" |
6 | 6 |
7 #include <iomanip> | 7 #include <iomanip> |
8 #include <sstream> | 8 #include <sstream> |
9 | 9 |
10 #include "base/base64.h" | 10 #include "base/base64.h" |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/message_loop/message_loop_proxy.h" | 12 #include "base/message_loop/message_loop_proxy.h" |
13 #include "base/rand_util.h" | 13 #include "base/rand_util.h" |
14 #include "base/strings/string_number_conversions.h" | 14 #include "base/strings/string_number_conversions.h" |
15 #include "components/bookmarks/browser/bookmark_model.h" | 15 #include "components/bookmarks/browser/bookmark_model.h" |
16 #include "components/bookmarks/browser/bookmark_node.h" | 16 #include "components/bookmarks/browser/bookmark_node.h" |
17 #include "components/enhanced_bookmarks/enhanced_bookmark_model_observer.h" | 17 #include "components/enhanced_bookmarks/enhanced_bookmark_model_observer.h" |
18 #include "components/enhanced_bookmarks/proto/metadata.pb.h" | 18 #include "components/enhanced_bookmarks/proto/metadata.pb.h" |
19 #include "ui/base/models/tree_node_iterator.h" | 19 #include "ui/base/models/tree_node_iterator.h" |
20 #include "url/gurl.h" | 20 #include "url/gurl.h" |
21 | 21 |
22 using bookmarks::BookmarkModel; | 22 using bookmarks::BookmarkModel; |
| 23 using bookmarks::BookmarkNode; |
23 | 24 |
24 namespace { | 25 namespace { |
25 const char* kBookmarkBarId = "f_bookmarks_bar"; | 26 const char* kBookmarkBarId = "f_bookmarks_bar"; |
26 | 27 |
27 const char* kFlagsKey = "stars.flags"; | 28 const char* kFlagsKey = "stars.flags"; |
28 const char* kIdKey = "stars.id"; | 29 const char* kIdKey = "stars.id"; |
29 const char* kImageDataKey = "stars.imageData"; | 30 const char* kImageDataKey = "stars.imageData"; |
30 const char* kNoteKey = "stars.note"; | 31 const char* kNoteKey = "stars.note"; |
31 const char* kOldIdKey = "stars.oldId"; | 32 const char* kOldIdKey = "stars.oldId"; |
32 const char* kPageDataKey = "stars.pageData"; | 33 const char* kPageDataKey = "stars.pageData"; |
(...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
554 if (!result) | 555 if (!result) |
555 return false; | 556 return false; |
556 | 557 |
557 std::string encoded; | 558 std::string encoded; |
558 base::Base64Encode(output, &encoded); | 559 base::Base64Encode(output, &encoded); |
559 bookmark_model_->SetNodeMetaInfo(node, kImageDataKey, encoded); | 560 bookmark_model_->SetNodeMetaInfo(node, kImageDataKey, encoded); |
560 return true; | 561 return true; |
561 } | 562 } |
562 | 563 |
563 } // namespace enhanced_bookmarks | 564 } // namespace enhanced_bookmarks |
OLD | NEW |