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

Side by Side Diff: content/renderer/savable_resources.cc

Issue 2537953003: WebString: makes string16 conversions explicit (part 1: blink, content) (Closed)
Patch Set: fix 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 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/savable_resources.h" 5 #include "content/renderer/savable_resources.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 attribute_name = "background"; 150 attribute_name = "background";
151 } else if (element.hasHTMLTagName("blockquote") || 151 } else if (element.hasHTMLTagName("blockquote") ||
152 element.hasHTMLTagName("q") || 152 element.hasHTMLTagName("q") ||
153 element.hasHTMLTagName("del") || 153 element.hasHTMLTagName("del") ||
154 element.hasHTMLTagName("ins")) { 154 element.hasHTMLTagName("ins")) {
155 attribute_name = "cite"; 155 attribute_name = "cite";
156 } else if (element.hasHTMLTagName("object")) { 156 } else if (element.hasHTMLTagName("object")) {
157 attribute_name = "data"; 157 attribute_name = "data";
158 } else if (element.hasHTMLTagName("link")) { 158 } else if (element.hasHTMLTagName("link")) {
159 // If the link element is not linked to css, ignore it. 159 // If the link element is not linked to css, ignore it.
160 if (base::LowerCaseEqualsASCII( 160 WebString type = element.getAttribute("type");
161 base::StringPiece16(element.getAttribute("type")), "text/css") || 161 WebString rel = element.getAttribute("rel");
162 base::LowerCaseEqualsASCII( 162 if ((type.containsOnlyASCII() &&
163 base::StringPiece16(element.getAttribute("rel")), "stylesheet")) { 163 base::LowerCaseEqualsASCII(type.ascii(), "text/css")) ||
164 (rel.containsOnlyASCII() &&
165 base::LowerCaseEqualsASCII(rel.ascii(), "stylesheet"))) {
164 // TODO(jnd): Add support for extracting links of sub-resources which 166 // TODO(jnd): Add support for extracting links of sub-resources which
165 // are inside style-sheet such as @import, url(), etc. 167 // are inside style-sheet such as @import, url(), etc.
166 // See bug: http://b/issue?id=1111667. 168 // See bug: http://b/issue?id=1111667.
167 attribute_name = "href"; 169 attribute_name = "href";
168 } 170 }
169 } 171 }
170 if (!attribute_name) 172 if (!attribute_name)
171 return WebString(); 173 return WebString();
172 WebString value = element.getAttribute(WebString::fromUTF8(attribute_name)); 174 WebString value = element.getAttribute(WebString::fromUTF8(attribute_name));
173 // If value has content and not start with "javascript:" then return it, 175 // If value has content and not start with "javascript:" then return it,
174 // otherwise return NULL. 176 // otherwise return NULL.
175 if (!value.isNull() && !value.isEmpty() && 177 if (!value.isNull() && !value.isEmpty() &&
176 !base::StartsWith(value.utf8(), "javascript:", 178 !base::StartsWith(value.utf8(), "javascript:",
177 base::CompareCase::INSENSITIVE_ASCII)) 179 base::CompareCase::INSENSITIVE_ASCII))
178 return value; 180 return value;
179 181
180 return WebString(); 182 return WebString();
181 } 183 }
182 184
183 } // namespace content 185 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/renderer_webcookiejar_impl.cc ('k') | content/renderer/service_worker/embedded_worker_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698