OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/renderer/chrome_render_view_observer.h" | 5 #include "chrome/renderer/chrome_render_view_observer.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 824 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
835 | 835 |
836 bool ChromeRenderViewObserver::HasRefreshMetaTag(WebFrame* frame) { | 836 bool ChromeRenderViewObserver::HasRefreshMetaTag(WebFrame* frame) { |
837 if (!frame) | 837 if (!frame) |
838 return false; | 838 return false; |
839 WebElement head = frame->document().head(); | 839 WebElement head = frame->document().head(); |
840 if (head.isNull() || !head.hasChildNodes()) | 840 if (head.isNull() || !head.hasChildNodes()) |
841 return false; | 841 return false; |
842 | 842 |
843 const WebString tag_name(ASCIIToUTF16("meta")); | 843 const WebString tag_name(ASCIIToUTF16("meta")); |
844 const WebString attribute_name(ASCIIToUTF16("http-equiv")); | 844 const WebString attribute_name(ASCIIToUTF16("http-equiv")); |
845 const WebString attribute_value(ASCIIToUTF16("refresh")); | |
846 | 845 |
847 WebNodeList children = head.childNodes(); | 846 WebNodeList children = head.childNodes(); |
848 for (size_t i = 0; i < children.length(); ++i) { | 847 for (size_t i = 0; i < children.length(); ++i) { |
849 WebNode node = children.item(i); | 848 WebNode node = children.item(i); |
850 if (!node.isElementNode()) | 849 if (!node.isElementNode()) |
851 continue; | 850 continue; |
852 WebElement element = node.to<WebElement>(); | 851 WebElement element = node.to<WebElement>(); |
853 if (!element.hasTagName(tag_name)) | 852 if (!element.hasTagName(tag_name)) |
854 continue; | 853 continue; |
855 WebString value = element.getAttribute(attribute_name); | 854 WebString value = element.getAttribute(attribute_name); |
856 if (value.isNull() || value != attribute_value) | 855 if (value.isNull() || !LowerCaseEqualsASCII(value, "refresh")) |
857 continue; | 856 continue; |
858 return true; | 857 return true; |
859 } | 858 } |
860 return false; | 859 return false; |
861 } | 860 } |
OLD | NEW |