From ea2e5aa57f173880eabea2054729b5e1bc6b3560 Mon Sep 17 00:00:00 2001 From: "sky@chromium.org" Date: Wed, 20 May 2009 18:01:28 +0000 Subject: Moves GetFavIcon from BookmarkNode to BookmarkModel. I'm doing this for two reasons: . it cuts down on each node needing a reference to the model. . it makes it clear nodes shouldn't need to talk with the model. I'm primarily doing this for the last point as I'm going to populate nodes on a background thread shortly and I don't want to risk the chance of someone trying to talk with the model. BUG=none TEST=none Review URL: http://codereview.chromium.org/113617 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16491 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/bookmarks/bookmark_model.h | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'chrome/browser/bookmarks/bookmark_model.h') diff --git a/chrome/browser/bookmarks/bookmark_model.h b/chrome/browser/bookmarks/bookmark_model.h index 8552e26..43484eb 100644 --- a/chrome/browser/bookmarks/bookmark_model.h +++ b/chrome/browser/bookmarks/bookmark_model.h @@ -56,10 +56,6 @@ class BookmarkNode : public TreeNode { public: virtual ~BookmarkNode() {} - // Returns the favicon for the this node. If the favicon has not yet been - // loaded it is loaded and the observer of the model notified when done. - const SkBitmap& GetFavIcon(); - // Returns the URL. const GURL& GetURL() const { return url_; } @@ -99,12 +95,17 @@ class BookmarkNode : public TreeNode { // HistoryContentsProvider. private: - // Creates a new node with the given properties. - BookmarkNode(BookmarkModel* model, const GURL& url); - BookmarkNode(BookmarkModel* model, int id, const GURL& url); + // Creates a new node with the specified url and id of 0 + explicit BookmarkNode(const GURL& url); + // Creates a new node with the specified url and id. + BookmarkNode(int id, const GURL& url); + + // Returns the favicon for the this node. If the favicon has not yet been + // loaded it is loaded and the observer of the model notified when done. + const SkBitmap& favicon() const { return favicon_; } // helper to initialize various fields during construction. - void Initialize(BookmarkModel* model, int id); + void Initialize(int id); // Resets the properties of the node from the supplied entry. void Reset(const history::StarredEntry& entry); @@ -112,9 +113,6 @@ class BookmarkNode : public TreeNode { // Sets the id to the given value. void set_id(int id) { id_ = id; } - // The model. This is NULL when created by StarredURLDatabase for migration. - BookmarkModel* model_; - // Unique identifier for this node. int id_; @@ -249,6 +247,10 @@ class BookmarkModel : public NotificationObserver, public BookmarkService { // Moves the specified entry to a new location. void Move(BookmarkNode* node, BookmarkNode* new_parent, int index); + // Returns the favicon for |node|. If the favicon has not yet been + // loaded it is loaded and the observer of the model notified when done. + const SkBitmap& GetFavIcon(BookmarkNode* node); + // Sets the title of the specified node. void SetTitle(BookmarkNode* node, const std::wstring& title); -- cgit v1.1