| 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/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 httpEquiv = meta.getAttribute("http-equiv"); | 110 WebString httpEquiv = meta.getAttribute("http-equiv"); |
| 111 if (LowerCaseEqualsASCII(httpEquiv, "content-type")) { | 111 if (base::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 912 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1034 NavigateToURL(shell(), file_url); | 1034 NavigateToURL(shell(), file_url); |
| 1035 | 1035 |
| 1036 PostTaskToInProcessRendererAndWait( | 1036 PostTaskToInProcessRendererAndWait( |
| 1037 base::Bind( | 1037 base::Bind( |
| 1038 &DomSerializerTests:: | 1038 &DomSerializerTests:: |
| 1039 SubResourceForElementsInNonHTMLNamespaceOnRenderer, | 1039 SubResourceForElementsInNonHTMLNamespaceOnRenderer, |
| 1040 base::Unretained(this), file_url)); | 1040 base::Unretained(this), file_url)); |
| 1041 } | 1041 } |
| 1042 | 1042 |
| 1043 } // namespace content | 1043 } // namespace content |
| OLD | NEW |