admin
2020-06-10 a610f2ab6e543d2cb78c1ef212ac6a74ddc067d9
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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
// Copyright © 2019 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.
 
#include "Stdafx.h"
 
#include "Frame.h"
#include "Browser.h"
 
using namespace CefSharp::BrowserSubprocess;
 
///
// Returns the browser host object. This method can only be called in the
// browser process.
///
/*--cef()--*/
IBrowserHost^ Browser::GetHost()
{
    throw gcnew NotImplementedException("Browser process only");
}
 
///
// Returns true if the browser can navigate backwards.
///
/*--cef()--*/
bool Browser::CanGoBack::get()
{
    return _browser->CanGoBack();
}
 
///
// Navigate backwards.
///
/*--cef()--*/
void Browser::GoBack()
{
    _browser->GoBack();
}
 
///
// Returns true if the browser can navigate forwards.
///
/*--cef()--*/
bool Browser::CanGoForward::get()
{
    return _browser->CanGoForward();
}
 
///
// Navigate forwards.
///
/*--cef()--*/
void Browser::GoForward()
{
    _browser->GoForward();
}
 
///
// Returns true if the browser is currently loading.
///
/*--cef()--*/
bool Browser::IsLoading::get()
{
    return _browser->IsLoading();
}
 
void Browser::CloseBrowser(bool forceClose)
{
    throw gcnew NotImplementedException("Browser process only");
}
 
///
// Reload the current page.
///
/*--cef()--*/
void Browser::Reload(bool ignoreCache)
{
    if (ignoreCache)
    {
        _browser->ReloadIgnoreCache();
    }
    else
    {
        _browser->Reload();
    }
}
 
///
// Stop loading the page.
///
/*--cef()--*/
void Browser::StopLoad()
{
    _browser->StopLoad();
}
 
///
// Returns the globally unique identifier for this browser.
///
/*--cef()--*/
int Browser::Identifier::get()
{
    return _browser->GetIdentifier();
}
 
///
// Returns true if this object is pointing to the same handle as |that|
// object.
///
/*--cef()--*/
bool Browser::IsSame(IBrowser^ that)
{
    return _browser->IsSame(dynamic_cast<Browser^>(that)->_browser.get());
}
 
///
// Returns true if the window is a popup window.
///
/*--cef()--*/
bool Browser::IsPopup::get()
{
    return _browser->IsPopup();
}
 
///
// Returns true if a document has been loaded in the browser.
///
/*--cef()--*/
bool Browser::HasDocument::get()
{
    return _browser->HasDocument();
}
 
IFrame^ Browser::MainFrame::get()
{
    auto frame = _browser->GetMainFrame();
    return gcnew Frame(frame);
}
 
///
// Returns the focused frame for the browser window.
///
/*--cef()--*/
IFrame^ Browser::FocusedFrame::get()
{
    return gcnew Frame(_browser->GetFocusedFrame());
}
 
///
// Returns the frame with the specified identifier, or NULL if not found.
///
/*--cef(capi_name=get_frame_byident)--*/
IFrame^ Browser::GetFrame(Int64 identifier)
{
    auto frame = _browser->GetFrame(identifier);
 
    if (frame.get())
    {
        return gcnew Frame(frame);
    }
 
    return nullptr;
}
 
///
// Returns the frame with the specified name, or NULL if not found.
///
/*--cef(optional_param=name)--*/
IFrame^ Browser::GetFrame(String^ name)
{
    auto frame = _browser->GetFrame(StringUtils::ToNative(name));
 
    if (frame.get())
    {
        return gcnew Frame(frame);
    }
 
    return nullptr;
}
 
///
// Returns the number of frames that currently exist.
///
/*--cef()--*/
int Browser::GetFrameCount()
{
    return _browser->GetFrameCount();
}
 
///
// Returns the identifiers of all existing frames.
///
/*--cef(count_func=identifiers:GetFrameCount)--*/
List<Int64>^ Browser::GetFrameIdentifiers()
{
    std::vector<Int64> identifiers;
    _browser->GetFrameIdentifiers(identifiers);
    List<Int64>^ results = gcnew List<Int64>(identifiers.size());
    for (UINT i = 0; i < identifiers.size(); i++)
    {
        results->Add(identifiers[i]);
    }
    return results;
}
 
///
// Returns the names of all existing frames.
///
/*--cef()--*/
List<String^>^ Browser::GetFrameNames()
{
    std::vector<CefString> names;
 
    _browser->GetFrameNames(names);
    return StringUtils::ToClr(names);
}
 
bool Browser::IsDisposed::get()
{
    return _disposed;
}