/chromium-webcl/src/chrome/browser/background/background_contents_service_factory.h

https://bitbucket.org/peixuan/chromium_r197479_base · C Header · 41 lines · 24 code · 9 blank · 8 comment · 0 complexity · dcd7fcbf5b403f36b61aa0f86147a1cb MD5 · raw file

  1. // Copyright (c) 2011 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. #ifndef CHROME_BROWSER_BACKGROUND_BACKGROUND_CONTENTS_SERVICE_FACTORY_H_
  5. #define CHROME_BROWSER_BACKGROUND_BACKGROUND_CONTENTS_SERVICE_FACTORY_H_
  6. #include "base/compiler_specific.h"
  7. #include "base/memory/singleton.h"
  8. #include "chrome/browser/profiles/profile_keyed_service_factory.h"
  9. class BackgroundContentsService;
  10. class PrefRegistrySyncable;
  11. class Profile;
  12. // Singleton that owns all BackgroundContentsServices and associates them with
  13. // Profiles. Listens for the Profile's destruction notification and cleans up
  14. // the associated BackgroundContentsService.
  15. class BackgroundContentsServiceFactory : public ProfileKeyedServiceFactory {
  16. public:
  17. static BackgroundContentsService* GetForProfile(Profile* profile);
  18. static BackgroundContentsServiceFactory* GetInstance();
  19. private:
  20. friend struct DefaultSingletonTraits<BackgroundContentsServiceFactory>;
  21. BackgroundContentsServiceFactory();
  22. virtual ~BackgroundContentsServiceFactory();
  23. // ProfileKeyedServiceFactory:
  24. virtual ProfileKeyedService* BuildServiceInstanceFor(
  25. content::BrowserContext* profile) const OVERRIDE;
  26. virtual void RegisterUserPrefs(PrefRegistrySyncable* registry) OVERRIDE;
  27. // Use a separate background contents service for incognito.
  28. virtual bool ServiceHasOwnInstanceInIncognito() const OVERRIDE;
  29. virtual bool ServiceIsCreatedWithProfile() const OVERRIDE;
  30. virtual bool ServiceIsNULLWhileTesting() const OVERRIDE;
  31. };
  32. #endif // CHROME_BROWSER_BACKGROUND_BACKGROUND_CONTENTS_SERVICE_FACTORY_H_