| 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 #ifndef COMPONENTS_ENHANCED_BOOKMARKS_ENHANCED_BOOKMARK_MODEL_H_ | 5 #ifndef COMPONENTS_ENHANCED_BOOKMARKS_ENHANCED_BOOKMARK_MODEL_H_ |
| 6 #define COMPONENTS_ENHANCED_BOOKMARKS_ENHANCED_BOOKMARK_MODEL_H_ | 6 #define COMPONENTS_ENHANCED_BOOKMARKS_ENHANCED_BOOKMARK_MODEL_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
| 11 #include "components/bookmarks/browser/bookmark_node.h" | |
| 12 #include "components/keyed_service/core/keyed_service.h" | 11 #include "components/keyed_service/core/keyed_service.h" |
| 13 | 12 |
| 14 namespace base { | 13 namespace base { |
| 15 class Time; | 14 class Time; |
| 16 } // namespace base | 15 } // namespace base |
| 17 | 16 |
| 18 class BookmarkModel; | 17 class BookmarkModel; |
| 18 class BookmarkNode; |
| 19 class GURL; | 19 class GURL; |
| 20 | 20 |
| 21 namespace enhanced_bookmarks { | 21 namespace enhanced_bookmarks { |
| 22 // Wrapper around BookmarkModel providing utility functions for enhanced | 22 // Wrapper around BookmarkModel providing utility functions for enhanced |
| 23 // bookmarks. | 23 // bookmarks. |
| 24 class EnhancedBookmarkModel : public KeyedService { | 24 class EnhancedBookmarkModel : public KeyedService { |
| 25 public: | 25 public: |
| 26 EnhancedBookmarkModel(BookmarkModel* bookmark_model, | 26 EnhancedBookmarkModel(BookmarkModel* bookmark_model, |
| 27 const std::string& version); | 27 const std::string& version); |
| 28 virtual ~EnhancedBookmarkModel(); | 28 virtual ~EnhancedBookmarkModel(); |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 int image_height, | 98 int image_height, |
| 99 const GURL& thumbnail_url, | 99 const GURL& thumbnail_url, |
| 100 int thumbnail_width, | 100 int thumbnail_width, |
| 101 int thumbnail_height); | 101 int thumbnail_height); |
| 102 | 102 |
| 103 // TODO(rfevang): Ideally nothing should need the underlying bookmark model. | 103 // TODO(rfevang): Ideally nothing should need the underlying bookmark model. |
| 104 // Remove when that is actually the case. | 104 // Remove when that is actually the case. |
| 105 BookmarkModel* bookmark_model() { return bookmark_model_; } | 105 BookmarkModel* bookmark_model() { return bookmark_model_; } |
| 106 | 106 |
| 107 private: | 107 private: |
| 108 // Generates and sets a remote id for the given bookmark |node|. | |
| 109 // Returns the id set. | |
| 110 std::string SetRemoteId(const BookmarkNode* node); | |
| 111 | |
| 112 // Helper method for setting a meta info field on a node. Also updates the | 108 // Helper method for setting a meta info field on a node. Also updates the |
| 113 // version and userEdits fields. | 109 // version field. |
| 114 void SetMetaInfo(const BookmarkNode* node, | 110 void SetMetaInfo(const BookmarkNode* node, |
| 115 const std::string& field, | 111 const std::string& field, |
| 116 const std::string& value, | 112 const std::string& value); |
| 117 bool user_edit); | |
| 118 | 113 |
| 119 // Returns the version string to use when setting stars.version. | 114 // Returns the version string to use when setting stars.version. |
| 120 std::string GetVersionString(); | 115 std::string GetVersionString(); |
| 121 | 116 |
| 122 BookmarkModel* bookmark_model_; | 117 BookmarkModel* bookmark_model_; |
| 123 std::string version_; | 118 std::string version_; |
| 124 std::string version_suffix_; | 119 std::string version_suffix_; |
| 125 }; | 120 }; |
| 126 | 121 |
| 127 } // namespace enhanced_bookmarks | 122 } // namespace enhanced_bookmarks |
| 128 | 123 |
| 129 #endif // COMPONENTS_ENHANCED_BOOKMARKS_ENHANCED_BOOKMARK_MODEL_H_ | 124 #endif // COMPONENTS_ENHANCED_BOOKMARKS_ENHANCED_BOOKMARK_MODEL_H_ |
| OLD | NEW |