diff options
author | jcivelli@google.com <jcivelli@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-12 17:38:10 +0000 |
---|---|---|
committer | jcivelli@google.com <jcivelli@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-12 17:38:10 +0000 |
commit | 1c57b7b3f5bfe15eeea1fb9023a86b30cba5a2be (patch) | |
tree | 8629f2d46895e84f3bab409ce2ae99d59557309d /webkit | |
parent | 310c28a1848fbf047162eccf96c8b9528be6ac83 (diff) | |
download | chromium_src-1c57b7b3f5bfe15eeea1fb9023a86b30cba5a2be.zip chromium_src-1c57b7b3f5bfe15eeea1fb9023a86b30cba5a2be.tar.gz chromium_src-1c57b7b3f5bfe15eeea1fb9023a86b30cba5a2be.tar.bz2 |
Don't offer to translate pages if the page says so by
using the magic Google meta-tag.
BUG=48606
TEST=See bug.
Review URL: http://codereview.chromium.org/2960001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@52097 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r-- | webkit/glue/dom_operations.cc | 25 | ||||
-rw-r--r-- | webkit/glue/dom_operations.h | 6 |
2 files changed, 31 insertions, 0 deletions
diff --git a/webkit/glue/dom_operations.cc b/webkit/glue/dom_operations.cc index d0b371d..017c3c6 100644 --- a/webkit/glue/dom_operations.cc +++ b/webkit/glue/dom_operations.cc @@ -590,4 +590,29 @@ int NumberOfActiveAnimations(WebView* view) { return controller->numberOfActiveAnimations(); } +void GetMetaElementsWithName(WebDocument* document, + const string16& name, + std::vector<WebElement>* meta_elements) { + DCHECK(document); + DCHECK(meta_elements); + meta_elements->clear(); + WebElement head = document->head(); + if (head.isNull() || !head.hasChildNodes()) + return; + + WebNodeList children = head.childNodes(); + for (size_t i = 0; i < children.length(); ++i) { + WebNode node = children.item(i); + if (!node.isElementNode()) + continue; + WebElement element = node.to<WebElement>(); + if (!element.hasTagName("meta")) + continue; + WebString meta_name = element.getAttribute("name"); + if (meta_name.isNull() || meta_name != name) + continue; + meta_elements->push_back(element); + } +} + } // webkit_glue diff --git a/webkit/glue/dom_operations.h b/webkit/glue/dom_operations.h index 4741bce..b8915be 100644 --- a/webkit/glue/dom_operations.h +++ b/webkit/glue/dom_operations.h @@ -129,6 +129,12 @@ int NumberOfActiveAnimations(WebKit::WebView* view); WebKit::WebString GetSubResourceLinkFromElement( const WebKit::WebElement& element); +// Puts the meta-elements of |document| that have the specified |name| in +// |meta_elements|. +void GetMetaElementsWithName(WebKit::WebDocument* document, + const string16& name, + std::vector<WebKit::WebElement>* meta_elements); + } // namespace webkit_glue #endif // WEBKIT_GLUE_DOM_OPERATIONS_H__ |