blob: eb9896095c2752b708bce86717e36c3a144b4b89 [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
[email protected]12a936d2013-05-15 04:55:4911#include "content/common/content_export.h"
lukasza779a08f82015-11-04 18:27:0412#include "content/common/savable_subframe.h"
[email protected]5c30b5e02013-05-30 03:46:0813#include "third_party/WebKit/public/platform/WebReferrerPolicy.h"
[email protected]707e1c42013-07-09 21:18:5814#include "url/gurl.h"
initial.commitf5b16fe2008-07-27 00:20:5115
[email protected]180ef242013-11-07 06:50:4616namespace blink {
[email protected]e768baf2010-07-16 19:36:1617class WebElement;
lukasza6af746b72015-09-18 23:37:2218class WebFrame;
[email protected]e768baf2010-07-16 19:36:1619class WebString;
[email protected]50ae00ef2009-10-19 05:11:0320class WebView;
21}
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
lukasza6af746b72015-09-18 23:37:2248// Get all savable resource links from specified webframe.
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).
51CONTENT_EXPORT bool GetSavableResourceLinksForFrame(
52 blink::WebFrame* frame,
53 SavableResourcesResult* result,
[email protected]dbeb3952009-10-13 18:01:1854 const char** savable_schemes);
initial.commitf5b16fe2008-07-27 00:20:5155
[email protected]d9ec5c0f2009-12-23 11:55:0756// Returns the value in an elements resource url attribute. For IMG, SCRIPT or
57// INPUT TYPE=image, returns the value in "src". For LINK TYPE=text/css, returns
58// the value in "href". For BODY, TABLE, TR, TD, returns the value in
59// "background". For BLOCKQUOTE, Q, DEL, INS, returns the value in "cite"
60// attribute. Otherwise returns a null WebString.
[email protected]180ef242013-11-07 06:50:4661CONTENT_EXPORT blink::WebString GetSubResourceLinkFromElement(
62 const blink::WebElement& element);
[email protected]d9ec5c0f2009-12-23 11:55:0763
[email protected]12a936d2013-05-15 04:55:4964} // namespace content
initial.commitf5b16fe2008-07-27 00:20:5165
[email protected]12a936d2013-05-15 04:55:4966#endif // CONTENT_RENDERER_SAVABLE_RESOURCES_H_