[email protected] | 12a936d | 2013-05-15 04:55:49 | [diff] [blame] | 1 | // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
license.bot | bf09a50 | 2008-08-24 00:55:55 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
initial.commit | f5b16fe | 2008-07-27 00:20:51 | [diff] [blame] | 4 | |
[email protected] | 12a936d | 2013-05-15 04:55:49 | [diff] [blame] | 5 | #ifndef CONTENT_RENDERER_SAVABLE_RESOURCES_H_ |
| 6 | #define CONTENT_RENDERER_SAVABLE_RESOURCES_H_ |
initial.commit | f5b16fe | 2008-07-27 00:20:51 | [diff] [blame] | 7 | |
| 8 | #include <string> |
[email protected] | 7f328145 | 2010-02-24 21:27:02 | [diff] [blame] | 9 | #include <vector> |
initial.commit | f5b16fe | 2008-07-27 00:20:51 | [diff] [blame] | 10 | |
[email protected] | 12a936d | 2013-05-15 04:55:49 | [diff] [blame] | 11 | #include "content/common/content_export.h" |
[email protected] | 5c30b5e0 | 2013-05-30 03:46:08 | [diff] [blame] | 12 | #include "third_party/WebKit/public/platform/WebReferrerPolicy.h" |
[email protected] | 707e1c4 | 2013-07-09 21:18:58 | [diff] [blame] | 13 | #include "url/gurl.h" |
initial.commit | f5b16fe | 2008-07-27 00:20:51 | [diff] [blame] | 14 | |
[email protected] | 180ef24 | 2013-11-07 06:50:46 | [diff] [blame] | 15 | namespace blink { |
[email protected] | e768baf | 2010-07-16 19:36:16 | [diff] [blame] | 16 | class WebElement; |
lukasza | 6af746b7 | 2015-09-18 23:37:22 | [diff] [blame] | 17 | class WebFrame; |
[email protected] | e768baf | 2010-07-16 19:36:16 | [diff] [blame] | 18 | class WebString; |
[email protected] | 50ae00ef | 2009-10-19 05:11:03 | [diff] [blame] | 19 | class WebView; |
| 20 | } |
| 21 | |
initial.commit | f5b16fe | 2008-07-27 00:20:51 | [diff] [blame] | 22 | // A collection of operations that access the underlying WebKit DOM directly. |
[email protected] | 12a936d | 2013-05-15 04:55:49 | [diff] [blame] | 23 | namespace content { |
initial.commit | f5b16fe | 2008-07-27 00:20:51 | [diff] [blame] | 24 | |
initial.commit | f5b16fe | 2008-07-27 00:20:51 | [diff] [blame] | 25 | // Structure for storage the result of getting all savable resource links |
| 26 | // for current page. The consumer of the SavableResourcesResult is responsible |
| 27 | // for keeping these pointers valid for the lifetime of the |
| 28 | // SavableResourcesResult instance. |
| 29 | struct SavableResourcesResult { |
lukasza | 87f4e2ab | 2015-11-04 16:03:03 | [diff] [blame^] | 30 | // Links of all savable resources. |
initial.commit | f5b16fe | 2008-07-27 00:20:51 | [diff] [blame] | 31 | std::vector<GURL>* resources_list; |
initial.commit | f5b16fe | 2008-07-27 00:20:51 | [diff] [blame] | 32 | |
lukasza | 87f4e2ab | 2015-11-04 16:03:03 | [diff] [blame^] | 33 | // Original urls of subframes. |
| 34 | std::vector<GURL>* subframe_original_urls; |
| 35 | // Subframe objects. |
| 36 | // subframes[i] corresponds to subframe_original_urls[i]. |
| 37 | std::vector<blink::WebFrame*>* subframes; |
| 38 | |
initial.commit | f5b16fe | 2008-07-27 00:20:51 | [diff] [blame] | 39 | // Constructor. |
lukasza | 87f4e2ab | 2015-11-04 16:03:03 | [diff] [blame^] | 40 | SavableResourcesResult( |
| 41 | std::vector<GURL>* resources_list, |
| 42 | std::vector<GURL>* subframe_original_urls, |
| 43 | std::vector<blink::WebFrame*>* subframes) |
| 44 | : resources_list(resources_list), |
| 45 | subframe_original_urls(subframe_original_urls), |
| 46 | subframes(subframes) {} |
initial.commit | f5b16fe | 2008-07-27 00:20:51 | [diff] [blame] | 47 | |
| 48 | private: |
[email protected] | 8066b15 | 2010-06-05 18:55:56 | [diff] [blame] | 49 | DISALLOW_COPY_AND_ASSIGN(SavableResourcesResult); |
initial.commit | f5b16fe | 2008-07-27 00:20:51 | [diff] [blame] | 50 | }; |
| 51 | |
lukasza | 6af746b7 | 2015-09-18 23:37:22 | [diff] [blame] | 52 | // Get all savable resource links from specified webframe. |
| 53 | // 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). |
| 55 | CONTENT_EXPORT bool GetSavableResourceLinksForFrame( |
| 56 | blink::WebFrame* frame, |
| 57 | SavableResourcesResult* result, |
[email protected] | dbeb395 | 2009-10-13 18:01:18 | [diff] [blame] | 58 | const char** savable_schemes); |
initial.commit | f5b16fe | 2008-07-27 00:20:51 | [diff] [blame] | 59 | |
[email protected] | d9ec5c0f | 2009-12-23 11:55:07 | [diff] [blame] | 60 | // 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 |
| 62 | // 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" |
| 64 | // attribute. Otherwise returns a null WebString. |
[email protected] | 180ef24 | 2013-11-07 06:50:46 | [diff] [blame] | 65 | CONTENT_EXPORT blink::WebString GetSubResourceLinkFromElement( |
| 66 | const blink::WebElement& element); |
[email protected] | d9ec5c0f | 2009-12-23 11:55:07 | [diff] [blame] | 67 | |
[email protected] | 12a936d | 2013-05-15 04:55:49 | [diff] [blame] | 68 | } // namespace content |
initial.commit | f5b16fe | 2008-07-27 00:20:51 | [diff] [blame] | 69 | |
[email protected] | 12a936d | 2013-05-15 04:55:49 | [diff] [blame] | 70 | #endif // CONTENT_RENDERER_SAVABLE_RESOURCES_H_ |