blob: 7aa54a11b6fecf6e340919b127c55a91c1dcd172 [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"
[email protected]5c30b5e02013-05-30 03:46:0812#include "third_party/WebKit/public/platform/WebReferrerPolicy.h"
[email protected]707e1c42013-07-09 21:18:5813#include "url/gurl.h"
initial.commitf5b16fe2008-07-27 00:20:5114
[email protected]180ef242013-11-07 06:50:4615namespace blink {
[email protected]e768baf2010-07-16 19:36:1616class WebElement;
lukasza6af746b72015-09-18 23:37:2217class WebFrame;
[email protected]e768baf2010-07-16 19:36:1618class WebString;
[email protected]50ae00ef2009-10-19 05:11:0319class WebView;
20}
21
initial.commitf5b16fe2008-07-27 00:20:5122// A collection of operations that access the underlying WebKit DOM directly.
[email protected]12a936d2013-05-15 04:55:4923namespace content {
initial.commitf5b16fe2008-07-27 00:20:5124
initial.commitf5b16fe2008-07-27 00:20:5125// Structure for storage the result of getting all savable resource links
26// for current page. The consumer of the SavableResourcesResult is responsible
27// for keeping these pointers valid for the lifetime of the
28// SavableResourcesResult instance.
29struct SavableResourcesResult {
lukasza87f4e2ab2015-11-04 16:03:0330 // Links of all savable resources.
initial.commitf5b16fe2008-07-27 00:20:5131 std::vector<GURL>* resources_list;
initial.commitf5b16fe2008-07-27 00:20:5132
lukasza87f4e2ab2015-11-04 16:03:0333 // Original urls of subframes.
34 std::vector<GURL>* subframe_original_urls;
35 // Subframe objects.
36 // subframes[i] corresponds to subframe_original_urls[i].
37 std::vector<blink::WebFrame*>* subframes;
38
initial.commitf5b16fe2008-07-27 00:20:5139 // Constructor.
lukasza87f4e2ab2015-11-04 16:03:0340 SavableResourcesResult(
41 std::vector<GURL>* resources_list,
42 std::vector<GURL>* subframe_original_urls,
43 std::vector<blink::WebFrame*>* subframes)
44 : resources_list(resources_list),
45 subframe_original_urls(subframe_original_urls),
46 subframes(subframes) {}
initial.commitf5b16fe2008-07-27 00:20:5147
48 private:
[email protected]8066b152010-06-05 18:55:5649 DISALLOW_COPY_AND_ASSIGN(SavableResourcesResult);
initial.commitf5b16fe2008-07-27 00:20:5150};
51
lukasza6af746b72015-09-18 23:37:2252// Get all savable resource links from specified webframe.
53// Returns true if the saved resources links have been saved successfully.
54// Otherwise returns false (i.e. if the frame contains a non-savable content).
55CONTENT_EXPORT bool GetSavableResourceLinksForFrame(
56 blink::WebFrame* frame,
57 SavableResourcesResult* result,
[email protected]dbeb3952009-10-13 18:01:1858 const char** savable_schemes);
initial.commitf5b16fe2008-07-27 00:20:5159
[email protected]d9ec5c0f2009-12-23 11:55:0760// Returns the value in an elements resource url attribute. For IMG, SCRIPT or
61// INPUT TYPE=image, returns the value in "src". For LINK TYPE=text/css, returns
62// the value in "href". For BODY, TABLE, TR, TD, returns the value in
63// "background". For BLOCKQUOTE, Q, DEL, INS, returns the value in "cite"
64// attribute. Otherwise returns a null WebString.
[email protected]180ef242013-11-07 06:50:4665CONTENT_EXPORT blink::WebString GetSubResourceLinkFromElement(
66 const blink::WebElement& element);
[email protected]d9ec5c0f2009-12-23 11:55:0767
[email protected]12a936d2013-05-15 04:55:4968} // namespace content
initial.commitf5b16fe2008-07-27 00:20:5169
[email protected]12a936d2013-05-15 04:55:4970#endif // CONTENT_RENDERER_SAVABLE_RESOURCES_H_