Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(369)

Side by Side Diff: content/renderer/savable_resources.cc

Issue 1422473004: Vector-of-structs (instead of struct-of-vectors) in "savable resources" IPC. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@page-serialization-original-url-yay
Patch Set: Rebasing... Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/renderer/savable_resources.h ('k') | content/renderer/savable_resources_browsertest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/renderer/web_frame_utils.h"
12 #include "third_party/WebKit/public/platform/WebString.h" 13 #include "third_party/WebKit/public/platform/WebString.h"
13 #include "third_party/WebKit/public/platform/WebVector.h" 14 #include "third_party/WebKit/public/platform/WebVector.h"
14 #include "third_party/WebKit/public/web/WebDocument.h" 15 #include "third_party/WebKit/public/web/WebDocument.h"
15 #include "third_party/WebKit/public/web/WebElement.h" 16 #include "third_party/WebKit/public/web/WebElement.h"
16 #include "third_party/WebKit/public/web/WebElementCollection.h" 17 #include "third_party/WebKit/public/web/WebElementCollection.h"
17 #include "third_party/WebKit/public/web/WebInputElement.h" 18 #include "third_party/WebKit/public/web/WebInputElement.h"
18 #include "third_party/WebKit/public/web/WebLocalFrame.h" 19 #include "third_party/WebKit/public/web/WebLocalFrame.h"
19 #include "third_party/WebKit/public/web/WebNode.h" 20 #include "third_party/WebKit/public/web/WebNode.h"
20 #include "third_party/WebKit/public/web/WebNodeList.h" 21 #include "third_party/WebKit/public/web/WebNodeList.h"
21 #include "third_party/WebKit/public/web/WebView.h" 22 #include "third_party/WebKit/public/web/WebView.h"
(...skipping 14 matching lines...) Expand all
36 namespace { 37 namespace {
37 38
38 // Get all savable resource links from current element. One element might 39 // Get all savable resource links from current element. One element might
39 // have more than one resource link. It is possible to have some links 40 // have more than one resource link. It is possible to have some links
40 // in one CSS stylesheet. 41 // in one CSS stylesheet.
41 void GetSavableResourceLinkForElement( 42 void GetSavableResourceLinkForElement(
42 const WebElement& element, 43 const WebElement& element,
43 const WebDocument& current_doc, 44 const WebDocument& current_doc,
44 SavableResourcesResult* result) { 45 SavableResourcesResult* result) {
45 if (element.hasHTMLTagName("iframe") || element.hasHTMLTagName("frame")) { 46 if (element.hasHTMLTagName("iframe") || element.hasHTMLTagName("frame")) {
46 GURL original_url = current_doc.completeURL(element.getAttribute("src")); 47 GURL complete_url = current_doc.completeURL(element.getAttribute("src"));
47 WebFrame* subframe = WebFrame::fromFrameOwnerElement(element); 48 WebFrame* web_frame = WebFrame::fromFrameOwnerElement(element);
49
50 SavableSubframe subframe;
51 subframe.original_url = complete_url;
52 subframe.routing_id = GetRoutingIdForFrameOrProxy(web_frame);
53
48 result->subframes->push_back(subframe); 54 result->subframes->push_back(subframe);
49 result->subframe_original_urls->push_back(original_url);
50 return; 55 return;
51 } 56 }
52 57
53 // Check whether the node has sub resource URL or not. 58 // Check whether the node has sub resource URL or not.
54 WebString value = GetSubResourceLinkFromElement(element); 59 WebString value = GetSubResourceLinkFromElement(element);
55 if (value.isNull()) 60 if (value.isNull())
56 return; 61 return;
57 // Get absolute URL. 62 // Get absolute URL.
58 GURL u = current_doc.completeURL(value); 63 GURL u = current_doc.completeURL(value);
59 // ignore invalid URL 64 // ignore invalid URL
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 // otherwise return NULL. 150 // otherwise return NULL.
146 if (!value.isNull() && !value.isEmpty() && 151 if (!value.isNull() && !value.isEmpty() &&
147 !base::StartsWith(value.utf8(), "javascript:", 152 !base::StartsWith(value.utf8(), "javascript:",
148 base::CompareCase::INSENSITIVE_ASCII)) 153 base::CompareCase::INSENSITIVE_ASCII))
149 return value; 154 return value;
150 155
151 return WebString(); 156 return WebString();
152 } 157 }
153 158
154 } // namespace content 159 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/savable_resources.h ('k') | content/renderer/savable_resources_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698