| OLD | NEW |
| 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" |
| 11 #include "base/strings/string_util.h" | 11 #include "base/strings/string_util.h" |
| 12 #include "third_party/WebKit/public/platform/WebString.h" | 12 #include "third_party/WebKit/public/platform/WebString.h" |
| 13 #include "third_party/WebKit/public/platform/WebVector.h" | 13 #include "third_party/WebKit/public/platform/WebVector.h" |
| 14 #include "third_party/WebKit/public/web/WebDocument.h" | 14 #include "third_party/WebKit/public/web/WebDocument.h" |
| 15 #include "third_party/WebKit/public/web/WebElement.h" | 15 #include "third_party/WebKit/public/web/WebElement.h" |
| 16 #include "third_party/WebKit/public/web/WebElementCollection.h" | 16 #include "third_party/WebKit/public/web/WebElementCollection.h" |
| 17 #include "third_party/WebKit/public/web/WebFrame.h" | |
| 18 #include "third_party/WebKit/public/web/WebInputElement.h" | 17 #include "third_party/WebKit/public/web/WebInputElement.h" |
| 18 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
| 19 #include "third_party/WebKit/public/web/WebNode.h" | 19 #include "third_party/WebKit/public/web/WebNode.h" |
| 20 #include "third_party/WebKit/public/web/WebNodeList.h" | 20 #include "third_party/WebKit/public/web/WebNodeList.h" |
| 21 #include "third_party/WebKit/public/web/WebView.h" | 21 #include "third_party/WebKit/public/web/WebView.h" |
| 22 | 22 |
| 23 using blink::WebDocument; | 23 using blink::WebDocument; |
| 24 using blink::WebElement; | 24 using blink::WebElement; |
| 25 using blink::WebElementCollection; | 25 using blink::WebElementCollection; |
| 26 using blink::WebFrame; | 26 using blink::WebFrame; |
| 27 using blink::WebInputElement; | 27 using blink::WebInputElement; |
| 28 using blink::WebLocalFrame; |
| 28 using blink::WebNode; | 29 using blink::WebNode; |
| 29 using blink::WebNodeList; | 30 using blink::WebNodeList; |
| 30 using blink::WebString; | 31 using blink::WebString; |
| 31 using blink::WebVector; | 32 using blink::WebVector; |
| 32 using blink::WebView; | 33 using blink::WebView; |
| 33 | 34 |
| 34 namespace content { | 35 namespace content { |
| 35 namespace { | 36 namespace { |
| 36 | 37 |
| 37 // Structure for storage the unique set of all savable resource links for | 38 // Structure for storage the unique set of all savable resource links for |
| (...skipping 26 matching lines...) Expand all Loading... |
| 64 // in one CSS stylesheet. | 65 // in one CSS stylesheet. |
| 65 void GetSavableResourceLinkForElement( | 66 void GetSavableResourceLinkForElement( |
| 66 const WebElement& element, | 67 const WebElement& element, |
| 67 const WebDocument& current_doc, | 68 const WebDocument& current_doc, |
| 68 SavableResourcesUniqueCheck* unique_check, | 69 SavableResourcesUniqueCheck* unique_check, |
| 69 SavableResourcesResult* result) { | 70 SavableResourcesResult* result) { |
| 70 | 71 |
| 71 // Handle frame and iframe tag. | 72 // Handle frame and iframe tag. |
| 72 if (element.hasTagName("iframe") || | 73 if (element.hasTagName("iframe") || |
| 73 element.hasTagName("frame")) { | 74 element.hasTagName("frame")) { |
| 74 WebFrame* sub_frame = WebFrame::fromFrameOwnerElement(element); | 75 WebFrame* sub_frame = WebLocalFrame::fromFrameOwnerElement(element); |
| 75 if (sub_frame) | 76 if (sub_frame) |
| 76 unique_check->frames->push_back(sub_frame); | 77 unique_check->frames->push_back(sub_frame); |
| 77 return; | 78 return; |
| 78 } | 79 } |
| 79 | 80 |
| 80 // Check whether the node has sub resource URL or not. | 81 // Check whether the node has sub resource URL or not. |
| 81 WebString value = GetSubResourceLinkFromElement(element); | 82 WebString value = GetSubResourceLinkFromElement(element); |
| 82 if (value.isNull()) | 83 if (value.isNull()) |
| 83 return; | 84 return; |
| 84 // Get absolute URL. | 85 // Get absolute URL. |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 it != frames_set.end(); ++it) { | 226 it != frames_set.end(); ++it) { |
| 226 // Append unique frame source to savable frame list. | 227 // Append unique frame source to savable frame list. |
| 227 if (resources_set.find(*it) == resources_set.end()) | 228 if (resources_set.find(*it) == resources_set.end()) |
| 228 result->frames_list->push_back(*it); | 229 result->frames_list->push_back(*it); |
| 229 } | 230 } |
| 230 | 231 |
| 231 return true; | 232 return true; |
| 232 } | 233 } |
| 233 | 234 |
| 234 } // namespace content | 235 } // namespace content |
| OLD | NEW |