cef/libcef/v8_impl.h
Marshall Greenblatt c295931b1e - Move frame-related methods from CefBrowser into a new CefFrame class.
- Add CefBrowser::Get*Frame() methods for retrieving the appropriate CefFrame instance.
- Add a CefFrame attribute to CefHandler callback methods where appropriate.
- Add support for V8 JavaScript extensions and values via CefV8Value and CefV8Handler.  Native C++ and user-defined JavaScript object hierarchies may now be created and accessed using the CEF API.
- Remove the CefHandler and CefVariant classes and related CefBrowser methods that have been obsoleted by the addition of CEF V8 support.
- Add the CefRegisterExtension() function for registering system-wide V8 extensions.
- Add the CefHandler::HandleJSBinding() callback method for attaching V8 values to the global frame JavaScript object.  This method replaces the previous technique of calling CefBrowser::AddJSHandler().
- Add new wrapper template methods for simplifying DLL wrapper implementations.
- Move cef_string* files from libcef_dll to libcef so that projects can link libcef statically without errors.
- Fix crashes when CEF exits due to object constructors being executed on non-UI threads if the application is closed while a page is still loading.
- Update the cefclient project to reflect changes and demonstrate the new APIs.

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@26 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
2009-05-28 00:31:21 +00:00

62 lines
2.1 KiB
C++

// 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();
bool IsReservedKey(const std::wstring& key);
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();
virtual std::wstring GetStringValue();
virtual bool HasValue(const std::wstring& key);
virtual bool HasValue(int index);
virtual bool DeleteValue(const std::wstring& key);
virtual bool DeleteValue(int index);
virtual CefRefPtr<CefV8Value> GetValue(const std::wstring& key);
virtual CefRefPtr<CefV8Value> GetValue(int index);
virtual bool SetValue(const std::wstring& key, CefRefPtr<CefV8Value> value);
virtual bool SetValue(int index, CefRefPtr<CefV8Value> value);
virtual bool GetKeys(std::vector<std::wstring>& keys);
virtual CefRefPtr<CefBase> GetUserData();
virtual int GetArrayLength();
virtual std::wstring GetFunctionName();
virtual CefRefPtr<CefV8Handler> GetFunctionHandler();
virtual bool ExecuteFunction(CefRefPtr<CefV8Value> object,
CefV8ValueList& arguments,
CefRefPtr<CefV8Value>& retval,
std::wstring& exception);
protected:
v8::Persistent<v8::Value> v8_value_;
CefTrackObject* tracker_;
};
#endif //_V8_IMPL_H