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 #ifndef CHROME_BROWSER_BOOKMARKS_BOOKMARK_MODEL_H_ | 5 #ifndef CHROME_BROWSER_BOOKMARKS_BOOKMARK_MODEL_H_ |
6 #define CHROME_BROWSER_BOOKMARKS_BOOKMARK_MODEL_H_ | 6 #define CHROME_BROWSER_BOOKMARKS_BOOKMARK_MODEL_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 | 72 |
73 // Returns an unique id for this node. | 73 // Returns an unique id for this node. |
74 // For bookmark nodes that are managed by the bookmark model, the IDs are | 74 // For bookmark nodes that are managed by the bookmark model, the IDs are |
75 // persisted across sessions. | 75 // persisted across sessions. |
76 int64 id() const { return id_; } | 76 int64 id() const { return id_; } |
77 void set_id(int64 id) { id_ = id; } | 77 void set_id(int64 id) { id_ = id; } |
78 | 78 |
79 const GURL& url() const { return url_; } | 79 const GURL& url() const { return url_; } |
80 void set_url(const GURL& url) { url_ = url; } | 80 void set_url(const GURL& url) { url_ = url; } |
81 | 81 |
| 82 // Returns the favicon's URL. Returns an empty URL if there is no favicon |
| 83 // associated with this bookmark. |
| 84 const GURL& icon_url() const { return icon_url_; } |
| 85 |
82 Type type() const { return type_; } | 86 Type type() const { return type_; } |
83 void set_type(Type type) { type_ = type; } | 87 void set_type(Type type) { type_ = type; } |
84 | 88 |
85 // Returns the time the node was added. | 89 // Returns the time the node was added. |
86 const base::Time& date_added() const { return date_added_; } | 90 const base::Time& date_added() const { return date_added_; } |
87 void set_date_added(const base::Time& date) { date_added_ = date; } | 91 void set_date_added(const base::Time& date) { date_added_ = date; } |
88 | 92 |
89 // Returns the last time the folder was modified. This is only maintained | 93 // Returns the last time the folder was modified. This is only maintained |
90 // for folders (including the bookmark bar and other folder). | 94 // for folders (including the bookmark bar and other folder). |
91 const base::Time& date_folder_modified() const { | 95 const base::Time& date_folder_modified() const { |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 | 130 |
127 private: | 131 private: |
128 friend class BookmarkModel; | 132 friend class BookmarkModel; |
129 | 133 |
130 // A helper function to initialize various fields during construction. | 134 // A helper function to initialize various fields during construction. |
131 void Initialize(int64 id); | 135 void Initialize(int64 id); |
132 | 136 |
133 // Called when the favicon becomes invalid. | 137 // Called when the favicon becomes invalid. |
134 void InvalidateFavicon(); | 138 void InvalidateFavicon(); |
135 | 139 |
| 140 // Sets the favicon's URL. |
| 141 void set_icon_url(const GURL& icon_url) { |
| 142 icon_url_ = icon_url; |
| 143 } |
| 144 |
136 const gfx::Image& favicon() const { return favicon_; } | 145 const gfx::Image& favicon() const { return favicon_; } |
137 void set_favicon(const gfx::Image& icon) { favicon_ = icon; } | 146 void set_favicon(const gfx::Image& icon) { favicon_ = icon; } |
138 | 147 |
139 FaviconState favicon_state() const { return favicon_state_; } | 148 FaviconState favicon_state() const { return favicon_state_; } |
140 void set_favicon_state(FaviconState state) { favicon_state_ = state; } | 149 void set_favicon_state(FaviconState state) { favicon_state_ = state; } |
141 | 150 |
142 HistoryService::Handle favicon_load_handle() const { | 151 HistoryService::Handle favicon_load_handle() const { |
143 return favicon_load_handle_; | 152 return favicon_load_handle_; |
144 } | 153 } |
145 void set_favicon_load_handle(HistoryService::Handle handle) { | 154 void set_favicon_load_handle(HistoryService::Handle handle) { |
(...skipping 12 matching lines...) Expand all Loading... |
158 | 167 |
159 // Date of when this node was created. | 168 // Date of when this node was created. |
160 base::Time date_added_; | 169 base::Time date_added_; |
161 | 170 |
162 // Date of the last modification. Only used for folders. | 171 // Date of the last modification. Only used for folders. |
163 base::Time date_folder_modified_; | 172 base::Time date_folder_modified_; |
164 | 173 |
165 // The favicon of this node. | 174 // The favicon of this node. |
166 gfx::Image favicon_; | 175 gfx::Image favicon_; |
167 | 176 |
| 177 // The URL of the node's favicon. |
| 178 GURL icon_url_; |
| 179 |
168 // The loading state of the favicon. | 180 // The loading state of the favicon. |
169 FaviconState favicon_state_; | 181 FaviconState favicon_state_; |
170 | 182 |
171 // If non-zero, it indicates we're loading the favicon and this is the handle | 183 // If non-zero, it indicates we're loading the favicon and this is the handle |
172 // from the HistoryService. | 184 // from the HistoryService. |
173 HistoryService::Handle favicon_load_handle_; | 185 HistoryService::Handle favicon_load_handle_; |
174 | 186 |
175 // A JSON string representing a DictionaryValue that stores arbitrary meta | 187 // A JSON string representing a DictionaryValue that stores arbitrary meta |
176 // information about the node. Use serialized format to save memory. | 188 // information about the node. Use serialized format to save memory. |
177 std::string meta_info_str_; | 189 std::string meta_info_str_; |
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
513 | 525 |
514 // See description of IsDoingExtensiveChanges above. | 526 // See description of IsDoingExtensiveChanges above. |
515 int extensive_changes_; | 527 int extensive_changes_; |
516 | 528 |
517 scoped_ptr<BookmarkExpandedStateTracker> expanded_state_tracker_; | 529 scoped_ptr<BookmarkExpandedStateTracker> expanded_state_tracker_; |
518 | 530 |
519 DISALLOW_COPY_AND_ASSIGN(BookmarkModel); | 531 DISALLOW_COPY_AND_ASSIGN(BookmarkModel); |
520 }; | 532 }; |
521 | 533 |
522 #endif // CHROME_BROWSER_BOOKMARKS_BOOKMARK_MODEL_H_ | 534 #endif // CHROME_BROWSER_BOOKMARKS_BOOKMARK_MODEL_H_ |
OLD | NEW |