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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_BOOKMARKS_BOOKMARK_MODEL_FACTORY_H_
6 #define CHROME_BROWSER_BOOKMARKS_BOOKMARK_MODEL_FACTORY_H_
8 #include "base/macros.h"
9 #include "components/keyed_service/content/browser_context_keyed_service_factory.h"
12 template <typename T
> struct DefaultSingletonTraits
;
21 // Singleton that owns all BookmarkModels and associates them with Profiles.
22 class BookmarkModelFactory
: public BrowserContextKeyedServiceFactory
{
24 static bookmarks::BookmarkModel
* GetForProfile(Profile
* profile
);
26 static bookmarks::BookmarkModel
* GetForProfileIfExists(Profile
* profile
);
28 static BookmarkModelFactory
* GetInstance();
31 friend struct base::DefaultSingletonTraits
<BookmarkModelFactory
>;
33 BookmarkModelFactory();
34 ~BookmarkModelFactory() override
;
36 // BrowserContextKeyedServiceFactory:
37 KeyedService
* BuildServiceInstanceFor(
38 content::BrowserContext
* context
) const override
;
39 void RegisterProfilePrefs(
40 user_prefs::PrefRegistrySyncable
* registry
) override
;
41 content::BrowserContext
* GetBrowserContextToUse(
42 content::BrowserContext
* context
) const override
;
43 bool ServiceIsNULLWhileTesting() const override
;
45 DISALLOW_COPY_AND_ASSIGN(BookmarkModelFactory
);
48 #endif // CHROME_BROWSER_BOOKMARKS_BOOKMARK_MODEL_FACTORY_H_