/ios/chrome/browser/history/history_service_factory.h

https://gitlab.com/jonnialva90/iridium-browser · C Header · 57 lines · 37 code · 14 blank · 6 comment · 0 complexity · a6ae8c4ad0b261b837d35002013cd147 MD5 · raw file

  1. // Copyright 2015 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 IOS_CHROME_BROWSER_HISTORY_HISTORY_SERVICE_FACTORY_H_
  5. #define IOS_CHROME_BROWSER_HISTORY_HISTORY_SERVICE_FACTORY_H_
  6. #include "base/macros.h"
  7. #include "base/memory/scoped_ptr.h"
  8. #include "components/keyed_service/ios/browser_state_keyed_service_factory.h"
  9. namespace base {
  10. template <typename T>
  11. struct DefaultSingletonTraits;
  12. } // namespace base
  13. enum class ServiceAccessType;
  14. namespace history {
  15. class HistoryService;
  16. }
  17. namespace ios {
  18. class ChromeBrowserState;
  19. // Singleton that owns all HistoryServices and associates them with
  20. // ios::ChromeBrowserState.
  21. class HistoryServiceFactory : public BrowserStateKeyedServiceFactory {
  22. public:
  23. static history::HistoryService* GetForBrowserState(
  24. ios::ChromeBrowserState* browser_state,
  25. ServiceAccessType access_type);
  26. static history::HistoryService* GetForBrowserStateIfExists(
  27. ios::ChromeBrowserState* browser_state,
  28. ServiceAccessType access_type);
  29. static HistoryServiceFactory* GetInstance();
  30. private:
  31. friend struct base::DefaultSingletonTraits<HistoryServiceFactory>;
  32. HistoryServiceFactory();
  33. ~HistoryServiceFactory() override;
  34. // BrowserStateKeyedServiceFactory implementation.
  35. scoped_ptr<KeyedService> BuildServiceInstanceFor(
  36. web::BrowserState* context) const override;
  37. web::BrowserState* GetBrowserStateToUse(
  38. web::BrowserState* context) const override;
  39. bool ServiceIsNULLWhileTesting() const override;
  40. DISALLOW_COPY_AND_ASSIGN(HistoryServiceFactory);
  41. };
  42. } // namespace ios
  43. #endif // IOS_CHROME_BROWSER_HISTORY_HISTORY_SERVICE_FACTORY_H_