Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(292)

Unified Diff: third_party/WebKit/Source/web/WebDocument.cpp

Issue 2577203002: Remove use of WebNode/WebElement in translate_helper (Closed)
Patch Set: Add WebLanguageDetectionDetails Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/web/WebDocument.cpp
diff --git a/third_party/WebKit/Source/web/WebDocument.cpp b/third_party/WebKit/Source/web/WebDocument.cpp
index 26f088f28b54f3237bcfe5ef412fc80c929e0bd1..ba87a12bd7d81f710aadb58ab3b9079bdcde0b8f 100644
--- a/third_party/WebKit/Source/web/WebDocument.cpp
+++ b/third_party/WebKit/Source/web/WebDocument.cpp
@@ -92,6 +92,30 @@ WebString WebDocument::contentLanguage() const {
return constUnwrap<Document>()->contentLanguage();
}
+WebString WebDocument::documentLanguage() const {
dglazkov 2016/12/16 23:00:28 Don't need that anymore, right?
+ return constUnwrap<Document>()->documentLanguage();
+}
+
+WebVector<WebString> WebDocument::getMetaValues(const WebString& name) const {
dglazkov 2016/12/16 23:00:28 ... Or that.
+ return constUnwrap<Document>()->getMetaValues(name);
+}
+
+WebLanguageDetectionDetails WebDocument::collectLanguageDetectionDetails()
+ const {
+ WebLanguageDetectionDetails details;
+ details.contentLanguage = contentLanguage();
+ details.htmlLanguage = documentLanguage();
+ details.url = url();
+
+ WebVector<WebString> values = getMetaValues(WebString("google"));
+ details.hasNoTranslateMeta =
+ std::any_of(values.begin(), values.end(), [](const WebString& value) {
+ return equalIgnoringASCIICase(value, "notranslate");
+ });
+
+ return details;
+}
+
WebString WebDocument::referrer() const {
return constUnwrap<Document>()->referrer();
}

Powered by Google App Engine
This is Rietveld 408576698