mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-02-18 05:00:48 +01:00
- The libcef project now builds libcef_static.lib instead of libcef.lib. - The libcef_dll project builds libcef.lib and libcef.dll. This DLL exports the new CEF C API defined in cef_capi.h, cef_nplugin_capi.h, cef_string.h and cef_string_map.h. - The libcef_dll_wrapper project builds libcef_dll_wrapper.lib. This static library wraps the new C API calls with an implementation of the CEF C++ interface as defined in cef.h and cef_nplugin.h. - The cefclient project now uses the DLL instead of the static library. - Type definitions have been moved from cef.h to cef_types.h so that they can be shared by both cef.h and cef_capi.h. This change required some enumeration member name modifications throughout the code base. - Fixed variable naming inconsistencies. - Added CefVariant::GetArraySize() method and _NPN_ArrayObjectGetVectorSize() function. - Remove the ProjectSection(WebsiteProperties) sections from cef.sln to improve VS2005 performance. git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@16 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
78 lines
3.0 KiB
C++
78 lines
3.0 KiB
C++
// Copyright (c) 2008 The Chromium Embedded Framework Authors.
|
|
// Portions copyright (c) 2006-2008 The Chromium 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 _VARIANT_IMPL_H
|
|
#define _VARIANT_IMPL_H
|
|
|
|
#include "../include/cef.h"
|
|
#include "third_party/npapi/bindings/npruntime.h"
|
|
|
|
class WebFrame;
|
|
|
|
// Implementation of CefPostDataElement that provides a class wrapper for an
|
|
// NPVariant structure.
|
|
// Portions of the implementation are borrowed from webkit\glue\cpp_variant.cc
|
|
class CefVariantImpl : public CefThreadSafeBase<CefVariant>
|
|
{
|
|
public:
|
|
CefVariantImpl();
|
|
CefVariantImpl(WebFrame *webframe);
|
|
~CefVariantImpl();
|
|
|
|
virtual Type GetType();
|
|
virtual void SetNull();
|
|
virtual void SetBool(bool val);
|
|
virtual void SetInt(int val);
|
|
virtual void SetDouble(double val);
|
|
virtual void SetString(const std::wstring& val);
|
|
virtual void SetBoolArray(const std::vector<bool>& val);
|
|
virtual void SetIntArray(const std::vector<int>& val);
|
|
virtual void SetDoubleArray(const std::vector<double>& val);
|
|
virtual void SetStringArray(const std::vector<std::wstring>& val);
|
|
virtual bool GetBool();
|
|
virtual int GetInt();
|
|
virtual double GetDouble();
|
|
virtual std::wstring GetString();
|
|
virtual bool GetBoolArray(std::vector<bool>& val);
|
|
virtual bool GetIntArray(std::vector<int>& val);
|
|
virtual bool GetDoubleArray(std::vector<double>& val);
|
|
virtual bool GetStringArray(std::vector<std::wstring>& val);
|
|
virtual int GetArraySize();
|
|
|
|
// These three methods all perform deep copies of any string data. This
|
|
// allows the local CefVariantImpl to be released by the destructor without
|
|
// corrupting their sources. In performance-critical code, or when strings
|
|
// are very long, avoid creating new CefVariantImpl.
|
|
// In case of NPObject as the data, the copying involves ref-counting
|
|
// as opposed to deep-copying. The ref-counting ensures that sources don't
|
|
// get corrupted when the copies get destroyed.
|
|
void CopyToNPVariant(NPVariant* result);
|
|
CefVariantImpl& operator=(const CefVariantImpl& original);
|
|
CefVariantImpl(const CefVariantImpl& original);
|
|
|
|
// Note that setting a CefVariant to an NPObject involves ref-counting
|
|
// the actual object. SetNull() should only be called if the CefVariant
|
|
// is no longer needed. The other Set() methods handle this internally.
|
|
// Also, the object's NPClass is expected to be a static object: neither
|
|
// the NP runtime nor CefVariant will ever free it.
|
|
void Set(NPObject* val);
|
|
|
|
void Set(const NPString& val);
|
|
void Set(const NPVariant& val);
|
|
|
|
const NPVariant* GetNPVariant() const { return &variant_; }
|
|
|
|
protected:
|
|
// Underlying NPVariant structure.
|
|
NPVariant variant_;
|
|
|
|
// Pointer to the WebFrame that represents the context for this CefVariant
|
|
// object. This pointer is used for creating new NPObjects in the Set*()
|
|
// methods that accept array arguments.
|
|
WebFrame* webframe_;
|
|
};
|
|
|
|
#endif // _VARIANT_IMPL_H
|