cef/libcef/dom_document_impl.h
Marshall Greenblatt dbe8de277f Significant API changes for issue #218:
- Replace CefHandler with a new CefClient interface and separate handler interfaces.
- Add support for virtual inheritance to allow multiple CefBase parented interfaces to be implemented in the same class.
- Replace CefThreadSafeBase with IMPLEMENT_* macros to support virtual inheritance and to only provide locking implementations when needed.
- Move the CefBrowserSettings parameter from CefInitialize to CreateBrowser.
- Add a new cef_build.h header that provides platform-specific and OS_* defines.
- Introduce the use of OVERRIDE to generate compiler errors on Windows if a child virtual method declaration doesn't match the parent declaration.
- Use NDEBUG instead of _DEBUG because _DEBUG is not defined on Mac. (issue #240).

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@235 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
2011-05-20 14:42:25 +00:00

66 lines
2.0 KiB
C++

// Copyright (c) 2011 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 _DOM_DOCUMENT_IMPL_H
#define _DOM_DOCUMENT_IMPL_H
#include "include/cef.h"
#include <map>
namespace WebKit {
class WebFrame;
class WebNode;
};
class CefBrowserImpl;
class CefDOMDocumentImpl : public CefDOMDocument
{
public:
CefDOMDocumentImpl(CefBrowserImpl* browser,
WebKit::WebFrame* frame);
virtual ~CefDOMDocumentImpl();
virtual Type GetType() OVERRIDE;
virtual CefRefPtr<CefDOMNode> GetDocument() OVERRIDE;
virtual CefRefPtr<CefDOMNode> GetBody() OVERRIDE;
virtual CefRefPtr<CefDOMNode> GetHead() OVERRIDE;
virtual CefString GetTitle() OVERRIDE;
virtual CefRefPtr<CefDOMNode> GetElementById(const CefString& id) OVERRIDE;
virtual CefRefPtr<CefDOMNode> GetFocusedNode() OVERRIDE;
virtual bool HasSelection() OVERRIDE;
virtual CefRefPtr<CefDOMNode> GetSelectionStartNode() OVERRIDE;
virtual int GetSelectionStartOffset() OVERRIDE;
virtual CefRefPtr<CefDOMNode> GetSelectionEndNode() OVERRIDE;
virtual int GetSelectionEndOffset() OVERRIDE;
virtual CefString GetSelectionAsMarkup() OVERRIDE;
virtual CefString GetSelectionAsText() OVERRIDE;
virtual CefString GetBaseURL() OVERRIDE;
virtual CefString GetCompleteURL(const CefString& partialURL) OVERRIDE;
CefBrowserImpl* GetBrowser() { return browser_; }
WebKit::WebFrame* GetFrame() { return frame_; }
// The document maintains a map of all existing node objects.
CefRefPtr<CefDOMNode> GetOrCreateNode(const WebKit::WebNode& node);
void RemoveNode(const WebKit::WebNode& node);
// Must be called before the object is destroyed.
void Detach();
// Verify that the object exists and is being accessed on the UI thread.
bool VerifyContext();
protected:
CefBrowserImpl* browser_;
WebKit::WebFrame* frame_;
typedef std::map<WebKit::WebNode,CefDOMNode*> NodeMap;
NodeMap node_map_;
IMPLEMENT_REFCOUNTING(CefDOMDocumentImpl);
};
#endif // _DOM_DOCUMENT_IMPL_H