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 "content/public/common/url_utils.h" | 12 #include "content/public/common/url_utils.h" |
13 #include "content/renderer/web_frame_utils.h" | 13 #include "content/renderer/render_frame_impl.h" |
14 #include "third_party/WebKit/public/platform/WebString.h" | 14 #include "third_party/WebKit/public/platform/WebString.h" |
15 #include "third_party/WebKit/public/platform/WebVector.h" | 15 #include "third_party/WebKit/public/platform/WebVector.h" |
16 #include "third_party/WebKit/public/web/WebDocument.h" | 16 #include "third_party/WebKit/public/web/WebDocument.h" |
17 #include "third_party/WebKit/public/web/WebElement.h" | 17 #include "third_party/WebKit/public/web/WebElement.h" |
18 #include "third_party/WebKit/public/web/WebElementCollection.h" | 18 #include "third_party/WebKit/public/web/WebElementCollection.h" |
19 #include "third_party/WebKit/public/web/WebInputElement.h" | 19 #include "third_party/WebKit/public/web/WebInputElement.h" |
20 #include "third_party/WebKit/public/web/WebLocalFrame.h" | 20 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
21 #include "third_party/WebKit/public/web/WebNode.h" | 21 #include "third_party/WebKit/public/web/WebNode.h" |
22 #include "third_party/WebKit/public/web/WebView.h" | 22 #include "third_party/WebKit/public/web/WebView.h" |
23 | 23 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 SavableResourcesResult* result) { | 64 SavableResourcesResult* result) { |
65 // Get absolute URL. | 65 // Get absolute URL. |
66 WebString link_attribute_value = GetSubResourceLinkFromElement(element); | 66 WebString link_attribute_value = GetSubResourceLinkFromElement(element); |
67 GURL element_url = current_doc.CompleteURL(link_attribute_value); | 67 GURL element_url = current_doc.CompleteURL(link_attribute_value); |
68 | 68 |
69 // See whether to report this element as a subframe. | 69 // See whether to report this element as a subframe. |
70 WebFrame* web_frame = WebFrame::FromFrameOwnerElement(element); | 70 WebFrame* web_frame = WebFrame::FromFrameOwnerElement(element); |
71 if (web_frame && DoesFrameContainHtmlDocument(*web_frame, element)) { | 71 if (web_frame && DoesFrameContainHtmlDocument(*web_frame, element)) { |
72 SavableSubframe subframe; | 72 SavableSubframe subframe; |
73 subframe.original_url = element_url; | 73 subframe.original_url = element_url; |
74 subframe.routing_id = GetRoutingIdForFrameOrProxy(web_frame); | 74 subframe.routing_id = RenderFrame::GetRoutingIdForWebFrame(web_frame); |
75 result->subframes->push_back(subframe); | 75 result->subframes->push_back(subframe); |
76 return; | 76 return; |
77 } | 77 } |
78 | 78 |
79 // Check whether the node has sub resource URL or not. | 79 // Check whether the node has sub resource URL or not. |
80 if (link_attribute_value.IsNull()) | 80 if (link_attribute_value.IsNull()) |
81 return; | 81 return; |
82 | 82 |
83 // Ignore invalid URL. | 83 // Ignore invalid URL. |
84 if (!element_url.is_valid()) | 84 if (!element_url.is_valid()) |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 // otherwise return NULL. | 165 // otherwise return NULL. |
166 if (!value.IsNull() && !value.IsEmpty() && | 166 if (!value.IsNull() && !value.IsEmpty() && |
167 !base::StartsWith(value.Utf8(), | 167 !base::StartsWith(value.Utf8(), |
168 "javascript:", base::CompareCase::INSENSITIVE_ASCII)) | 168 "javascript:", base::CompareCase::INSENSITIVE_ASCII)) |
169 return value; | 169 return value; |
170 | 170 |
171 return WebString(); | 171 return WebString(); |
172 } | 172 } |
173 | 173 |
174 } // namespace content | 174 } // namespace content |
OLD | NEW |