blob: ee314deafc2ca628739bb672e617798aa234a455 [file] [log] [blame]
[email protected]12a936d2013-05-15 04:55:491// Copyright (c) 2013 The Chromium Authors. All rights reserved.
license.botbf09a502008-08-24 00:55:552// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
initial.commitf5b16fe2008-07-27 00:20:514
[email protected]12a936d2013-05-15 04:55:495#ifndef CONTENT_RENDERER_SAVABLE_RESOURCES_H_
6#define CONTENT_RENDERER_SAVABLE_RESOURCES_H_
initial.commitf5b16fe2008-07-27 00:20:517
8#include <string>
[email protected]7f3281452010-02-24 21:27:029#include <vector>
initial.commitf5b16fe2008-07-27 00:20:5110
avi1023d012015-12-25 02:39:1411#include "base/macros.h"
[email protected]12a936d2013-05-15 04:55:4912#include "content/common/content_export.h"
lukasza779a08f82015-11-04 18:27:0413#include "content/common/savable_subframe.h"
Richard Li49fe04d2018-10-21 09:07:1914#include "services/network/public/mojom/referrer_policy.mojom.h"
[email protected]707e1c42013-07-09 21:18:5815#include "url/gurl.h"
initial.commitf5b16fe2008-07-27 00:20:5116
[email protected]180ef242013-11-07 06:50:4617namespace blink {
[email protected]e768baf2010-07-16 19:36:1618class WebElement;
lukaszabedb4b22017-06-23 00:00:1319class WebLocalFrame;
[email protected]e768baf2010-07-16 19:36:1620class WebString;
[email protected]50ae00ef2009-10-19 05:11:0321}
22
initial.commitf5b16fe2008-07-27 00:20:5123// A collection of operations that access the underlying WebKit DOM directly.
[email protected]12a936d2013-05-15 04:55:4924namespace content {
initial.commitf5b16fe2008-07-27 00:20:5125
initial.commitf5b16fe2008-07-27 00:20:5126// 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.
30struct SavableResourcesResult {
lukasza87f4e2ab2015-11-04 16:03:0331 // Links of all savable resources.
initial.commitf5b16fe2008-07-27 00:20:5132 std::vector<GURL>* resources_list;
initial.commitf5b16fe2008-07-27 00:20:5133
lukasza779a08f82015-11-04 18:27:0434 // Subframes.
35 std::vector<SavableSubframe>* subframes;
lukasza87f4e2ab2015-11-04 16:03:0336
initial.commitf5b16fe2008-07-27 00:20:5137 // Constructor.
lukasza87f4e2ab2015-11-04 16:03:0338 SavableResourcesResult(
39 std::vector<GURL>* resources_list,
lukasza779a08f82015-11-04 18:27:0440 std::vector<SavableSubframe>* subframes)
lukasza87f4e2ab2015-11-04 16:03:0341 : resources_list(resources_list),
lukasza87f4e2ab2015-11-04 16:03:0342 subframes(subframes) {}
initial.commitf5b16fe2008-07-27 00:20:5143
44 private:
[email protected]8066b152010-06-05 18:55:5645 DISALLOW_COPY_AND_ASSIGN(SavableResourcesResult);
initial.commitf5b16fe2008-07-27 00:20:5146};
47
lukaszabedb4b22017-06-23 00:00:1348// Get all the savable resource links from the specified |frame|.
lukasza6af746b72015-09-18 23:37:2249// 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).
51CONTENT_EXPORT bool GetSavableResourceLinksForFrame(
lukaszabedb4b22017-06-23 00:00:1352 blink::WebLocalFrame* frame,
jame0dcd982017-01-11 03:13:4553 SavableResourcesResult* result);
initial.commitf5b16fe2008-07-27 00:20:5154
[email protected]d9ec5c0f2009-12-23 11:55:0755// 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]180ef242013-11-07 06:50:4660CONTENT_EXPORT blink::WebString GetSubResourceLinkFromElement(
61 const blink::WebElement& element);
[email protected]d9ec5c0f2009-12-23 11:55:0762
[email protected]12a936d2013-05-15 04:55:4963} // namespace content
initial.commitf5b16fe2008-07-27 00:20:5164
[email protected]12a936d2013-05-15 04:55:4965#endif // CONTENT_RENDERER_SAVABLE_RESOURCES_H_