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