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

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

Issue 1416113012: Save-Page-As-Complete-HTML: Better handling of <object> elements. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@multi-frame-tests
Patch Set: Rebasing... Created 5 years, 1 month 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
« no previous file with comments | « chrome/browser/download/save_page_browsertest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 } else if (element.hasHTMLTagName("body") || 122 } else if (element.hasHTMLTagName("body") ||
123 element.hasHTMLTagName("table") || 123 element.hasHTMLTagName("table") ||
124 element.hasHTMLTagName("tr") || 124 element.hasHTMLTagName("tr") ||
125 element.hasHTMLTagName("td")) { 125 element.hasHTMLTagName("td")) {
126 attribute_name = "background"; 126 attribute_name = "background";
127 } else if (element.hasHTMLTagName("blockquote") || 127 } else if (element.hasHTMLTagName("blockquote") ||
128 element.hasHTMLTagName("q") || 128 element.hasHTMLTagName("q") ||
129 element.hasHTMLTagName("del") || 129 element.hasHTMLTagName("del") ||
130 element.hasHTMLTagName("ins")) { 130 element.hasHTMLTagName("ins")) {
131 attribute_name = "cite"; 131 attribute_name = "cite";
132 } else if (element.hasHTMLTagName("object")) {
133 // TODO(lukasza): When <object> contains a html document, it should be
134 // reported as a subframe, not as a savable resource (reporting as a
135 // savable resource works, but will save original html contents, not
136 // current html contents of the frame).
137 attribute_name = "data";
132 } else if (element.hasHTMLTagName("link")) { 138 } else if (element.hasHTMLTagName("link")) {
133 // If the link element is not linked to css, ignore it. 139 // If the link element is not linked to css, ignore it.
134 if (base::LowerCaseEqualsASCII( 140 if (base::LowerCaseEqualsASCII(
135 base::StringPiece16(element.getAttribute("type")), "text/css") || 141 base::StringPiece16(element.getAttribute("type")), "text/css") ||
136 base::LowerCaseEqualsASCII( 142 base::LowerCaseEqualsASCII(
137 base::StringPiece16(element.getAttribute("rel")), "stylesheet")) { 143 base::StringPiece16(element.getAttribute("rel")), "stylesheet")) {
138 // TODO(jnd): Add support for extracting links of sub-resources which 144 // TODO(jnd): Add support for extracting links of sub-resources which
139 // are inside style-sheet such as @import, url(), etc. 145 // are inside style-sheet such as @import, url(), etc.
140 // See bug: http://b/issue?id=1111667. 146 // See bug: http://b/issue?id=1111667.
141 attribute_name = "href"; 147 attribute_name = "href";
142 } 148 }
143 } 149 }
144 if (!attribute_name) 150 if (!attribute_name)
145 return WebString(); 151 return WebString();
146 WebString value = element.getAttribute(WebString::fromUTF8(attribute_name)); 152 WebString value = element.getAttribute(WebString::fromUTF8(attribute_name));
147 // If value has content and not start with "javascript:" then return it, 153 // If value has content and not start with "javascript:" then return it,
148 // otherwise return NULL. 154 // otherwise return NULL.
149 if (!value.isNull() && !value.isEmpty() && 155 if (!value.isNull() && !value.isEmpty() &&
150 !base::StartsWith(value.utf8(), "javascript:", 156 !base::StartsWith(value.utf8(), "javascript:",
151 base::CompareCase::INSENSITIVE_ASCII)) 157 base::CompareCase::INSENSITIVE_ASCII))
152 return value; 158 return value;
153 159
154 return WebString(); 160 return WebString();
155 } 161 }
156 162
157 } // namespace content 163 } // namespace content
OLDNEW
« no previous file with comments | « chrome/browser/download/save_page_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698