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

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

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: 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
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 #ifndef CONTENT_RENDERER_SAVABLE_RESOURCES_H_ 5 #ifndef CONTENT_RENDERER_SAVABLE_RESOURCES_H_
6 #define CONTENT_RENDERER_SAVABLE_RESOURCES_H_ 6 #define CONTENT_RENDERER_SAVABLE_RESOURCES_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "content/common/content_export.h" 11 #include "content/common/content_export.h"
12 #include "content/common/savable_subframe.h"
12 #include "third_party/WebKit/public/platform/WebReferrerPolicy.h" 13 #include "third_party/WebKit/public/platform/WebReferrerPolicy.h"
13 #include "url/gurl.h" 14 #include "url/gurl.h"
14 15
15 namespace blink { 16 namespace blink {
16 class WebElement; 17 class WebElement;
17 class WebFrame; 18 class WebFrame;
18 class WebString; 19 class WebString;
19 class WebView; 20 class WebView;
20 } 21 }
21 22
22 // A collection of operations that access the underlying WebKit DOM directly. 23 // A collection of operations that access the underlying WebKit DOM directly.
23 namespace content { 24 namespace content {
24 25
25 // Structure for storage the result of getting all savable resource links 26 // Structure for storage the result of getting all savable resource links
26 // for current page. The consumer of the SavableResourcesResult is responsible 27 // for current page. The consumer of the SavableResourcesResult is responsible
27 // for keeping these pointers valid for the lifetime of the 28 // for keeping these pointers valid for the lifetime of the
28 // SavableResourcesResult instance. 29 // SavableResourcesResult instance.
29 struct SavableResourcesResult { 30 struct SavableResourcesResult {
30 // Links of all savable resources. 31 // Links of all savable resources.
31 std::vector<GURL>* resources_list; 32 std::vector<GURL>* resources_list;
32 // Referral links. 33 // Referral links.
33 // referrer_urls_list[i] corresponds to resources_list[i]. 34 // referrer_urls_list[i] corresponds to resources_list[i].
34 std::vector<GURL>* referrer_urls_list; 35 std::vector<GURL>* referrer_urls_list;
35 // Referrer policies. 36 // Referrer policies.
36 // referrer_policies_list[i] corresponds to referrer_urls_list[i]. 37 // referrer_policies_list[i] corresponds to referrer_urls_list[i].
37 std::vector<blink::WebReferrerPolicy>* referrer_policies_list; 38 std::vector<blink::WebReferrerPolicy>* referrer_policies_list;
38 39
39 // Original urls of subframes. 40 // Subframes.
40 std::vector<GURL>* subframe_original_urls; 41 std::vector<SavableSubframe>* subframes;
41 // Subframe objects.
42 // subframes[i] corresponds to subframe_original_urls[i].
43 std::vector<blink::WebFrame*>* subframes;
44 42
45 // Constructor. 43 // Constructor.
46 SavableResourcesResult( 44 SavableResourcesResult(
47 std::vector<GURL>* resources_list, 45 std::vector<GURL>* resources_list,
48 std::vector<GURL>* referrer_urls_list, 46 std::vector<GURL>* referrer_urls_list,
49 std::vector<blink::WebReferrerPolicy>* referrer_policies_list, 47 std::vector<blink::WebReferrerPolicy>* referrer_policies_list,
50 std::vector<GURL>* subframe_original_urls, 48 std::vector<SavableSubframe>* subframes)
51 std::vector<blink::WebFrame*>* subframes)
52 : resources_list(resources_list), 49 : resources_list(resources_list),
53 referrer_urls_list(referrer_urls_list), 50 referrer_urls_list(referrer_urls_list),
54 referrer_policies_list(referrer_policies_list), 51 referrer_policies_list(referrer_policies_list),
55 subframe_original_urls(subframe_original_urls),
56 subframes(subframes) {} 52 subframes(subframes) {}
57 53
58 private: 54 private:
59 DISALLOW_COPY_AND_ASSIGN(SavableResourcesResult); 55 DISALLOW_COPY_AND_ASSIGN(SavableResourcesResult);
60 }; 56 };
61 57
62 // Get all savable resource links from specified webframe. 58 // Get all savable resource links from specified webframe.
63 // Returns true if the saved resources links have been saved successfully. 59 // Returns true if the saved resources links have been saved successfully.
64 // Otherwise returns false (i.e. if the frame contains a non-savable content). 60 // Otherwise returns false (i.e. if the frame contains a non-savable content).
65 CONTENT_EXPORT bool GetSavableResourceLinksForFrame( 61 CONTENT_EXPORT bool GetSavableResourceLinksForFrame(
66 blink::WebFrame* frame, 62 blink::WebFrame* frame,
67 SavableResourcesResult* result, 63 SavableResourcesResult* result,
68 const char** savable_schemes); 64 const char** savable_schemes);
69 65
70 // Returns the value in an elements resource url attribute. For IMG, SCRIPT or 66 // Returns the value in an elements resource url attribute. For IMG, SCRIPT or
71 // INPUT TYPE=image, returns the value in "src". For LINK TYPE=text/css, returns 67 // INPUT TYPE=image, returns the value in "src". For LINK TYPE=text/css, returns
72 // the value in "href". For BODY, TABLE, TR, TD, returns the value in 68 // the value in "href". For BODY, TABLE, TR, TD, returns the value in
73 // "background". For BLOCKQUOTE, Q, DEL, INS, returns the value in "cite" 69 // "background". For BLOCKQUOTE, Q, DEL, INS, returns the value in "cite"
74 // attribute. Otherwise returns a null WebString. 70 // attribute. Otherwise returns a null WebString.
75 CONTENT_EXPORT blink::WebString GetSubResourceLinkFromElement( 71 CONTENT_EXPORT blink::WebString GetSubResourceLinkFromElement(
76 const blink::WebElement& element); 72 const blink::WebElement& element);
77 73
78 } // namespace content 74 } // namespace content
79 75
80 #endif // CONTENT_RENDERER_SAVABLE_RESOURCES_H_ 76 #endif // CONTENT_RENDERER_SAVABLE_RESOURCES_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698