OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
8 #include "base/containers/hash_tables.h" | 8 #include "base/containers/hash_tables.h" |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 // means it is META element, otherwise return false. The parameter charset_info | 100 // means it is META element, otherwise return false. The parameter charset_info |
101 // return actual charset info if the META tag has charset declaration. | 101 // return actual charset info if the META tag has charset declaration. |
102 bool IsMetaElement(const WebNode& node, std::string& charset_info) { | 102 bool IsMetaElement(const WebNode& node, std::string& charset_info) { |
103 if (!node.isElementNode()) | 103 if (!node.isElementNode()) |
104 return false; | 104 return false; |
105 const WebElement meta = node.toConst<WebElement>(); | 105 const WebElement meta = node.toConst<WebElement>(); |
106 if (!meta.hasHTMLTagName("meta")) | 106 if (!meta.hasHTMLTagName("meta")) |
107 return false; | 107 return false; |
108 charset_info.erase(0, charset_info.length()); | 108 charset_info.erase(0, charset_info.length()); |
109 // Check the META charset declaration. | 109 // Check the META charset declaration. |
110 WebString http_equiv = meta.getAttribute("http-equiv"); | 110 WebString httpEquiv = meta.getAttribute("http-equiv"); |
111 if (base::LowerCaseEqualsASCII(base::string16(http_equiv), "content-type")) { | 111 if (LowerCaseEqualsASCII(httpEquiv, "content-type")) { |
112 std::string content = meta.getAttribute("content").utf8(); | 112 std::string content = meta.getAttribute("content").utf8(); |
113 int pos = content.find("charset", 0); | 113 int pos = content.find("charset", 0); |
114 if (pos > -1) { | 114 if (pos > -1) { |
115 // Add a dummy charset declaration to charset_info, which indicates this | 115 // Add a dummy charset declaration to charset_info, which indicates this |
116 // META tag has charset declaration although we do not get correct value | 116 // META tag has charset declaration although we do not get correct value |
117 // yet. | 117 // yet. |
118 charset_info.append("has-charset-declaration"); | 118 charset_info.append("has-charset-declaration"); |
119 int remaining_length = content.length() - pos - 7; | 119 int remaining_length = content.length() - pos - 7; |
120 if (!remaining_length) | 120 if (!remaining_length) |
121 return true; | 121 return true; |
(...skipping 895 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1017 NavigateToURL(shell(), file_url); | 1017 NavigateToURL(shell(), file_url); |
1018 | 1018 |
1019 PostTaskToInProcessRendererAndWait( | 1019 PostTaskToInProcessRendererAndWait( |
1020 base::Bind( | 1020 base::Bind( |
1021 &DomSerializerTests:: | 1021 &DomSerializerTests:: |
1022 SubResourceForElementsInNonHTMLNamespaceOnRenderer, | 1022 SubResourceForElementsInNonHTMLNamespaceOnRenderer, |
1023 base::Unretained(this), file_url)); | 1023 base::Unretained(this), file_url)); |
1024 } | 1024 } |
1025 | 1025 |
1026 } // namespace content | 1026 } // namespace content |
OLD | NEW |