2010-10-03 23:04:50 +02:00
|
|
|
// Copyright (c) 2009 The Chromium Embedded Framework 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 _V8_IMPL_H
|
|
|
|
#define _V8_IMPL_H
|
|
|
|
|
|
|
|
#include "include/cef.h"
|
|
|
|
#include "v8/include/v8.h"
|
|
|
|
|
|
|
|
class CefTrackObject;
|
|
|
|
|
|
|
|
class CefV8ValueImpl : public CefThreadSafeBase<CefV8Value>
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
CefV8ValueImpl();
|
|
|
|
CefV8ValueImpl(v8::Handle<v8::Value> value, CefTrackObject* tracker = NULL);
|
|
|
|
virtual ~CefV8ValueImpl();
|
|
|
|
|
|
|
|
bool Attach(v8::Handle<v8::Value> value, CefTrackObject* tracker = NULL);
|
|
|
|
void Detach();
|
|
|
|
v8::Handle<v8::Value> GetValue();
|
2010-11-22 18:49:46 +01:00
|
|
|
bool IsReservedKey(const CefString& key);
|
2010-10-03 23:04:50 +02:00
|
|
|
|
|
|
|
virtual bool IsUndefined();
|
|
|
|
virtual bool IsNull();
|
|
|
|
virtual bool IsBool();
|
|
|
|
virtual bool IsInt();
|
|
|
|
virtual bool IsDouble();
|
|
|
|
virtual bool IsString();
|
|
|
|
virtual bool IsObject();
|
|
|
|
virtual bool IsArray();
|
|
|
|
virtual bool IsFunction();
|
|
|
|
virtual bool GetBoolValue();
|
|
|
|
virtual int GetIntValue();
|
|
|
|
virtual double GetDoubleValue();
|
2010-11-22 18:49:46 +01:00
|
|
|
virtual CefString GetStringValue();
|
|
|
|
virtual bool HasValue(const CefString& key);
|
2010-10-03 23:04:50 +02:00
|
|
|
virtual bool HasValue(int index);
|
2010-11-22 18:49:46 +01:00
|
|
|
virtual bool DeleteValue(const CefString& key);
|
2010-10-03 23:04:50 +02:00
|
|
|
virtual bool DeleteValue(int index);
|
2010-11-22 18:49:46 +01:00
|
|
|
virtual CefRefPtr<CefV8Value> GetValue(const CefString& key);
|
2010-10-03 23:04:50 +02:00
|
|
|
virtual CefRefPtr<CefV8Value> GetValue(int index);
|
2010-11-22 18:49:46 +01:00
|
|
|
virtual bool SetValue(const CefString& key, CefRefPtr<CefV8Value> value);
|
2010-10-03 23:04:50 +02:00
|
|
|
virtual bool SetValue(int index, CefRefPtr<CefV8Value> value);
|
2010-11-22 18:49:46 +01:00
|
|
|
virtual bool GetKeys(std::vector<CefString>& keys);
|
2010-10-03 23:04:50 +02:00
|
|
|
virtual CefRefPtr<CefBase> GetUserData();
|
|
|
|
virtual int GetArrayLength();
|
2010-11-22 18:49:46 +01:00
|
|
|
virtual CefString GetFunctionName();
|
2010-10-03 23:04:50 +02:00
|
|
|
virtual CefRefPtr<CefV8Handler> GetFunctionHandler();
|
|
|
|
virtual bool ExecuteFunction(CefRefPtr<CefV8Value> object,
|
|
|
|
const CefV8ValueList& arguments,
|
|
|
|
CefRefPtr<CefV8Value>& retval,
|
2010-11-22 18:49:46 +01:00
|
|
|
CefString& exception);
|
2010-10-03 23:04:50 +02:00
|
|
|
|
|
|
|
protected:
|
|
|
|
v8::Persistent<v8::Value> v8_value_;
|
|
|
|
CefTrackObject* tracker_;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif //_V8_IMPL_H
|