blob: bfaa40ad10a0ce9bac29ced7c765e4d408c18be3 [file] [log] [blame]
[email protected]c2d986512012-05-12 00:22:461// Copyright (c) 2012 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
5#ifndef WEBKIT_GLUE_DOM_OPERATIONS_H__
6#define WEBKIT_GLUE_DOM_OPERATIONS_H__
7
8#include <string>
[email protected]7f3281452010-02-24 21:27:029#include <vector>
initial.commitf5b16fe2008-07-27 00:20:5110
initial.commitf5b16fe2008-07-27 00:20:5111#include "googleurl/src/gurl.h"
[email protected]c2d986512012-05-12 00:22:4612#include "third_party/WebKit/Source/Platform/chromium/public/WebReferrerPolicy.h"
[email protected]51678ad2011-12-02 19:07:5013#include "webkit/glue/webkit_glue_export.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 WebDocument;
17class WebElement;
18class 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.
23namespace webkit_glue {
24
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 {
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.
[email protected]c2d986512012-05-12 00:22:4634 std::vector<GURL>* referrer_urls_list;
35 // and the corresponding referrer policies.
36 std::vector<WebKit::WebReferrerPolicy>* referrer_policies_list;
initial.commitf5b16fe2008-07-27 00:20:5137 // vector which contains all savable links of main frame and sub frames.
38 std::vector<GURL>* frames_list;
39
40 // Constructor.
[email protected]c2d986512012-05-12 00:22:4641 SavableResourcesResult(
42 std::vector<GURL>* resources_list,
43 std::vector<GURL>* referrer_urls_list,
44 std::vector<WebKit::WebReferrerPolicy>* referrer_policies_list,
45 std::vector<GURL>* frames_list)
initial.commitf5b16fe2008-07-27 00:20:5146 : resources_list(resources_list),
[email protected]c2d986512012-05-12 00:22:4647 referrer_urls_list(referrer_urls_list),
48 referrer_policies_list(referrer_policies_list),
initial.commitf5b16fe2008-07-27 00:20:5149 frames_list(frames_list) { }
50
51 private:
[email protected]8066b152010-06-05 18:55:5652 DISALLOW_COPY_AND_ASSIGN(SavableResourcesResult);
initial.commitf5b16fe2008-07-27 00:20:5153};
54
55// Get all savable resource links from current webview, include main frame
56// and sub-frame. After collecting all savable resource links, this function
57// will send those links to embedder. Return value indicates whether we get
58// all saved resource links successfully.
[email protected]51678ad2011-12-02 19:07:5059WEBKIT_GLUE_EXPORT bool GetAllSavableResourceLinksForCurrentPage(
60 WebKit::WebView* view,
[email protected]dbeb3952009-10-13 18:01:1861 const GURL& page_url, SavableResourcesResult* savable_resources_result,
62 const char** savable_schemes);
initial.commitf5b16fe2008-07-27 00:20:5163
[email protected]af91a572008-12-22 22:08:4064// Invokes pauseAnimationAtTime on the AnimationController associated with the
65// |view|s main frame.
66// This is used by test shell.
[email protected]50ae00ef2009-10-19 05:11:0367bool PauseAnimationAtTimeOnElementWithId(WebKit::WebView* view,
[email protected]af91a572008-12-22 22:08:4068 const std::string& animation_name,
69 double time,
70 const std::string& element_id);
71
72// Invokes pauseTransitionAtTime on the AnimationController associated with the
73// |view|s main frame.
74// This is used by test shell.
[email protected]50ae00ef2009-10-19 05:11:0375bool PauseTransitionAtTimeOnElementWithId(WebKit::WebView* view,
[email protected]af91a572008-12-22 22:08:4076 const std::string& property_name,
77 double time,
78 const std::string& element_id);
79
[email protected]8cc47ce2009-01-13 01:56:2280// Returns true if the element with |element_id| as its id has autocomplete
81// on.
[email protected]50ae00ef2009-10-19 05:11:0382bool ElementDoesAutoCompleteForElementWithId(WebKit::WebView* view,
[email protected]8cc47ce2009-01-13 01:56:2283 const std::string& element_id);
84
[email protected]376bc0c2009-01-30 18:09:4885// Returns the number of animations currently running.
[email protected]50ae00ef2009-10-19 05:11:0386int NumberOfActiveAnimations(WebKit::WebView* view);
[email protected]8cc47ce2009-01-13 01:56:2287
[email protected]d9ec5c0f2009-12-23 11:55:0788// Returns the value in an elements resource url attribute. For IMG, SCRIPT or
89// INPUT TYPE=image, returns the value in "src". For LINK TYPE=text/css, returns
90// the value in "href". For BODY, TABLE, TR, TD, returns the value in
91// "background". For BLOCKQUOTE, Q, DEL, INS, returns the value in "cite"
92// attribute. Otherwise returns a null WebString.
[email protected]51678ad2011-12-02 19:07:5093WEBKIT_GLUE_EXPORT WebKit::WebString GetSubResourceLinkFromElement(
[email protected]d9ec5c0f2009-12-23 11:55:0794 const WebKit::WebElement& element);
95
[email protected]5ddfd63e2010-09-01 15:48:3796// Puts the meta-elements of |document| that have the attribute |attribute_name|
97// with a value of |attribute_value| in |meta_elements|.
[email protected]51678ad2011-12-02 19:07:5098WEBKIT_GLUE_EXPORT void GetMetaElementsWithAttribute(
[email protected]96626f5f2010-10-13 23:34:2899 WebKit::WebDocument* document,
100 const string16& attribute_name,
101 const string16& atribute_value,
102 std::vector<WebKit::WebElement>* meta_elements);
[email protected]1c57b7b2010-07-12 17:38:10103
initial.commitf5b16fe2008-07-27 00:20:51104} // namespace webkit_glue
105
106#endif // WEBKIT_GLUE_DOM_OPERATIONS_H__