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_FACTORY_H_ | 5 #ifndef CHROME_BROWSER_BOOKMARKS_BOOKMARK_MODEL_FACTORY_H_ |
6 #define CHROME_BROWSER_BOOKMARKS_BOOKMARK_MODEL_FACTORY_H_ | 6 #define CHROME_BROWSER_BOOKMARKS_BOOKMARK_MODEL_FACTORY_H_ |
7 | 7 |
8 #include "base/memory/singleton.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/compiler_specific.h" |
9 #include "chrome/browser/profiles/profile_keyed_service_factory.h" | 10 #include "chrome/browser/profiles/profile_keyed_service_factory.h" |
10 | 11 |
| 12 template <typename T> struct DefaultSingletonTraits; |
| 13 |
11 class Profile; | 14 class Profile; |
12 class BookmarkModel; | 15 class BookmarkModel; |
13 | 16 |
14 // Singleton that owns all BookmarkModel and associates them with | 17 // Singleton that owns all BookmarkModel and associates them with |
15 // Profiles. | 18 // Profiles. |
16 class BookmarkModelFactory : public ProfileKeyedServiceFactory { | 19 class BookmarkModelFactory : public ProfileKeyedServiceFactory { |
17 public: | 20 public: |
18 static BookmarkModel* GetForProfile(Profile* profile); | 21 static BookmarkModel* GetForProfile(Profile* profile); |
19 | 22 |
20 static BookmarkModel* GetForProfileIfExists(Profile* profile); | 23 static BookmarkModel* GetForProfileIfExists(Profile* profile); |
21 | 24 |
22 static BookmarkModelFactory* GetInstance(); | 25 static BookmarkModelFactory* GetInstance(); |
23 | 26 |
24 private: | 27 private: |
25 friend struct DefaultSingletonTraits<BookmarkModelFactory>; | 28 friend struct DefaultSingletonTraits<BookmarkModelFactory>; |
26 | 29 |
27 BookmarkModelFactory(); | 30 BookmarkModelFactory(); |
28 virtual ~BookmarkModelFactory(); | 31 virtual ~BookmarkModelFactory(); |
29 | 32 |
30 // ProfileKeyedServiceFactory: | 33 // ProfileKeyedServiceFactory: |
31 virtual ProfileKeyedService* BuildServiceInstanceFor( | 34 virtual ProfileKeyedService* BuildServiceInstanceFor( |
32 Profile* profile) const OVERRIDE; | 35 Profile* profile) const OVERRIDE; |
33 virtual void RegisterUserPrefs(PrefService* user_prefs) OVERRIDE; | 36 virtual void RegisterUserPrefs(PrefService* user_prefs) OVERRIDE; |
34 virtual bool ServiceRedirectedInIncognito() OVERRIDE; | 37 virtual bool ServiceRedirectedInIncognito() OVERRIDE; |
35 virtual bool ServiceIsNULLWhileTesting() OVERRIDE; | 38 virtual bool ServiceIsNULLWhileTesting() OVERRIDE; |
| 39 |
| 40 DISALLOW_COPY_AND_ASSIGN(BookmarkModelFactory); |
36 }; | 41 }; |
37 | 42 |
38 #endif // CHROME_BROWSER_BOOKMARKS_BOOKMARK_MODEL_FACTORY_H_ | 43 #endif // CHROME_BROWSER_BOOKMARKS_BOOKMARK_MODEL_FACTORY_H_ |
OLD | NEW |