[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" |
initial.commit | f5b16fe | 2008-07-27 00:20:51 | [diff] [blame] | 12 | #include "googleurl/src/gurl.h" |
[email protected] | c2d98651 | 2012-05-12 00:22:46 | [diff] [blame] | 13 | #include "third_party/WebKit/Source/Platform/chromium/public/WebReferrerPolicy.h" |
initial.commit | f5b16fe | 2008-07-27 00:20:51 | [diff] [blame] | 14 | |
[email protected] | 50ae00ef | 2009-10-19 05:11:03 | [diff] [blame] | 15 | namespace WebKit { |
[email protected] | e768baf | 2010-07-16 19:36:16 | [diff] [blame] | 16 | class WebElement; |
| 17 | class WebString; |
[email protected] | 50ae00ef | 2009-10-19 05:11:03 | [diff] [blame] | 18 | class WebView; |
| 19 | } |
| 20 | |
initial.commit | f5b16fe | 2008-07-27 00:20:51 | [diff] [blame] | 21 | // A collection of operations that access the underlying WebKit DOM directly. |
[email protected] | 12a936d | 2013-05-15 04:55:49 | [diff] [blame^] | 22 | namespace content { |
initial.commit | f5b16fe | 2008-07-27 00:20:51 | [diff] [blame] | 23 | |
initial.commit | f5b16fe | 2008-07-27 00:20:51 | [diff] [blame] | 24 | // Structure for storage the result of getting all savable resource links |
| 25 | // for current page. The consumer of the SavableResourcesResult is responsible |
| 26 | // for keeping these pointers valid for the lifetime of the |
| 27 | // SavableResourcesResult instance. |
| 28 | struct SavableResourcesResult { |
| 29 | // vector which contains all savable links of sub resource. |
| 30 | std::vector<GURL>* resources_list; |
| 31 | // vector which contains corresponding all referral links of sub resource, |
| 32 | // it matched with links one by one. |
[email protected] | c2d98651 | 2012-05-12 00:22:46 | [diff] [blame] | 33 | std::vector<GURL>* referrer_urls_list; |
| 34 | // and the corresponding referrer policies. |
| 35 | std::vector<WebKit::WebReferrerPolicy>* referrer_policies_list; |
initial.commit | f5b16fe | 2008-07-27 00:20:51 | [diff] [blame] | 36 | // vector which contains all savable links of main frame and sub frames. |
| 37 | std::vector<GURL>* frames_list; |
| 38 | |
| 39 | // Constructor. |
[email protected] | c2d98651 | 2012-05-12 00:22:46 | [diff] [blame] | 40 | SavableResourcesResult( |
| 41 | std::vector<GURL>* resources_list, |
| 42 | std::vector<GURL>* referrer_urls_list, |
| 43 | std::vector<WebKit::WebReferrerPolicy>* referrer_policies_list, |
| 44 | std::vector<GURL>* frames_list) |
initial.commit | f5b16fe | 2008-07-27 00:20:51 | [diff] [blame] | 45 | : resources_list(resources_list), |
[email protected] | c2d98651 | 2012-05-12 00:22:46 | [diff] [blame] | 46 | referrer_urls_list(referrer_urls_list), |
| 47 | referrer_policies_list(referrer_policies_list), |
initial.commit | f5b16fe | 2008-07-27 00:20:51 | [diff] [blame] | 48 | frames_list(frames_list) { } |
| 49 | |
| 50 | private: |
[email protected] | 8066b15 | 2010-06-05 18:55:56 | [diff] [blame] | 51 | DISALLOW_COPY_AND_ASSIGN(SavableResourcesResult); |
initial.commit | f5b16fe | 2008-07-27 00:20:51 | [diff] [blame] | 52 | }; |
| 53 | |
| 54 | // Get all savable resource links from current webview, include main frame |
| 55 | // and sub-frame. After collecting all savable resource links, this function |
| 56 | // will send those links to embedder. Return value indicates whether we get |
| 57 | // all saved resource links successfully. |
[email protected] | 12a936d | 2013-05-15 04:55:49 | [diff] [blame^] | 58 | CONTENT_EXPORT bool GetAllSavableResourceLinksForCurrentPage( |
[email protected] | 51678ad | 2011-12-02 19:07:50 | [diff] [blame] | 59 | WebKit::WebView* view, |
[email protected] | 12a936d | 2013-05-15 04:55:49 | [diff] [blame^] | 60 | const GURL& page_url, |
| 61 | SavableResourcesResult* savable_resources_result, |
[email protected] | dbeb395 | 2009-10-13 18:01:18 | [diff] [blame] | 62 | const char** savable_schemes); |
initial.commit | f5b16fe | 2008-07-27 00:20:51 | [diff] [blame] | 63 | |
[email protected] | d9ec5c0f | 2009-12-23 11:55:07 | [diff] [blame] | 64 | // Returns the value in an elements resource url attribute. For IMG, SCRIPT or |
| 65 | // INPUT TYPE=image, returns the value in "src". For LINK TYPE=text/css, returns |
| 66 | // the value in "href". For BODY, TABLE, TR, TD, returns the value in |
| 67 | // "background". For BLOCKQUOTE, Q, DEL, INS, returns the value in "cite" |
| 68 | // attribute. Otherwise returns a null WebString. |
[email protected] | 12a936d | 2013-05-15 04:55:49 | [diff] [blame^] | 69 | CONTENT_EXPORT WebKit::WebString GetSubResourceLinkFromElement( |
[email protected] | d9ec5c0f | 2009-12-23 11:55:07 | [diff] [blame] | 70 | const WebKit::WebElement& element); |
| 71 | |
[email protected] | 12a936d | 2013-05-15 04:55:49 | [diff] [blame^] | 72 | } // namespace content |
initial.commit | f5b16fe | 2008-07-27 00:20:51 | [diff] [blame] | 73 | |
[email protected] | 12a936d | 2013-05-15 04:55:49 | [diff] [blame^] | 74 | #endif // CONTENT_RENDERER_SAVABLE_RESOURCES_H_ |