session_preferences.h 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. // Copyright (c) 2017 GitHub, Inc.
  2. // Use of this source code is governed by the MIT license that can be
  3. // found in the LICENSE file.
  4. #ifndef ELECTRON_SHELL_BROWSER_SESSION_PREFERENCES_H_
  5. #define ELECTRON_SHELL_BROWSER_SESSION_PREFERENCES_H_
  6. #include <vector>
  7. #include "base/files/file_path.h"
  8. #include "base/supports_user_data.h"
  9. #include "shell/browser/preload_script.h"
  10. namespace content {
  11. class BrowserContext;
  12. }
  13. namespace electron {
  14. class SessionPreferences : public base::SupportsUserData::Data {
  15. public:
  16. static SessionPreferences* FromBrowserContext(
  17. content::BrowserContext* context);
  18. static void CreateForBrowserContext(content::BrowserContext* context);
  19. ~SessionPreferences() override;
  20. std::vector<PreloadScript>& preload_scripts() { return preload_scripts_; }
  21. bool HasServiceWorkerPreloadScript();
  22. private:
  23. SessionPreferences();
  24. // The user data key.
  25. static int kLocatorKey;
  26. std::vector<PreloadScript> preload_scripts_;
  27. };
  28. } // namespace electron
  29. #endif // ELECTRON_SHELL_BROWSER_SESSION_PREFERENCES_H_