[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" |
[email protected] | 5c30b5e0 | 2013-05-30 03:46:08 | [diff] [blame] | 14 | #include "third_party/WebKit/public/platform/WebReferrerPolicy.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 | 6af746b7 | 2015-09-18 23:37:22 | [diff] [blame] | 19 | class WebFrame; |
[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 | class WebView; |
| 22 | } |
| 23 | |
initial.commit | f5b16fe | 2008-07-27 00:20:51 | [diff] [blame] | 24 | // A collection of operations that access the underlying WebKit DOM directly. |
[email protected] | 12a936d | 2013-05-15 04:55:49 | [diff] [blame] | 25 | namespace content { |
initial.commit | f5b16fe | 2008-07-27 00:20:51 | [diff] [blame] | 26 | |
initial.commit | f5b16fe | 2008-07-27 00:20:51 | [diff] [blame] | 27 | // Structure for storage the result of getting all savable resource links |
| 28 | // for current page. The consumer of the SavableResourcesResult is responsible |
| 29 | // for keeping these pointers valid for the lifetime of the |
| 30 | // SavableResourcesResult instance. |
| 31 | struct SavableResourcesResult { |
lukasza | 87f4e2ab | 2015-11-04 16:03:03 | [diff] [blame] | 32 | // Links of all savable resources. |
initial.commit | f5b16fe | 2008-07-27 00:20:51 | [diff] [blame] | 33 | std::vector<GURL>* resources_list; |
initial.commit | f5b16fe | 2008-07-27 00:20:51 | [diff] [blame] | 34 | |
lukasza | 779a08f8 | 2015-11-04 18:27:04 | [diff] [blame] | 35 | // Subframes. |
| 36 | std::vector<SavableSubframe>* subframes; |
lukasza | 87f4e2ab | 2015-11-04 16:03:03 | [diff] [blame] | 37 | |
initial.commit | f5b16fe | 2008-07-27 00:20:51 | [diff] [blame] | 38 | // Constructor. |
lukasza | 87f4e2ab | 2015-11-04 16:03:03 | [diff] [blame] | 39 | SavableResourcesResult( |
| 40 | std::vector<GURL>* resources_list, |
lukasza | 779a08f8 | 2015-11-04 18:27:04 | [diff] [blame] | 41 | std::vector<SavableSubframe>* subframes) |
lukasza | 87f4e2ab | 2015-11-04 16:03:03 | [diff] [blame] | 42 | : resources_list(resources_list), |
lukasza | 87f4e2ab | 2015-11-04 16:03:03 | [diff] [blame] | 43 | subframes(subframes) {} |
initial.commit | f5b16fe | 2008-07-27 00:20:51 | [diff] [blame] | 44 | |
| 45 | private: |
[email protected] | 8066b15 | 2010-06-05 18:55:56 | [diff] [blame] | 46 | DISALLOW_COPY_AND_ASSIGN(SavableResourcesResult); |
initial.commit | f5b16fe | 2008-07-27 00:20:51 | [diff] [blame] | 47 | }; |
| 48 | |
lukasza | 6af746b7 | 2015-09-18 23:37:22 | [diff] [blame] | 49 | // Get all savable resource links from specified webframe. |
| 50 | // Returns true if the saved resources links have been saved successfully. |
| 51 | // Otherwise returns false (i.e. if the frame contains a non-savable content). |
| 52 | CONTENT_EXPORT bool GetSavableResourceLinksForFrame( |
| 53 | blink::WebFrame* frame, |
| 54 | SavableResourcesResult* result, |
[email protected] | dbeb395 | 2009-10-13 18:01:18 | [diff] [blame] | 55 | const char** savable_schemes); |
initial.commit | f5b16fe | 2008-07-27 00:20:51 | [diff] [blame] | 56 | |
[email protected] | d9ec5c0f | 2009-12-23 11:55:07 | [diff] [blame] | 57 | // Returns the value in an elements resource url attribute. For IMG, SCRIPT or |
| 58 | // INPUT TYPE=image, returns the value in "src". For LINK TYPE=text/css, returns |
| 59 | // the value in "href". For BODY, TABLE, TR, TD, returns the value in |
| 60 | // "background". For BLOCKQUOTE, Q, DEL, INS, returns the value in "cite" |
| 61 | // attribute. Otherwise returns a null WebString. |
[email protected] | 180ef24 | 2013-11-07 06:50:46 | [diff] [blame] | 62 | CONTENT_EXPORT blink::WebString GetSubResourceLinkFromElement( |
| 63 | const blink::WebElement& element); |
[email protected] | d9ec5c0f | 2009-12-23 11:55:07 | [diff] [blame] | 64 | |
[email protected] | 12a936d | 2013-05-15 04:55:49 | [diff] [blame] | 65 | } // namespace content |
initial.commit | f5b16fe | 2008-07-27 00:20:51 | [diff] [blame] | 66 | |
[email protected] | 12a936d | 2013-05-15 04:55:49 | [diff] [blame] | 67 | #endif // CONTENT_RENDERER_SAVABLE_RESOURCES_H_ |