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

Side by Side 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 } 85 }
86 86
87 WebString WebDocument::encoding() const { 87 WebString WebDocument::encoding() const {
88 return constUnwrap<Document>()->encodingName(); 88 return constUnwrap<Document>()->encodingName();
89 } 89 }
90 90
91 WebString WebDocument::contentLanguage() const { 91 WebString WebDocument::contentLanguage() const {
92 return constUnwrap<Document>()->contentLanguage(); 92 return constUnwrap<Document>()->contentLanguage();
93 } 93 }
94 94
95 WebString WebDocument::documentLanguage() const {
dglazkov 2016/12/16 23:00:28 Don't need that anymore, right?
96 return constUnwrap<Document>()->documentLanguage();
97 }
98
99 WebVector<WebString> WebDocument::getMetaValues(const WebString& name) const {
dglazkov 2016/12/16 23:00:28 ... Or that.
100 return constUnwrap<Document>()->getMetaValues(name);
101 }
102
103 WebLanguageDetectionDetails WebDocument::collectLanguageDetectionDetails()
104 const {
105 WebLanguageDetectionDetails details;
106 details.contentLanguage = contentLanguage();
107 details.htmlLanguage = documentLanguage();
108 details.url = url();
109
110 WebVector<WebString> values = getMetaValues(WebString("google"));
111 details.hasNoTranslateMeta =
112 std::any_of(values.begin(), values.end(), [](const WebString& value) {
113 return equalIgnoringASCIICase(value, "notranslate");
114 });
115
116 return details;
117 }
118
95 WebString WebDocument::referrer() const { 119 WebString WebDocument::referrer() const {
96 return constUnwrap<Document>()->referrer(); 120 return constUnwrap<Document>()->referrer();
97 } 121 }
98 122
99 WebColor WebDocument::themeColor() const { 123 WebColor WebDocument::themeColor() const {
100 return constUnwrap<Document>()->themeColor().rgb(); 124 return constUnwrap<Document>()->themeColor().rgb();
101 } 125 }
102 126
103 WebURL WebDocument::openSearchDescriptionURL() const { 127 WebURL WebDocument::openSearchDescriptionURL() const {
104 return const_cast<Document*>(constUnwrap<Document>()) 128 return const_cast<Document*>(constUnwrap<Document>())
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 WebDocument& WebDocument::operator=(Document* elem) { 320 WebDocument& WebDocument::operator=(Document* elem) {
297 m_private = elem; 321 m_private = elem;
298 return *this; 322 return *this;
299 } 323 }
300 324
301 WebDocument::operator Document*() const { 325 WebDocument::operator Document*() const {
302 return toDocument(m_private.get()); 326 return toDocument(m_private.get());
303 } 327 }
304 328
305 } // namespace blink 329 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698