// Copyright © 2010-2015 The CefSharp Authors. All rights reserved. // // Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. #pragma once #include "Stdafx.h" #include "Internals/StringUtils.h" using namespace System; using namespace System::Collections::Generic; using namespace CefSharp::Internals; namespace CefSharp { public ref class CefSettings { private: List^ _cefCustomSchemes; IDictionary^ _cefCommandLineArgs; internal: ::CefSettings* _cefSettings; public: CefSettings() : _cefSettings(new ::CefSettings()) { _cefSettings->multi_threaded_message_loop = true; _cefSettings->no_sandbox = true; BrowserSubprocessPath = "CefSharp.BrowserSubprocess.exe"; _cefCustomSchemes = gcnew List(); _cefCommandLineArgs = gcnew Dictionary(); } !CefSettings() { delete _cefSettings; } ~CefSettings() { delete _cefSettings; } virtual property IEnumerable^ CefCustomSchemes { IEnumerable^ get() { return _cefCustomSchemes; } } virtual property IDictionary^ CefCommandLineArgs { IDictionary^ get() { return _cefCommandLineArgs; } } virtual property bool MultiThreadedMessageLoop { bool get() { return _cefSettings->multi_threaded_message_loop == 1; } } virtual property String^ BrowserSubprocessPath { String^ get() { return StringUtils::ToClr(_cefSettings->browser_subprocess_path); } void set(String^ value) { StringUtils::AssignNativeFromClr(_cefSettings->browser_subprocess_path, value); } } virtual property String^ CachePath { String^ get() { return StringUtils::ToClr(_cefSettings->cache_path); } void set(String^ value) { StringUtils::AssignNativeFromClr(_cefSettings->cache_path, value); } } virtual property bool IgnoreCertificateErrors { bool get() { return _cefSettings->ignore_certificate_errors == 1; } void set(bool value) { _cefSettings->ignore_certificate_errors = value; } } virtual property String^ Locale { String^ get() { return StringUtils::ToClr(_cefSettings->locale); } void set(String^ value) { StringUtils::AssignNativeFromClr(_cefSettings->locale, value); } } virtual property String^ LocalesDirPath { String^ get() { return StringUtils::ToClr(_cefSettings->locales_dir_path); } void set(String^ value) { StringUtils::AssignNativeFromClr(_cefSettings->locales_dir_path, value); } } virtual property String^ ResourcesDirPath { String^ get() { return StringUtils::ToClr(_cefSettings->resources_dir_path); } void set(String^ value) { StringUtils::AssignNativeFromClr(_cefSettings->resources_dir_path, value); } } virtual property String^ LogFile { String^ get() { return StringUtils::ToClr(_cefSettings->log_file); } void set(String^ value) { StringUtils::AssignNativeFromClr(_cefSettings->log_file, value); } } virtual property CefSharp::LogSeverity LogSeverity { CefSharp::LogSeverity get() { return (CefSharp::LogSeverity)_cefSettings->log_severity; } void set(CefSharp::LogSeverity value) { _cefSettings->log_severity = (cef_log_severity_t)value; } } virtual property bool PackLoadingDisabled { bool get() { return _cefSettings->pack_loading_disabled == 1; } void set(bool value) { _cefSettings->pack_loading_disabled = value; } } virtual property String^ ProductVersion { String^ get() { return StringUtils::ToClr(_cefSettings->product_version); } void set(String^ value) { StringUtils::AssignNativeFromClr(_cefSettings->product_version, value); } } virtual property int RemoteDebuggingPort { int get() { return _cefSettings->remote_debugging_port; } void set(int value) { _cefSettings->remote_debugging_port = value; } } virtual property String^ UserAgent { String^ get() { return StringUtils::ToClr(_cefSettings->user_agent); } void set(String^ value) { StringUtils::AssignNativeFromClr(_cefSettings->user_agent, value); } } virtual property bool WindowlessRenderingEnabled { bool get() { return _cefSettings->windowless_rendering_enabled == 1; } void set(bool value) { _cefSettings->windowless_rendering_enabled = value; } } virtual property bool PersistSessionCookies { bool get() { return _cefSettings->persist_session_cookies == 1; } void set(bool value) { _cefSettings->persist_session_cookies = value; } } /// /// Registers a custom scheme using the provided settings. /// /// The CefCustomScheme which provides the details about the scheme. void RegisterScheme(CefCustomScheme^ cefCustomScheme) { _cefCustomSchemes->Add(cefCustomScheme); } }; }