blob: b12d3507939b0a429ff4a10373bc8a2efa2e364e [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"
[email protected]5c30b5e02013-05-30 03:46:0814#include "third_party/WebKit/public/platform/WebReferrerPolicy.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;
lukasza6af746b72015-09-18 23:37:2219class WebFrame;
[email protected]e768baf2010-07-16 19:36:1620class WebString;
[email protected]50ae00ef2009-10-19 05:11:0321class WebView;
22}
23
initial.commitf5b16fe2008-07-27 00:20:5124// A collection of operations that access the underlying WebKit DOM directly.
[email protected]12a936d2013-05-15 04:55:4925namespace content {
initial.commitf5b16fe2008-07-27 00:20:5126
initial.commitf5b16fe2008-07-27 00:20:5127// 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.
31struct SavableResourcesResult {
lukasza87f4e2ab2015-11-04 16:03:0332 // Links of all savable resources.
initial.commitf5b16fe2008-07-27 00:20:5133 std::vector<GURL>* resources_list;
initial.commitf5b16fe2008-07-27 00:20:5134
lukasza779a08f82015-11-04 18:27:0435 // Subframes.
36 std::vector<SavableSubframe>* subframes;
lukasza87f4e2ab2015-11-04 16:03:0337
initial.commitf5b16fe2008-07-27 00:20:5138 // Constructor.
lukasza87f4e2ab2015-11-04 16:03:0339 SavableResourcesResult(
40 std::vector<GURL>* resources_list,
lukasza779a08f82015-11-04 18:27:0441 std::vector<SavableSubframe>* subframes)
lukasza87f4e2ab2015-11-04 16:03:0342 : resources_list(resources_list),
lukasza87f4e2ab2015-11-04 16:03:0343 subframes(subframes) {}
initial.commitf5b16fe2008-07-27 00:20:5144
45 private:
[email protected]8066b152010-06-05 18:55:5646 DISALLOW_COPY_AND_ASSIGN(SavableResourcesResult);
initial.commitf5b16fe2008-07-27 00:20:5147};
48
lukasza6af746b72015-09-18 23:37:2249// 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).
52CONTENT_EXPORT bool GetSavableResourceLinksForFrame(
53 blink::WebFrame* frame,
54 SavableResourcesResult* result,
[email protected]dbeb3952009-10-13 18:01:1855 const char** savable_schemes);
initial.commitf5b16fe2008-07-27 00:20:5156
[email protected]d9ec5c0f2009-12-23 11:55:0757// 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]180ef242013-11-07 06:50:4662CONTENT_EXPORT blink::WebString GetSubResourceLinkFromElement(
63 const blink::WebElement& element);
[email protected]d9ec5c0f2009-12-23 11:55:0764
[email protected]12a936d2013-05-15 04:55:4965} // namespace content
initial.commitf5b16fe2008-07-27 00:20:5166
[email protected]12a936d2013-05-15 04:55:4967#endif // CONTENT_RENDERER_SAVABLE_RESOURCES_H_