Files
cefsharp/CefSharp.Core/Internals/CefExtensionWrapper.cpp
T
Gilberto Stankiewicz b0b5103100 Fix code analysis C4018 warnings (#3223)
* Replace `auto`s with `size_t`s to reduce:

```
Severity	Code	Description	Project	File	Line	Suppression State
Warning	C4018	'<': signed/unsigned mismatch	CefSharp.BrowserSubprocess.Core	c:\repos\cefsharp\cefsharp.browsersubprocess.core\serialization\jsobjectsserialization.cpp	71
```

* Fix templates
2020-08-26 19:13:13 +10:00

86 lines
2.1 KiB
C++

// Copyright © 2018 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 "CefExtensionWrapper.h"
#include "CefValueWrapper.h"
#include "RequestContext.h"
namespace CefSharp
{
namespace Internals
{
String^ CefExtensionWrapper::Identifier::get()
{
ThrowIfDisposed();
return StringUtils::ToClr(_extension->GetIdentifier());
}
String^ CefExtensionWrapper::Path::get()
{
ThrowIfDisposed();
return StringUtils::ToClr(_extension->GetPath());
}
IDictionary<String^, IValue^>^ CefExtensionWrapper::Manifest::get()
{
ThrowIfDisposed();
auto dictionary = _extension->GetManifest();;
if (!dictionary.get() || (int)dictionary->GetSize() == 0)
{
return nullptr;
}
auto result = gcnew Dictionary<String^, IValue^>();
CefDictionaryValue::KeyList keys;
dictionary->GetKeys(keys);
for (size_t i = 0; i < keys.size(); i++)
{
auto key = keys[i];
auto keyValue = StringUtils::ToClr(key);
auto valueWrapper = gcnew CefValueWrapper(dictionary->GetValue(keys[i]));
result->Add(keyValue, valueWrapper);
}
return result;
}
bool CefExtensionWrapper::IsSame(IExtension^ that)
{
ThrowIfDisposed();
return _extension->IsSame(((CefExtensionWrapper^)that)->_extension.get());
}
IRequestContext^ CefExtensionWrapper::LoaderContext::get()
{
ThrowIfDisposed();
return gcnew RequestContext(_extension->GetLoaderContext());
}
bool CefExtensionWrapper::IsLoaded::get()
{
ThrowIfDisposed();
return _extension->IsLoaded();
}
void CefExtensionWrapper::Unload()
{
ThrowIfDisposed();
_extension->Unload();
}
}
}