Index: chrome/browser/bookmarks/bookmark_model.h |
diff --git a/chrome/browser/bookmarks/bookmark_model.h b/chrome/browser/bookmarks/bookmark_model.h |
index 816b89b627113e8062d997948e92060e6f814f54..f78b0b5d248d6eaf91cb5416cf68cf7dd6b33c2b 100644 |
--- a/chrome/browser/bookmarks/bookmark_model.h |
+++ b/chrome/browser/bookmarks/bookmark_model.h |
@@ -17,13 +17,9 @@ |
#include "base/strings/string16.h" |
#include "base/synchronization/lock.h" |
#include "base/synchronization/waitable_event.h" |
-#include "base/task/cancelable_task_tracker.h" |
+#include "components/bookmarks/core/browser/bookmark_client.h" |
#include "components/bookmarks/core/browser/bookmark_node.h" |
#include "components/bookmarks/core/browser/bookmark_service.h" |
-#include "components/favicon_base/favicon_types.h" |
-#include "components/keyed_service/core/keyed_service.h" |
-#include "content/public/browser/notification_observer.h" |
-#include "content/public/browser/notification_registrar.h" |
#include "ui/gfx/image/image.h" |
#include "url/gurl.h" |
@@ -33,17 +29,22 @@ class BookmarkLoadDetails; |
class BookmarkModelObserver; |
class BookmarkStorage; |
struct BookmarkMatch; |
-class Profile; |
+class PrefService; |
class ScopedGroupBookmarkActions; |
namespace base { |
+class FilePath; |
class SequencedTaskRunner; |
} |
-namespace chrome { |
+namespace favicon_base { |
struct FaviconImageResult; |
} |
+namespace test { |
+class TestBookmarkClient; |
+} |
+ |
// BookmarkModel -------------------------------------------------------------- |
// BookmarkModel provides a directed acyclic graph of URLs and folders. |
@@ -54,22 +55,25 @@ struct FaviconImageResult; |
// |
// You should NOT directly create a BookmarkModel, instead go through the |
// BookmarkModelFactory. |
-class BookmarkModel : public content::NotificationObserver, |
- public BookmarkService, |
- public KeyedService { |
+class BookmarkModel : public BookmarkService { |
public: |
// |index_urls| says whether URLs should be stored in the BookmarkIndex |
// in addition to bookmark titles. |
- BookmarkModel(Profile* profile, bool index_urls); |
+ BookmarkModel(BookmarkClient* client, bool index_urls); |
virtual ~BookmarkModel(); |
// Invoked prior to destruction to release any necessary resources. |
- virtual void Shutdown() OVERRIDE; |
+ void Shutdown(); |
// Loads the bookmarks. This is called upon creation of the |
// BookmarkModel. You need not invoke this directly. |
- // All load operations will be executed on |task_runner|. |
- void Load(const scoped_refptr<base::SequencedTaskRunner>& task_runner); |
+ // All load operations will be executed on |io_task_runner| and the completion |
+ // callback will be called from |ui_task_runner|. |
+ void Load(PrefService* pref_service, |
+ const std::string& accept_languages, |
+ const base::FilePath& profile_path, |
+ const scoped_refptr<base::SequencedTaskRunner>& io_task_runner, |
+ const scoped_refptr<base::SequencedTaskRunner>& ui_task_runner); |
// Returns true if the model finished loading. |
bool loaded() const { return loaded_; } |
@@ -249,14 +253,19 @@ class BookmarkModel : public content::NotificationObserver, |
void SetNodeSyncTransactionVersion(const BookmarkNode* node, |
int64 sync_transaction_version); |
- // Returns the profile that corresponds to this BookmarkModel. |
- Profile* profile() { return profile_; } |
+ // Notify BookmarkModel that the favicons for |urls| have changed and have to |
+ // be refetched. This notification is sent by BookmarkClient. |
+ void OnFaviconChanged(const std::set<GURL>& urls); |
+ |
+ // Returns the client used by this BookmarkModel. |
+ BookmarkClient* client() const { return client_; } |
private: |
friend class BookmarkCodecTest; |
friend class BookmarkModelTest; |
friend class BookmarkStorage; |
friend class ScopedGroupBookmarkActions; |
+ friend class test::TestBookmarkClient; |
// Used to order BookmarkNodes by URL. |
class NodeURLComparator { |
@@ -297,10 +306,6 @@ class BookmarkModel : public content::NotificationObserver, |
// Remove |node| from |nodes_ordered_by_url_set_|. |
void RemoveNodeFromURLSet(BookmarkNode* node); |
- // Notifies the history backend about urls of removed bookmarks. |
- void NotifyHistoryAboutRemovedBookmarks( |
- const std::set<GURL>& removed_bookmark_urls) const; |
- |
// Adds the |node| at |parent| in the specified |index| and notifies its |
// observers. |
BookmarkNode* AddNode(BookmarkNode* parent, |
@@ -335,11 +340,6 @@ class BookmarkModel : public content::NotificationObserver, |
void BeginGroupedChanges(); |
void EndGroupedChanges(); |
- // content::NotificationObserver: |
- virtual void Observe(int type, |
- const content::NotificationSource& source, |
- const content::NotificationDetails& details) OVERRIDE; |
- |
// Generates and returns the next node ID. |
int64 generate_next_node_id(); |
@@ -350,11 +350,9 @@ class BookmarkModel : public content::NotificationObserver, |
// Creates and returns a new BookmarkLoadDetails. It's up to the caller to |
// delete the returned object. |
- BookmarkLoadDetails* CreateLoadDetails(); |
- |
- content::NotificationRegistrar registrar_; |
+ BookmarkLoadDetails* CreateLoadDetails(const std::string& accept_languages); |
- Profile* profile_; |
+ BookmarkClient* const client_; |
// Whether the initial set of data has been loaded. |
bool loaded_; |