Chromium Code Reviews
|
| OLD | NEW |
|---|---|
| (Empty) | |
| 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. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_HISTORY_SHORTCUTS_BACKEND_FACTORY_H_ | |
| 6 #define CHROME_BROWSER_HISTORY_SHORTCUTS_BACKEND_FACTORY_H_ | |
| 7 #pragma once | |
| 8 | |
| 9 #include "base/memory/ref_counted.h" | |
| 10 #include "base/memory/singleton.h" | |
| 11 #include "chrome/browser/profiles/refcounted_profile_keyed_service_factory.h" | |
| 12 | |
| 13 class Profile; | |
| 14 | |
| 15 namespace history { | |
| 16 class ShortcutsBackend; | |
| 17 } // namespace history | |
| 18 | |
| 19 // Singleton that owns all instances of ShortcutsBackend and associates them | |
| 20 // with Profiles. | |
| 21 class ShortcutsBackendFactory : public RefcountedProfileKeyedServiceFactory { | |
| 22 public: | |
| 23 static scoped_refptr<history::ShortcutsBackend> GetForProfile( | |
| 24 Profile* profile); | |
| 25 | |
| 26 static scoped_refptr<history::ShortcutsBackend> GetForProfileIfExists( | |
| 27 Profile* profile); | |
| 28 | |
| 29 static ShortcutsBackendFactory* GetInstance(); | |
| 30 | |
| 31 // Creates and returns a backend for testing purposes. | |
| 32 static scoped_refptr<RefcountedProfileKeyedService> | |
| 33 GetForProfileForTesting(Profile* profile); | |
|
rpetterson
2012/06/29 20:57:06
I think a better name would be BuildProfileForTest
mrossetti
2012/07/02 18:31:39
Done.
| |
| 34 | |
| 35 // Creates and returns a backend but without creating its persistant database | |
| 36 // for testing purposes. | |
| 37 static scoped_refptr<RefcountedProfileKeyedService> | |
| 38 GetForProfileNoDatabaseForTesting(Profile* profile); | |
|
rpetterson
2012/06/29 20:57:06
Same as above, BuildProfileNoDatabaseForTesting.
mrossetti
2012/07/02 18:31:39
Done.
| |
| 39 | |
| 40 private: | |
| 41 friend struct DefaultSingletonTraits<ShortcutsBackendFactory>; | |
| 42 | |
| 43 ShortcutsBackendFactory(); | |
| 44 virtual ~ShortcutsBackendFactory(); | |
| 45 | |
| 46 // ProfileKeyedServiceFactory: | |
| 47 virtual scoped_refptr<RefcountedProfileKeyedService> BuildServiceInstanceFor( | |
| 48 Profile* profile) const OVERRIDE; | |
| 49 virtual bool ServiceIsNULLWhileTesting() OVERRIDE; | |
| 50 }; | |
| 51 | |
| 52 #endif // CHROME_BROWSER_HISTORY_SHORTCUTS_BACKEND_FACTORY_H_ | |
| OLD | NEW |