Roll src/third_party/WebKit eac3800:0237a66 (svn 202606:202607)
[chromium-blink-merge.git] / content / renderer / savable_resources.h
blob679ab07c3a2f024bd09eb9f3f8573c6e293e222e
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CONTENT_RENDERER_SAVABLE_RESOURCES_H_
6 #define CONTENT_RENDERER_SAVABLE_RESOURCES_H_
8 #include <string>
9 #include <vector>
11 #include "content/common/content_export.h"
12 #include "third_party/WebKit/public/platform/WebReferrerPolicy.h"
13 #include "url/gurl.h"
15 namespace blink {
16 class WebElement;
17 class WebFrame;
18 class WebString;
19 class WebView;
22 // A collection of operations that access the underlying WebKit DOM directly.
23 namespace content {
25 // 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.
29 struct SavableResourcesResult {
30 // vector which contains all savable links of sub resource.
31 std::vector<GURL>* resources_list;
32 // vector which contains corresponding all referral links of sub resource,
33 // it matched with links one by one.
34 std::vector<GURL>* referrer_urls_list;
35 // and the corresponding referrer policies.
36 std::vector<blink::WebReferrerPolicy>* referrer_policies_list;
38 // Constructor.
39 SavableResourcesResult(
40 std::vector<GURL>* resources_list,
41 std::vector<GURL>* referrer_urls_list,
42 std::vector<blink::WebReferrerPolicy>* referrer_policies_list)
43 : resources_list(resources_list),
44 referrer_urls_list(referrer_urls_list),
45 referrer_policies_list(referrer_policies_list) {}
47 private:
48 DISALLOW_COPY_AND_ASSIGN(SavableResourcesResult);
51 // Get all savable resource links from specified webframe.
52 // Returns true if the saved resources links have been saved successfully.
53 // Otherwise returns false (i.e. if the frame contains a non-savable content).
54 CONTENT_EXPORT bool GetSavableResourceLinksForFrame(
55 blink::WebFrame* frame,
56 SavableResourcesResult* result,
57 const char** savable_schemes);
59 // Returns the value in an elements resource url attribute. For IMG, SCRIPT or
60 // INPUT TYPE=image, returns the value in "src". For LINK TYPE=text/css, returns
61 // the value in "href". For BODY, TABLE, TR, TD, returns the value in
62 // "background". For BLOCKQUOTE, Q, DEL, INS, returns the value in "cite"
63 // attribute. Otherwise returns a null WebString.
64 CONTENT_EXPORT blink::WebString GetSubResourceLinkFromElement(
65 const blink::WebElement& element);
67 } // namespace content
69 #endif // CONTENT_RENDERER_SAVABLE_RESOURCES_H_