diff options
author | joaodasilva@chromium.org <joaodasilva@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-06-14 00:11:31 +0000 |
---|---|---|
committer | joaodasilva@chromium.org <joaodasilva@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-06-14 00:11:31 +0000 |
commit | 0b0e8a11546c1d88f79795ee36b621646baf4ee3 (patch) | |
tree | 649241411b8ef54c4661d0e4e216a5f4ec77b671 /components | |
parent | 3e58411cd5dc8c004b97de6b1a8c32a1d16a5afb (diff) | |
download | chromium_src-0b0e8a11546c1d88f79795ee36b621646baf4ee3.zip chromium_src-0b0e8a11546c1d88f79795ee36b621646baf4ee3.tar.gz chromium_src-0b0e8a11546c1d88f79795ee36b621646baf4ee3.tar.bz2 |
Introduce ChromeBookmarkClientFactory
Fix BookmarkModelFactory to really build a BookmarkModel object and
introduce another factory ChromeBookmarkClientFactory to build the
ChromeBookmarkClient and manage the correct dependency between the
two objects.
Change BookmarkModelFactory::GetChromeBookmarkClientForProfile and
clients to instead use ChromeBookmarkClientFactory::GetForProfile.
BUG=364865
TBR=blundell@chromium.org
Review URL: https://codereview.chromium.org/330343002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@277138 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'components')
-rw-r--r-- | components/bookmarks.gypi | 3 | ||||
-rw-r--r-- | components/bookmarks/DEPS | 1 | ||||
-rw-r--r-- | components/bookmarks/browser/bookmark_client.h | 3 | ||||
-rw-r--r-- | components/bookmarks/browser/bookmark_model.h | 9 | ||||
-rw-r--r-- | components/policy/policy_browser.gypi | 1 |
5 files changed, 11 insertions, 6 deletions
diff --git a/components/bookmarks.gypi b/components/bookmarks.gypi index 158eafe..4fbc05f 100644 --- a/components/bookmarks.gypi +++ b/components/bookmarks.gypi @@ -20,9 +20,10 @@ 'bookmarks_common', 'components_strings.gyp:components_strings', 'favicon_base', + 'keyed_service_core', + 'pref_registry', 'query_parser', 'startup_metric_utils', - 'pref_registry', ], 'sources': [ 'bookmarks/browser/base_bookmark_model_observer.cc', diff --git a/components/bookmarks/DEPS b/components/bookmarks/DEPS index 56c12e3..f5adbc8 100644 --- a/components/bookmarks/DEPS +++ b/components/bookmarks/DEPS @@ -1,5 +1,6 @@ include_rules = [ "+components/favicon_base", + "+components/keyed_service", "+components/pref_registry", "+components/query_parser", "+components/startup_metric_utils", diff --git a/components/bookmarks/browser/bookmark_client.h b/components/bookmarks/browser/bookmark_client.h index fa0dc63..9a4d663 100644 --- a/components/bookmarks/browser/bookmark_client.h +++ b/components/bookmarks/browser/bookmark_client.h @@ -13,6 +13,7 @@ #include "base/task/cancelable_task_tracker.h" #include "components/bookmarks/browser/bookmark_storage.h" #include "components/favicon_base/favicon_callback.h" +#include "components/keyed_service/core/keyed_service.h" class BookmarkNode; class BookmarkPermanentNode; @@ -24,7 +25,7 @@ struct UserMetricsAction; // This class abstracts operations that depends on the embedder's environment, // e.g. Chrome. -class BookmarkClient { +class BookmarkClient : public KeyedService { public: // Types representing a set of BookmarkNode and a mapping from BookmarkNode // to the number of time the corresponding URL has been typed by the user in diff --git a/components/bookmarks/browser/bookmark_model.h b/components/bookmarks/browser/bookmark_model.h index 128f0c7..551b90f2 100644 --- a/components/bookmarks/browser/bookmark_model.h +++ b/components/bookmarks/browser/bookmark_model.h @@ -19,6 +19,7 @@ #include "base/synchronization/waitable_event.h" #include "components/bookmarks/browser/bookmark_client.h" #include "components/bookmarks/browser/bookmark_node.h" +#include "components/keyed_service/core/keyed_service.h" #include "ui/gfx/image/image.h" #include "url/gurl.h" @@ -57,7 +58,7 @@ class TestBookmarkClient; // // You should NOT directly create a BookmarkModel, instead go through the // BookmarkModelFactory. -class BookmarkModel { +class BookmarkModel : public KeyedService { public: struct URLAndTitle { GURL url; @@ -67,10 +68,10 @@ class BookmarkModel { // |index_urls| says whether URLs should be stored in the BookmarkIndex // in addition to bookmark titles. BookmarkModel(BookmarkClient* client, bool index_urls); - ~BookmarkModel(); + virtual ~BookmarkModel(); - // Invoked prior to destruction to release any necessary resources. - void Shutdown(); + // KeyedService: + virtual void Shutdown() OVERRIDE; // Loads the bookmarks. This is called upon creation of the // BookmarkModel. You need not invoke this directly. diff --git a/components/policy/policy_browser.gypi b/components/policy/policy_browser.gypi index 014ffac..9d7df97 100644 --- a/components/policy/policy_browser.gypi +++ b/components/policy/policy_browser.gypi @@ -12,6 +12,7 @@ '../url/url.gyp:url_lib', 'bookmarks_browser', 'components_strings.gyp:components_strings', + 'keyed_service_core', 'pref_registry', 'url_matcher', ], |