webview_apk_process.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. // Copyright 2021 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 ANDROID_WEBVIEW_NONEMBEDDED_WEBVIEW_APK_PROCESS_H_
  5. #define ANDROID_WEBVIEW_NONEMBEDDED_WEBVIEW_APK_PROCESS_H_
  6. #include <memory>
  7. #include "base/sequence_checker.h"
  8. #include "base/task/single_thread_task_executor.h"
  9. #include "components/prefs/pref_service.h"
  10. class PrefRegistrySimple;
  11. namespace android_webview {
  12. // Class that holds global state in the webview apk process.
  13. class WebViewApkProcess {
  14. public:
  15. static void Init();
  16. static WebViewApkProcess* GetInstance();
  17. PrefService* GetPrefService() const;
  18. private:
  19. WebViewApkProcess();
  20. ~WebViewApkProcess();
  21. void CreatePrefService();
  22. void RegisterPrefs(PrefRegistrySimple* pref_registry);
  23. std::unique_ptr<PrefService> pref_service_;
  24. std::unique_ptr<base::SingleThreadTaskExecutor> main_task_executor_;
  25. SEQUENCE_CHECKER(sequence_checker_);
  26. };
  27. } // namespace android_webview
  28. #endif // ANDROID_WEBVIEW_NONEMBEDDED_WEBVIEW_APK_PROCESS_H_