[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 | |
avi | 1023d01 | 2015-12-25 02:39:14 | [diff] [blame] | 11 | #include "base/macros.h" |
[email protected] | 12a936d | 2013-05-15 04:55:49 | [diff] [blame] | 12 | #include "content/common/content_export.h" |
lukasza | 779a08f8 | 2015-11-04 18:27:04 | [diff] [blame] | 13 | #include "content/common/savable_subframe.h" |
Richard Li | 49fe04d | 2018-10-21 09:07:19 | [diff] [blame] | 14 | #include "services/network/public/mojom/referrer_policy.mojom.h" |
[email protected] | 707e1c4 | 2013-07-09 21:18:58 | [diff] [blame] | 15 | #include "url/gurl.h" |
initial.commit | f5b16fe | 2008-07-27 00:20:51 | [diff] [blame] | 16 | |
[email protected] | 180ef24 | 2013-11-07 06:50:46 | [diff] [blame] | 17 | namespace blink { |
[email protected] | e768baf | 2010-07-16 19:36:16 | [diff] [blame] | 18 | class WebElement; |
lukasza | bedb4b2 | 2017-06-23 00:00:13 | [diff] [blame] | 19 | class WebLocalFrame; |
[email protected] | e768baf | 2010-07-16 19:36:16 | [diff] [blame] | 20 | class WebString; |
[email protected] | 50ae00ef | 2009-10-19 05:11:03 | [diff] [blame] | 21 | } |
| 22 | |
initial.commit | f5b16fe | 2008-07-27 00:20:51 | [diff] [blame] | 23 | // A collection of operations that access the underlying WebKit DOM directly. |
[email protected] | 12a936d | 2013-05-15 04:55:49 | [diff] [blame] | 24 | namespace content { |
initial.commit | f5b16fe | 2008-07-27 00:20:51 | [diff] [blame] | 25 | |
initial.commit | f5b16fe | 2008-07-27 00:20:51 | [diff] [blame] | 26 | // Structure for storage the result of getting all savable resource links |
| 27 | // for current page. The consumer of the SavableResourcesResult is responsible |
| 28 | // for keeping these pointers valid for the lifetime of the |
| 29 | // SavableResourcesResult instance. |
| 30 | struct SavableResourcesResult { |
lukasza | 87f4e2ab | 2015-11-04 16:03:03 | [diff] [blame] | 31 | // Links of all savable resources. |
initial.commit | f5b16fe | 2008-07-27 00:20:51 | [diff] [blame] | 32 | std::vector<GURL>* resources_list; |
initial.commit | f5b16fe | 2008-07-27 00:20:51 | [diff] [blame] | 33 | |
lukasza | 779a08f8 | 2015-11-04 18:27:04 | [diff] [blame] | 34 | // Subframes. |
| 35 | std::vector<SavableSubframe>* subframes; |
lukasza | 87f4e2ab | 2015-11-04 16:03:03 | [diff] [blame] | 36 | |
initial.commit | f5b16fe | 2008-07-27 00:20:51 | [diff] [blame] | 37 | // Constructor. |
lukasza | 87f4e2ab | 2015-11-04 16:03:03 | [diff] [blame] | 38 | SavableResourcesResult( |
| 39 | std::vector<GURL>* resources_list, |
lukasza | 779a08f8 | 2015-11-04 18:27:04 | [diff] [blame] | 40 | std::vector<SavableSubframe>* subframes) |
lukasza | 87f4e2ab | 2015-11-04 16:03:03 | [diff] [blame] | 41 | : resources_list(resources_list), |
lukasza | 87f4e2ab | 2015-11-04 16:03:03 | [diff] [blame] | 42 | subframes(subframes) {} |
initial.commit | f5b16fe | 2008-07-27 00:20:51 | [diff] [blame] | 43 | |
| 44 | private: |
[email protected] | 8066b15 | 2010-06-05 18:55:56 | [diff] [blame] | 45 | DISALLOW_COPY_AND_ASSIGN(SavableResourcesResult); |
initial.commit | f5b16fe | 2008-07-27 00:20:51 | [diff] [blame] | 46 | }; |
| 47 | |
lukasza | bedb4b2 | 2017-06-23 00:00:13 | [diff] [blame] | 48 | // Get all the savable resource links from the specified |frame|. |
lukasza | 6af746b7 | 2015-09-18 23:37:22 | [diff] [blame] | 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). |
| 51 | CONTENT_EXPORT bool GetSavableResourceLinksForFrame( |
lukasza | bedb4b2 | 2017-06-23 00:00:13 | [diff] [blame] | 52 | blink::WebLocalFrame* frame, |
jam | e0dcd98 | 2017-01-11 03:13:45 | [diff] [blame] | 53 | SavableResourcesResult* result); |
initial.commit | f5b16fe | 2008-07-27 00:20:51 | [diff] [blame] | 54 | |
[email protected] | d9ec5c0f | 2009-12-23 11:55:07 | [diff] [blame] | 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 |
| 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" |
| 59 | // attribute. Otherwise returns a null WebString. |
[email protected] | 180ef24 | 2013-11-07 06:50:46 | [diff] [blame] | 60 | CONTENT_EXPORT blink::WebString GetSubResourceLinkFromElement( |
| 61 | const blink::WebElement& element); |
[email protected] | d9ec5c0f | 2009-12-23 11:55:07 | [diff] [blame] | 62 | |
[email protected] | 12a936d | 2013-05-15 04:55:49 | [diff] [blame] | 63 | } // namespace content |
initial.commit | f5b16fe | 2008-07-27 00:20:51 | [diff] [blame] | 64 | |
[email protected] | 12a936d | 2013-05-15 04:55:49 | [diff] [blame] | 65 | #endif // CONTENT_RENDERER_SAVABLE_RESOURCES_H_ |