2011-02-23 04:45:13 +01:00
|
|
|
// 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;
|
|
|
|
|
2011-05-20 16:42:25 +02:00
|
|
|
class CefDOMDocumentImpl : public CefDOMDocument
|
2011-02-23 04:45:13 +01:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
CefDOMDocumentImpl(CefBrowserImpl* browser,
|
|
|
|
WebKit::WebFrame* frame);
|
|
|
|
virtual ~CefDOMDocumentImpl();
|
|
|
|
|
2011-05-20 16:42:25 +02:00
|
|
|
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;
|
2011-02-23 04:45:13 +01:00
|
|
|
|
|
|
|
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_;
|
2011-05-20 16:42:25 +02:00
|
|
|
|
|
|
|
IMPLEMENT_REFCOUNTING(CefDOMDocumentImpl);
|
2011-02-23 04:45:13 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // _DOM_DOCUMENT_IMPL_H
|