// Copyright (c) 2013 The Chromium Embedded Framework Authors. All rights // reserved. Use of this source code is governed by a BSD-style license that // can be found in the LICENSE file. #ifndef CEF_TESTS_CEFSIMPLE_SIMPLE_APP_H_ #define CEF_TESTS_CEFSIMPLE_SIMPLE_APP_H_ #include #include "webview_handler.h" #include "webview_js_handler.h" // Implement application-level callbacks for the browser process. class WebviewApp : public CefApp, public CefBrowserProcessHandler, public CefRenderProcessHandler{ public: WebviewApp(CefRefPtr handler); WebviewApp(){}; enum ProcessType{ BrowserProcess, RendererProcess, ZygoteProcess, OtherProcess, }; static ProcessType GetProcessType(CefRefPtr command_line); // CefApp methods: CefRefPtr GetBrowserProcessHandler() override { return this; } CefRefPtr GetRenderProcessHandler() override { return this; } // CefBrowserProcessHandler methods: void OnBeforeCommandLineProcessing( const CefString& process_type, CefRefPtr command_line) override; void SetProcessMode(uint32_t uMode); void SetEnableGPU(bool bEnable); void OnContextInitialized() override; // CefRefPtr GetDefaultClient() override; void OnBeforeChildProcessLaunch(CefRefPtr command_line) override; void SetUnSafelyTreatInsecureOriginAsSecure(const CefString& strFilterDomain); // JJ_MKVMaker: 모든 연결을 이 프록시로 (DNS 강제, JJ_PATCH.md 6). 빈 값이면 없음 void SetProxyServer(const std::string& proxy) { m_strProxyServer = proxy; } // JJ_MKVMaker: 관리자 권한으로 실행 중이어도 권한을 낮춰 다시 띄우지 않는다 (사용자가 설정에서 고른 때만, JJ_PATCH.md 7) void SetDoNotDeElevate(bool v) { m_bDoNotDeElevate = v; } // CefRenderProcessHandler methods. void OnWebKitInitialized() override; void OnBrowserCreated( CefRefPtr browser, CefRefPtr extra_info) override; void OnBrowserDestroyed(CefRefPtr browser) override; void OnContextCreated( CefRefPtr browser, CefRefPtr frame, CefRefPtr context) override; void OnContextReleased( CefRefPtr browser, CefRefPtr frame, CefRefPtr context) override; void OnUncaughtException( CefRefPtr browser, CefRefPtr frame, CefRefPtr context, CefRefPtr exception, CefRefPtr stackTrace) override; void OnFocusedNodeChanged( CefRefPtr browser, CefRefPtr frame, CefRefPtr node) override; bool OnProcessMessageReceived( CefRefPtr browser, CefRefPtr frame, CefProcessId source_process, CefRefPtr message) override; private: uint32_t m_uMode = 1; //process mode bool m_bEnableGPU = false; //enable gpu std::string m_strProxyServer; bool m_bDoNotDeElevate = false; CefString m_strFilterDomain; //insecure domain whitelist CefRefPtr m_handler; //webview handler for main process std::shared_ptr m_render_js_bridge; //js bridge for render process // Include the default reference counting implementation. IMPLEMENT_REFCOUNTING(WebviewApp); }; #endif // CEF_TESTS_CEFSIMPLE_SIMPLE_APP_H_