// 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 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 GetDocument() OVERRIDE; virtual CefRefPtr GetBody() OVERRIDE; virtual CefRefPtr GetHead() OVERRIDE; virtual CefString GetTitle() OVERRIDE; virtual CefRefPtr GetElementById(const CefString& id) OVERRIDE; virtual CefRefPtr GetFocusedNode() OVERRIDE; virtual bool HasSelection() OVERRIDE; virtual CefRefPtr GetSelectionStartNode() OVERRIDE; virtual int GetSelectionStartOffset() OVERRIDE; virtual CefRefPtr 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 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 NodeMap; NodeMap node_map_; IMPLEMENT_REFCOUNTING(CefDOMDocumentImpl); }; #endif // _DOM_DOCUMENT_IMPL_H