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_BOOKMARKS_BROWSER_BOOKMARK_NODE_H_ | 5 #ifndef COMPONENTS_BOOKMARKS_BROWSER_BOOKMARK_NODE_H_ |
6 #define COMPONENTS_BOOKMARKS_BROWSER_BOOKMARK_NODE_H_ | 6 #define COMPONENTS_BOOKMARKS_BROWSER_BOOKMARK_NODE_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
11 | 11 |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "base/task/cancelable_task_tracker.h" | 13 #include "base/task/cancelable_task_tracker.h" |
14 #include "base/time/time.h" | 14 #include "base/time/time.h" |
| 15 #include "components/bookmarks/browser/titled_url_node.h" |
15 #include "components/favicon_base/favicon_types.h" | 16 #include "components/favicon_base/favicon_types.h" |
16 #include "ui/base/models/tree_node_model.h" | 17 #include "ui/base/models/tree_node_model.h" |
17 #include "ui/gfx/image/image.h" | 18 #include "ui/gfx/image/image.h" |
18 #include "url/gurl.h" | 19 #include "url/gurl.h" |
19 | 20 |
20 namespace bookmarks { | 21 namespace bookmarks { |
21 | 22 |
22 class BookmarkModel; | 23 class BookmarkModel; |
23 | 24 |
24 // BookmarkNode --------------------------------------------------------------- | 25 // BookmarkNode --------------------------------------------------------------- |
25 | 26 |
26 // BookmarkNode contains information about a starred entry: title, URL, favicon, | 27 // BookmarkNode contains information about a starred entry: title, URL, favicon, |
27 // id and type. BookmarkNodes are returned from BookmarkModel. | 28 // id and type. BookmarkNodes are returned from BookmarkModel. |
28 class BookmarkNode : public ui::TreeNode<BookmarkNode> { | 29 class BookmarkNode : public ui::TreeNode<BookmarkNode>, public TitledUrlNode { |
29 public: | 30 public: |
30 enum Type { | 31 enum Type { |
31 URL, | 32 URL, |
32 FOLDER, | 33 FOLDER, |
33 BOOKMARK_BAR, | 34 BOOKMARK_BAR, |
34 OTHER_NODE, | 35 OTHER_NODE, |
35 MOBILE | 36 MOBILE |
36 }; | 37 }; |
37 | 38 |
38 enum FaviconState { | 39 enum FaviconState { |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 bool DeleteMetaInfo(const std::string& key); | 109 bool DeleteMetaInfo(const std::string& key); |
109 void SetMetaInfoMap(const MetaInfoMap& meta_info_map); | 110 void SetMetaInfoMap(const MetaInfoMap& meta_info_map); |
110 // Returns NULL if there are no values in the map. | 111 // Returns NULL if there are no values in the map. |
111 const MetaInfoMap* GetMetaInfoMap() const; | 112 const MetaInfoMap* GetMetaInfoMap() const; |
112 | 113 |
113 void set_sync_transaction_version(int64_t sync_transaction_version) { | 114 void set_sync_transaction_version(int64_t sync_transaction_version) { |
114 sync_transaction_version_ = sync_transaction_version; | 115 sync_transaction_version_ = sync_transaction_version; |
115 } | 116 } |
116 int64_t sync_transaction_version() const { return sync_transaction_version_; } | 117 int64_t sync_transaction_version() const { return sync_transaction_version_; } |
117 | 118 |
| 119 // TitledUrlNode interface methods. |
| 120 const base::string16& GetTitledUrlNodeTitle() const override; |
| 121 const GURL& GetTitledUrlNodeUrl() const override; |
| 122 long GetTitledUrlNodeId() const override; |
| 123 |
118 // TODO(sky): Consider adding last visit time here, it'll greatly simplify | 124 // TODO(sky): Consider adding last visit time here, it'll greatly simplify |
119 // HistoryContentsProvider. | 125 // HistoryContentsProvider. |
120 | 126 |
121 private: | 127 private: |
122 friend class BookmarkModel; | 128 friend class BookmarkModel; |
123 | 129 |
124 // A helper function to initialize various fields during construction. | 130 // A helper function to initialize various fields during construction. |
125 void Initialize(int64_t id); | 131 void Initialize(int64_t id); |
126 | 132 |
127 // Called when the favicon becomes invalid. | 133 // Called when the favicon becomes invalid. |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 | 215 |
210 private: | 216 private: |
211 bool visible_; | 217 bool visible_; |
212 | 218 |
213 DISALLOW_COPY_AND_ASSIGN(BookmarkPermanentNode); | 219 DISALLOW_COPY_AND_ASSIGN(BookmarkPermanentNode); |
214 }; | 220 }; |
215 | 221 |
216 } // namespace bookmarks | 222 } // namespace bookmarks |
217 | 223 |
218 #endif // COMPONENTS_BOOKMARKS_BROWSER_BOOKMARK_NODE_H_ | 224 #endif // COMPONENTS_BOOKMARKS_BROWSER_BOOKMARK_NODE_H_ |
OLD | NEW |