blob: 6d422ea36a463fbeb0e3dce4167de3f1ac6f83a6 [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"
initial.commitf5b16fe2008-07-27 00:20:5112#include "googleurl/src/gurl.h"
[email protected]c2d986512012-05-12 00:22:4613#include "third_party/WebKit/Source/Platform/chromium/public/WebReferrerPolicy.h"
initial.commitf5b16fe2008-07-27 00:20:5114
[email protected]50ae00ef2009-10-19 05:11:0315namespace WebKit {
[email protected]e768baf2010-07-16 19:36:1616class WebElement;
17class WebString;
[email protected]50ae00ef2009-10-19 05:11:0318class WebView;
19}
20
initial.commitf5b16fe2008-07-27 00:20:5121// A collection of operations that access the underlying WebKit DOM directly.
[email protected]12a936d2013-05-15 04:55:4922namespace content {
initial.commitf5b16fe2008-07-27 00:20:5123
initial.commitf5b16fe2008-07-27 00:20:5124// 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.
28struct 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]c2d986512012-05-12 00:22:4633 std::vector<GURL>* referrer_urls_list;
34 // and the corresponding referrer policies.
35 std::vector<WebKit::WebReferrerPolicy>* referrer_policies_list;
initial.commitf5b16fe2008-07-27 00:20:5136 // vector which contains all savable links of main frame and sub frames.
37 std::vector<GURL>* frames_list;
38
39 // Constructor.
[email protected]c2d986512012-05-12 00:22:4640 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.commitf5b16fe2008-07-27 00:20:5145 : resources_list(resources_list),
[email protected]c2d986512012-05-12 00:22:4646 referrer_urls_list(referrer_urls_list),
47 referrer_policies_list(referrer_policies_list),
initial.commitf5b16fe2008-07-27 00:20:5148 frames_list(frames_list) { }
49
50 private:
[email protected]8066b152010-06-05 18:55:5651 DISALLOW_COPY_AND_ASSIGN(SavableResourcesResult);
initial.commitf5b16fe2008-07-27 00:20:5152};
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]12a936d2013-05-15 04:55:4958CONTENT_EXPORT bool GetAllSavableResourceLinksForCurrentPage(
[email protected]51678ad2011-12-02 19:07:5059 WebKit::WebView* view,
[email protected]12a936d2013-05-15 04:55:4960 const GURL& page_url,
61 SavableResourcesResult* savable_resources_result,
[email protected]dbeb3952009-10-13 18:01:1862 const char** savable_schemes);
initial.commitf5b16fe2008-07-27 00:20:5163
[email protected]d9ec5c0f2009-12-23 11:55:0764// 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]12a936d2013-05-15 04:55:4969CONTENT_EXPORT WebKit::WebString GetSubResourceLinkFromElement(
[email protected]d9ec5c0f2009-12-23 11:55:0770 const WebKit::WebElement& element);
71
[email protected]12a936d2013-05-15 04:55:4972} // namespace content
initial.commitf5b16fe2008-07-27 00:20:5173
[email protected]12a936d2013-05-15 04:55:4974#endif // CONTENT_RENDERER_SAVABLE_RESOURCES_H_