/
CefSettings.h
139 lines (115 loc) · 5.15 KB
/
CefSettings.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
// 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<CefCustomScheme^>^ _cefCustomSchemes;
IDictionary<String^, String^>^ _cefCommandLineArgs;
internal:
::CefSettings* _cefSettings;
public:
CefSettings() : _cefSettings(new ::CefSettings())
{
_cefSettings->multi_threaded_message_loop = true;
BrowserSubprocessPath = "CefSharp.BrowserSubprocess.exe";
_cefCustomSchemes = gcnew List<CefCustomScheme^>();
_cefCommandLineArgs = gcnew Dictionary<String^, String^>();
}
!CefSettings() { delete _cefSettings; }
~CefSettings() { delete _cefSettings; }
virtual property IEnumerable<CefCustomScheme^>^ CefCustomSchemes
{
IEnumerable<CefCustomScheme^>^ get() { return _cefCustomSchemes; }
}
virtual property IDictionary<String^, String^>^ CefCommandLineArgs
{
IDictionary<String^, String^>^ 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; }
}
/// <summary>
/// Registers a custom scheme using the provided settings.
/// </summary>
/// <param name="cefCustomScheme">The CefCustomScheme which provides the details about the scheme.</param>
void RegisterScheme(CefCustomScheme^ cefCustomScheme)
{
_cefCustomSchemes->Add(cefCustomScheme);
}
};
}