1 // Copyright 2020 The Chromium Embedded Framework Authors. 2 // Portions copyright 2012 The Chromium Authors. All rights reserved. 3 // Use of this source code is governed by a BSD-style license that can be 4 // found in the LICENSE file. 5 6 #ifndef CEF_LIBCEF_COMMON_ALLOY_ALLOY_MAIN_RUNNER_DELEGATE_ 7 #define CEF_LIBCEF_COMMON_ALLOY_ALLOY_MAIN_RUNNER_DELEGATE_ 8 9 #include <memory> 10 11 #include "include/cef_base.h" 12 #include "libcef/common/main_runner_delegate.h" 13 #include "libcef/common/main_runner_handler.h" 14 15 class AlloyMainDelegate; 16 17 class AlloyMainRunnerDelegate : public CefMainRunnerDelegate { 18 public: 19 // |runner| and |settings| will be non-nullptr for the main process only, and 20 // will outlive this object. 21 AlloyMainRunnerDelegate(CefMainRunnerHandler* runner, 22 CefSettings* settings, 23 CefRefPtr<CefApp> application); 24 25 AlloyMainRunnerDelegate(const AlloyMainRunnerDelegate&) = delete; 26 AlloyMainRunnerDelegate& operator=(const AlloyMainRunnerDelegate&) = delete; 27 28 ~AlloyMainRunnerDelegate() override; 29 30 protected: 31 // CefMainRunnerDelegate overrides. 32 content::ContentMainDelegate* GetContentMainDelegate() override; 33 void BeforeMainThreadInitialize(const CefMainArgs& args) override; 34 void BeforeMainThreadRun() override; 35 void AfterUIThreadInitialize() override; 36 void AfterUIThreadShutdown() override; 37 void BeforeMainThreadShutdown() override; 38 void AfterMainThreadShutdown() override; 39 40 private: 41 std::unique_ptr<AlloyMainDelegate> main_delegate_; 42 43 CefMainRunnerHandler* const runner_; 44 CefSettings* const settings_; 45 CefRefPtr<CefApp> application_; 46 }; 47 48 #endif // CEF_LIBCEF_COMMON_ALLOY_ALLOY_MAIN_RUNNER_DELEGATE_ 49