[email protected] | c2d98651 | 2012-05-12 00:22:46 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
license.bot | bf09a50 | 2008-08-24 00:55:55 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
initial.commit | f5b16fe | 2008-07-27 00:20:51 | [diff] [blame] | 4 | |
| 5 | #ifndef WEBKIT_GLUE_DOM_OPERATIONS_H__ |
| 6 | #define WEBKIT_GLUE_DOM_OPERATIONS_H__ |
| 7 | |
| 8 | #include <string> |
[email protected] | 7f328145 | 2010-02-24 21:27:02 | [diff] [blame] | 9 | #include <vector> |
initial.commit | f5b16fe | 2008-07-27 00:20:51 | [diff] [blame] | 10 | |
initial.commit | f5b16fe | 2008-07-27 00:20:51 | [diff] [blame] | 11 | #include "googleurl/src/gurl.h" |
[email protected] | c2d98651 | 2012-05-12 00:22:46 | [diff] [blame] | 12 | #include "third_party/WebKit/Source/Platform/chromium/public/WebReferrerPolicy.h" |
[email protected] | 51678ad | 2011-12-02 19:07:50 | [diff] [blame] | 13 | #include "webkit/glue/webkit_glue_export.h" |
initial.commit | f5b16fe | 2008-07-27 00:20:51 | [diff] [blame] | 14 | |
[email protected] | 50ae00ef | 2009-10-19 05:11:03 | [diff] [blame] | 15 | namespace WebKit { |
[email protected] | e768baf | 2010-07-16 19:36:16 | [diff] [blame] | 16 | class WebDocument; |
| 17 | class WebElement; |
| 18 | class WebString; |
[email protected] | 50ae00ef | 2009-10-19 05:11:03 | [diff] [blame] | 19 | class WebView; |
| 20 | } |
| 21 | |
initial.commit | f5b16fe | 2008-07-27 00:20:51 | [diff] [blame] | 22 | // A collection of operations that access the underlying WebKit DOM directly. |
| 23 | namespace webkit_glue { |
| 24 | |
initial.commit | f5b16fe | 2008-07-27 00:20:51 | [diff] [blame] | 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. |
[email protected] | c2d98651 | 2012-05-12 00:22:46 | [diff] [blame] | 34 | std::vector<GURL>* referrer_urls_list; |
| 35 | // and the corresponding referrer policies. |
| 36 | std::vector<WebKit::WebReferrerPolicy>* referrer_policies_list; |
initial.commit | f5b16fe | 2008-07-27 00:20:51 | [diff] [blame] | 37 | // vector which contains all savable links of main frame and sub frames. |
| 38 | std::vector<GURL>* frames_list; |
| 39 | |
| 40 | // Constructor. |
[email protected] | c2d98651 | 2012-05-12 00:22:46 | [diff] [blame] | 41 | 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.commit | f5b16fe | 2008-07-27 00:20:51 | [diff] [blame] | 46 | : resources_list(resources_list), |
[email protected] | c2d98651 | 2012-05-12 00:22:46 | [diff] [blame] | 47 | referrer_urls_list(referrer_urls_list), |
| 48 | referrer_policies_list(referrer_policies_list), |
initial.commit | f5b16fe | 2008-07-27 00:20:51 | [diff] [blame] | 49 | frames_list(frames_list) { } |
| 50 | |
| 51 | private: |
[email protected] | 8066b15 | 2010-06-05 18:55:56 | [diff] [blame] | 52 | DISALLOW_COPY_AND_ASSIGN(SavableResourcesResult); |
initial.commit | f5b16fe | 2008-07-27 00:20:51 | [diff] [blame] | 53 | }; |
| 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] | 51678ad | 2011-12-02 19:07:50 | [diff] [blame] | 59 | WEBKIT_GLUE_EXPORT bool GetAllSavableResourceLinksForCurrentPage( |
| 60 | WebKit::WebView* view, |
[email protected] | dbeb395 | 2009-10-13 18:01:18 | [diff] [blame] | 61 | const GURL& page_url, SavableResourcesResult* savable_resources_result, |
| 62 | const char** savable_schemes); |
initial.commit | f5b16fe | 2008-07-27 00:20:51 | [diff] [blame] | 63 | |
[email protected] | af91a57 | 2008-12-22 22:08:40 | [diff] [blame] | 64 | // Invokes pauseAnimationAtTime on the AnimationController associated with the |
| 65 | // |view|s main frame. |
| 66 | // This is used by test shell. |
[email protected] | 50ae00ef | 2009-10-19 05:11:03 | [diff] [blame] | 67 | bool PauseAnimationAtTimeOnElementWithId(WebKit::WebView* view, |
[email protected] | af91a57 | 2008-12-22 22:08:40 | [diff] [blame] | 68 | 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] | 50ae00ef | 2009-10-19 05:11:03 | [diff] [blame] | 75 | bool PauseTransitionAtTimeOnElementWithId(WebKit::WebView* view, |
[email protected] | af91a57 | 2008-12-22 22:08:40 | [diff] [blame] | 76 | const std::string& property_name, |
| 77 | double time, |
| 78 | const std::string& element_id); |
| 79 | |
[email protected] | 8cc47ce | 2009-01-13 01:56:22 | [diff] [blame] | 80 | // Returns true if the element with |element_id| as its id has autocomplete |
| 81 | // on. |
[email protected] | 50ae00ef | 2009-10-19 05:11:03 | [diff] [blame] | 82 | bool ElementDoesAutoCompleteForElementWithId(WebKit::WebView* view, |
[email protected] | 8cc47ce | 2009-01-13 01:56:22 | [diff] [blame] | 83 | const std::string& element_id); |
| 84 | |
[email protected] | 376bc0c | 2009-01-30 18:09:48 | [diff] [blame] | 85 | // Returns the number of animations currently running. |
[email protected] | 50ae00ef | 2009-10-19 05:11:03 | [diff] [blame] | 86 | int NumberOfActiveAnimations(WebKit::WebView* view); |
[email protected] | 8cc47ce | 2009-01-13 01:56:22 | [diff] [blame] | 87 | |
[email protected] | d9ec5c0f | 2009-12-23 11:55:07 | [diff] [blame] | 88 | // 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] | 51678ad | 2011-12-02 19:07:50 | [diff] [blame] | 93 | WEBKIT_GLUE_EXPORT WebKit::WebString GetSubResourceLinkFromElement( |
[email protected] | d9ec5c0f | 2009-12-23 11:55:07 | [diff] [blame] | 94 | const WebKit::WebElement& element); |
| 95 | |
[email protected] | 5ddfd63e | 2010-09-01 15:48:37 | [diff] [blame] | 96 | // Puts the meta-elements of |document| that have the attribute |attribute_name| |
| 97 | // with a value of |attribute_value| in |meta_elements|. |
[email protected] | 51678ad | 2011-12-02 19:07:50 | [diff] [blame] | 98 | WEBKIT_GLUE_EXPORT void GetMetaElementsWithAttribute( |
[email protected] | 96626f5f | 2010-10-13 23:34:28 | [diff] [blame] | 99 | WebKit::WebDocument* document, |
| 100 | const string16& attribute_name, |
| 101 | const string16& atribute_value, |
| 102 | std::vector<WebKit::WebElement>* meta_elements); |
[email protected] | 1c57b7b | 2010-07-12 17:38:10 | [diff] [blame] | 103 | |
initial.commit | f5b16fe | 2008-07-27 00:20:51 | [diff] [blame] | 104 | } // namespace webkit_glue |
| 105 | |
| 106 | #endif // WEBKIT_GLUE_DOM_OPERATIONS_H__ |