| 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 "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 | 33 |
| 33 // Original urls of subframes. | 34 // Subframes. |
| 34 std::vector<GURL>* subframe_original_urls; | 35 std::vector<SavableSubframe>* subframes; |
| 35 // Subframe objects. | |
| 36 // subframes[i] corresponds to subframe_original_urls[i]. | |
| 37 std::vector<blink::WebFrame*>* subframes; | |
| 38 | 36 |
| 39 // Constructor. | 37 // Constructor. |
| 40 SavableResourcesResult( | 38 SavableResourcesResult( |
| 41 std::vector<GURL>* resources_list, | 39 std::vector<GURL>* resources_list, |
| 42 std::vector<GURL>* subframe_original_urls, | 40 std::vector<SavableSubframe>* subframes) |
| 43 std::vector<blink::WebFrame*>* subframes) | |
| 44 : resources_list(resources_list), | 41 : resources_list(resources_list), |
| 45 subframe_original_urls(subframe_original_urls), | |
| 46 subframes(subframes) {} | 42 subframes(subframes) {} |
| 47 | 43 |
| 48 private: | 44 private: |
| 49 DISALLOW_COPY_AND_ASSIGN(SavableResourcesResult); | 45 DISALLOW_COPY_AND_ASSIGN(SavableResourcesResult); |
| 50 }; | 46 }; |
| 51 | 47 |
| 52 // Get all savable resource links from specified webframe. | 48 // Get all savable resource links from specified webframe. |
| 53 // Returns true if the saved resources links have been saved successfully. | 49 // Returns true if the saved resources links have been saved successfully. |
| 54 // 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). |
| 55 CONTENT_EXPORT bool GetSavableResourceLinksForFrame( | 51 CONTENT_EXPORT bool GetSavableResourceLinksForFrame( |
| 56 blink::WebFrame* frame, | 52 blink::WebFrame* frame, |
| 57 SavableResourcesResult* result, | 53 SavableResourcesResult* result, |
| 58 const char** savable_schemes); | 54 const char** savable_schemes); |
| 59 | 55 |
| 60 // Returns the value in an elements resource url attribute. For IMG, SCRIPT or | 56 // Returns the value in an elements resource url attribute. For IMG, SCRIPT or |
| 61 // INPUT TYPE=image, returns the value in "src". For LINK TYPE=text/css, returns | 57 // INPUT TYPE=image, returns the value in "src". For LINK TYPE=text/css, returns |
| 62 // the value in "href". For BODY, TABLE, TR, TD, returns the value in | 58 // the value in "href". For BODY, TABLE, TR, TD, returns the value in |
| 63 // "background". For BLOCKQUOTE, Q, DEL, INS, returns the value in "cite" | 59 // "background". For BLOCKQUOTE, Q, DEL, INS, returns the value in "cite" |
| 64 // attribute. Otherwise returns a null WebString. | 60 // attribute. Otherwise returns a null WebString. |
| 65 CONTENT_EXPORT blink::WebString GetSubResourceLinkFromElement( | 61 CONTENT_EXPORT blink::WebString GetSubResourceLinkFromElement( |
| 66 const blink::WebElement& element); | 62 const blink::WebElement& element); |
| 67 | 63 |
| 68 } // namespace content | 64 } // namespace content |
| 69 | 65 |
| 70 #endif // CONTENT_RENDERER_SAVABLE_RESOURCES_H_ | 66 #endif // CONTENT_RENDERER_SAVABLE_RESOURCES_H_ |
| OLD | NEW |