Index: headless/public/web_node.h |
diff --git a/headless/public/web_node.h b/headless/public/web_node.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..c1a4880e2e31216ee99f2de3dd7debb82998cc56 |
--- /dev/null |
+++ b/headless/public/web_node.h |
@@ -0,0 +1,51 @@ |
+// Copyright 2015 The Chromium 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 HEADLESS_PUBLIC_WEB_NODE_H_ |
+#define HEADLESS_PUBLIC_WEB_NODE_H_ |
+ |
+#include "headless/public/headless_export.h" |
+#include "third_party/WebKit/public/web/WebNode.h" |
+ |
+namespace headless { |
+ |
+class WebElement; |
+class WebDocument; |
+ |
+class HEADLESS_EXPORT WebNode { |
+ public: |
+ WebNode(const blink::WebNode&); |
+ |
+ std::string Value() const; |
+ |
+ WebNode Parent() const; |
+ WebNode FirstChild() const; |
+ WebNode LastChild() const; |
+ WebNode NextSibling() const; |
+ WebNode PreviousSibling() const; |
+ bool HasChildNodes() const; |
+ |
+ bool IsDocument() const; |
+ bool IsElement() const; |
+ |
+ WebElement AsElement() const; |
+ WebDocument AsDocument() const; |
+ |
+ inline bool operator==(const WebNode& other) const { |
+ return web_node() == other.web_node(); |
+ } |
+ inline bool operator!=(const WebNode& other) const { |
+ return !(*this == other); |
+ } |
+ |
+ protected: |
+ blink::WebNode& web_node(); |
+ const blink::WebNode& web_node() const; |
+ |
+ blink::WebNode web_node_; |
+}; |
+ |
+} // namespace headless |
+ |
+#endif // HEADLESS_PUBLIC_WEB_NODE_H_ |