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 #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 |
(...skipping 11 matching lines...) Expand all Loading... |
22 // A collection of operations that access the underlying WebKit DOM directly. | 22 // A collection of operations that access the underlying WebKit DOM directly. |
23 namespace content { | 23 namespace content { |
24 | 24 |
25 // Structure for storage the result of getting all savable resource links | 25 // Structure for storage the result of getting all savable resource links |
26 // for current page. The consumer of the SavableResourcesResult is responsible | 26 // for current page. The consumer of the SavableResourcesResult is responsible |
27 // for keeping these pointers valid for the lifetime of the | 27 // for keeping these pointers valid for the lifetime of the |
28 // SavableResourcesResult instance. | 28 // SavableResourcesResult instance. |
29 struct SavableResourcesResult { | 29 struct SavableResourcesResult { |
30 // vector which contains all savable links of sub resource. | 30 // vector which contains all savable links of sub resource. |
31 std::vector<GURL>* resources_list; | 31 std::vector<GURL>* resources_list; |
32 // vector which contains corresponding all referral links of sub resource, | |
33 // it matched with links one by one. | |
34 std::vector<GURL>* referrer_urls_list; | |
35 // and the corresponding referrer policies. | |
36 std::vector<blink::WebReferrerPolicy>* referrer_policies_list; | |
37 | 32 |
38 // Constructor. | 33 // Constructor. |
39 SavableResourcesResult( | 34 SavableResourcesResult(std::vector<GURL>* resources_list) |
40 std::vector<GURL>* resources_list, | 35 : resources_list(resources_list) {} |
41 std::vector<GURL>* referrer_urls_list, | |
42 std::vector<blink::WebReferrerPolicy>* referrer_policies_list) | |
43 : resources_list(resources_list), | |
44 referrer_urls_list(referrer_urls_list), | |
45 referrer_policies_list(referrer_policies_list) {} | |
46 | 36 |
47 private: | 37 private: |
48 DISALLOW_COPY_AND_ASSIGN(SavableResourcesResult); | 38 DISALLOW_COPY_AND_ASSIGN(SavableResourcesResult); |
49 }; | 39 }; |
50 | 40 |
51 // Get all savable resource links from specified webframe. | 41 // Get all savable resource links from specified webframe. |
52 // Returns true if the saved resources links have been saved successfully. | 42 // Returns true if the saved resources links have been saved successfully. |
53 // Otherwise returns false (i.e. if the frame contains a non-savable content). | 43 // Otherwise returns false (i.e. if the frame contains a non-savable content). |
54 CONTENT_EXPORT bool GetSavableResourceLinksForFrame( | 44 CONTENT_EXPORT bool GetSavableResourceLinksForFrame( |
55 blink::WebFrame* frame, | 45 blink::WebFrame* frame, |
56 SavableResourcesResult* result, | 46 SavableResourcesResult* result, |
57 const char** savable_schemes); | 47 const char** savable_schemes); |
58 | 48 |
59 // Returns the value in an elements resource url attribute. For IMG, SCRIPT or | 49 // Returns the value in an elements resource url attribute. For IMG, SCRIPT or |
60 // INPUT TYPE=image, returns the value in "src". For LINK TYPE=text/css, returns | 50 // INPUT TYPE=image, returns the value in "src". For LINK TYPE=text/css, returns |
61 // the value in "href". For BODY, TABLE, TR, TD, returns the value in | 51 // the value in "href". For BODY, TABLE, TR, TD, returns the value in |
62 // "background". For BLOCKQUOTE, Q, DEL, INS, returns the value in "cite" | 52 // "background". For BLOCKQUOTE, Q, DEL, INS, returns the value in "cite" |
63 // attribute. Otherwise returns a null WebString. | 53 // attribute. Otherwise returns a null WebString. |
64 CONTENT_EXPORT blink::WebString GetSubResourceLinkFromElement( | 54 CONTENT_EXPORT blink::WebString GetSubResourceLinkFromElement( |
65 const blink::WebElement& element); | 55 const blink::WebElement& element); |
66 | 56 |
67 } // namespace content | 57 } // namespace content |
68 | 58 |
69 #endif // CONTENT_RENDERER_SAVABLE_RESOURCES_H_ | 59 #endif // CONTENT_RENDERER_SAVABLE_RESOURCES_H_ |
OLD | NEW |