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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <set> | 9 #include <set> |
10 #include <vector> | 10 #include <vector> |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 } | 89 } |
90 void set_date_folder_modified(const base::Time& date) { | 90 void set_date_folder_modified(const base::Time& date) { |
91 date_folder_modified_ = date; | 91 date_folder_modified_ = date; |
92 } | 92 } |
93 | 93 |
94 // Convenience for testing if this node represents a folder. A folder is a | 94 // Convenience for testing if this node represents a folder. A folder is a |
95 // node whose type is not URL. | 95 // node whose type is not URL. |
96 bool is_folder() const { return type_ != URL; } | 96 bool is_folder() const { return type_ != URL; } |
97 bool is_url() const { return type_ == URL; } | 97 bool is_url() const { return type_ == URL; } |
98 | 98 |
99 // Returns the favicon. In nearly all cases you should use the method | |
100 // BookmarkModel::GetFavicon rather than this. BookmarkModel::GetFavicon | |
101 // takes care of loading the favicon if it isn't already loaded, where as | |
102 // this does not. | |
103 const SkBitmap& favicon() const { return favicon_; } | |
104 void set_favicon(const SkBitmap& icon) { favicon_ = icon; } | |
105 | |
106 // The following methods are used by the bookmark model, and are not | |
107 // really useful outside of it. | |
108 | |
109 bool is_favicon_loaded() const { return is_favicon_loaded_; } | 99 bool is_favicon_loaded() const { return is_favicon_loaded_; } |
110 void set_is_favicon_loaded(bool loaded) { is_favicon_loaded_ = loaded; } | |
111 | |
112 HistoryService::Handle favicon_load_handle() const { | |
113 return favicon_load_handle_; | |
114 } | |
115 void set_favicon_load_handle(HistoryService::Handle handle) { | |
116 favicon_load_handle_ = handle; | |
117 } | |
118 | 100 |
119 // Accessor method for controlling the visibility of a bookmark node/sub-tree. | 101 // Accessor method for controlling the visibility of a bookmark node/sub-tree. |
120 // Note that visibility is not propagated down the tree hierarchy so if a | 102 // Note that visibility is not propagated down the tree hierarchy so if a |
121 // parent node is marked as invisible, a child node may return "Visible". This | 103 // parent node is marked as invisible, a child node may return "Visible". This |
122 // function is primarily useful when traversing the model to generate a UI | 104 // function is primarily useful when traversing the model to generate a UI |
123 // representation but we may want to suppress some nodes. | 105 // representation but we may want to suppress some nodes. |
124 virtual bool IsVisible() const; | 106 virtual bool IsVisible() const; |
125 | 107 |
126 // TODO(sky): Consider adding last visit time here, it'll greatly simplify | 108 // TODO(sky): Consider adding last visit time here, it'll greatly simplify |
127 // HistoryContentsProvider. | 109 // HistoryContentsProvider. |
128 | 110 |
129 private: | 111 private: |
130 friend class BookmarkModel; | 112 friend class BookmarkModel; |
131 | 113 |
132 // A helper function to initialize various fields during construction. | 114 // A helper function to initialize various fields during construction. |
133 void Initialize(int64 id); | 115 void Initialize(int64 id); |
134 | 116 |
135 // Called when the favicon becomes invalid. | 117 // Called when the favicon becomes invalid. |
136 void InvalidateFavicon(); | 118 void InvalidateFavicon(); |
137 | 119 |
| 120 const SkBitmap& favicon() const { return favicon_; } |
| 121 void set_favicon(const SkBitmap& icon) { favicon_ = icon; } |
| 122 |
| 123 void set_is_favicon_loaded(bool loaded) { is_favicon_loaded_ = loaded; } |
| 124 |
| 125 HistoryService::Handle favicon_load_handle() const { |
| 126 return favicon_load_handle_; |
| 127 } |
| 128 void set_favicon_load_handle(HistoryService::Handle handle) { |
| 129 favicon_load_handle_ = handle; |
| 130 } |
| 131 |
138 // The unique identifier for this node. | 132 // The unique identifier for this node. |
139 int64 id_; | 133 int64 id_; |
140 | 134 |
141 // The URL of this node. BookmarkModel maintains maps off this URL, so changes | 135 // The URL of this node. BookmarkModel maintains maps off this URL, so changes |
142 // to the URL must be done through the BookmarkModel. | 136 // to the URL must be done through the BookmarkModel. |
143 GURL url_; | 137 GURL url_; |
144 | 138 |
145 // The type of this node. See enum above. | 139 // The type of this node. See enum above. |
146 Type type_; | 140 Type type_; |
147 | 141 |
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
495 | 489 |
496 // See description of IsDoingExtensiveChanges above. | 490 // See description of IsDoingExtensiveChanges above. |
497 int extensive_changes_; | 491 int extensive_changes_; |
498 | 492 |
499 scoped_ptr<BookmarkExpandedStateTracker> expanded_state_tracker_; | 493 scoped_ptr<BookmarkExpandedStateTracker> expanded_state_tracker_; |
500 | 494 |
501 DISALLOW_COPY_AND_ASSIGN(BookmarkModel); | 495 DISALLOW_COPY_AND_ASSIGN(BookmarkModel); |
502 }; | 496 }; |
503 | 497 |
504 #endif // CHROME_BROWSER_BOOKMARKS_BOOKMARK_MODEL_H_ | 498 #endif // CHROME_BROWSER_BOOKMARKS_BOOKMARK_MODEL_H_ |
OLD | NEW |