simple_factory_key.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435
  1. // Copyright 2019 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 COMPONENTS_KEYED_SERVICE_CORE_SIMPLE_FACTORY_KEY_H_
  5. #define COMPONENTS_KEYED_SERVICE_CORE_SIMPLE_FACTORY_KEY_H_
  6. #include "base/files/file_path.h"
  7. #include "components/keyed_service/core/keyed_service_export.h"
  8. // A key used by SimpleKeyedServiceFactory is used to associated the
  9. // KeyedService instances. It is a way to have KeyedService without depending on
  10. // a more complex context. It can be mixed with more heavy-weight
  11. // KeyedServiceFactories if there is a unique mapping between the
  12. // SimpleFactoryKey and the more complex context. This mapping is the
  13. // responsibility of the embedder.
  14. class KEYED_SERVICE_EXPORT SimpleFactoryKey {
  15. public:
  16. SimpleFactoryKey(const base::FilePath& path, bool is_off_the_record = false);
  17. SimpleFactoryKey(const SimpleFactoryKey&) = delete;
  18. SimpleFactoryKey& operator=(const SimpleFactoryKey&) = delete;
  19. virtual ~SimpleFactoryKey();
  20. const base::FilePath& GetPath() const { return path_; }
  21. bool IsOffTheRecord() const { return is_off_the_record_; }
  22. private:
  23. base::FilePath path_;
  24. bool is_off_the_record_;
  25. };
  26. #endif // COMPONENTS_KEYED_SERVICE_CORE_SIMPLE_FACTORY_KEY_H_