[email protected] | 8066b15 | 2010-06-05 18:55:56 | [diff] [blame^] | 1 | // Copyright (c) 2010 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> |
| 9 | #include <map> |
[email protected] | 7f328145 | 2010-02-24 21:27:02 | [diff] [blame] | 10 | #include <vector> |
initial.commit | f5b16fe | 2008-07-27 00:20:51 | [diff] [blame] | 11 | |
[email protected] | e0fc2f1 | 2010-03-14 23:30:59 | [diff] [blame] | 12 | #include "gfx/size.h" |
initial.commit | f5b16fe | 2008-07-27 00:20:51 | [diff] [blame] | 13 | #include "googleurl/src/gurl.h" |
| 14 | #include "webkit/glue/password_form_dom_manager.h" |
| 15 | |
[email protected] | 50ae00ef | 2009-10-19 05:11:03 | [diff] [blame] | 16 | namespace WebKit { |
| 17 | class WebView; |
| 18 | } |
| 19 | |
initial.commit | f5b16fe | 2008-07-27 00:20:51 | [diff] [blame] | 20 | // A collection of operations that access the underlying WebKit DOM directly. |
| 21 | namespace webkit_glue { |
| 22 | |
initial.commit | f5b16fe | 2008-07-27 00:20:51 | [diff] [blame] | 23 | // Fill matching password forms and trigger autocomplete in the case of multiple |
| 24 | // matching logins. |
[email protected] | 50ae00ef | 2009-10-19 05:11:03 | [diff] [blame] | 25 | void FillPasswordForm(WebKit::WebView* view, |
initial.commit | f5b16fe | 2008-07-27 00:20:51 | [diff] [blame] | 26 | const PasswordFormDomManager::FillData& data); |
| 27 | |
initial.commit | f5b16fe | 2008-07-27 00:20:51 | [diff] [blame] | 28 | // Structure for storage the result of getting all savable resource links |
| 29 | // for current page. The consumer of the SavableResourcesResult is responsible |
| 30 | // for keeping these pointers valid for the lifetime of the |
| 31 | // SavableResourcesResult instance. |
| 32 | struct SavableResourcesResult { |
| 33 | // vector which contains all savable links of sub resource. |
| 34 | std::vector<GURL>* resources_list; |
| 35 | // vector which contains corresponding all referral links of sub resource, |
| 36 | // it matched with links one by one. |
| 37 | std::vector<GURL>* referrers_list; |
| 38 | // vector which contains all savable links of main frame and sub frames. |
| 39 | std::vector<GURL>* frames_list; |
| 40 | |
| 41 | // Constructor. |
| 42 | SavableResourcesResult(std::vector<GURL>* resources_list, |
| 43 | std::vector<GURL>* referrers_list, |
| 44 | std::vector<GURL>* frames_list) |
| 45 | : resources_list(resources_list), |
| 46 | referrers_list(referrers_list), |
| 47 | frames_list(frames_list) { } |
| 48 | |
| 49 | private: |
[email protected] | 8066b15 | 2010-06-05 18:55:56 | [diff] [blame^] | 50 | DISALLOW_COPY_AND_ASSIGN(SavableResourcesResult); |
initial.commit | f5b16fe | 2008-07-27 00:20:51 | [diff] [blame] | 51 | }; |
| 52 | |
| 53 | // Get all savable resource links from current webview, include main frame |
| 54 | // and sub-frame. After collecting all savable resource links, this function |
| 55 | // will send those links to embedder. Return value indicates whether we get |
| 56 | // all saved resource links successfully. |
[email protected] | 50ae00ef | 2009-10-19 05:11:03 | [diff] [blame] | 57 | bool GetAllSavableResourceLinksForCurrentPage(WebKit::WebView* view, |
[email protected] | dbeb395 | 2009-10-13 18:01:18 | [diff] [blame] | 58 | const GURL& page_url, SavableResourcesResult* savable_resources_result, |
| 59 | const char** savable_schemes); |
initial.commit | f5b16fe | 2008-07-27 00:20:51 | [diff] [blame] | 60 | |
| 61 | // Structure used when installing a web page as an app. Populated via |
| 62 | // GetApplicationInfo. |
| 63 | struct WebApplicationInfo { |
| 64 | struct IconInfo { |
| 65 | GURL url; |
| 66 | int width; |
| 67 | int height; |
| 68 | }; |
| 69 | |
| 70 | // Title of the application. This is set from the meta tag whose name is |
| 71 | // 'application-name'. |
[email protected] | 00e3f15 | 2009-10-20 19:25:42 | [diff] [blame] | 72 | string16 title; |
initial.commit | f5b16fe | 2008-07-27 00:20:51 | [diff] [blame] | 73 | |
| 74 | // Description of the application. This is set from the meta tag whose name |
| 75 | // is 'description'. |
[email protected] | 00e3f15 | 2009-10-20 19:25:42 | [diff] [blame] | 76 | string16 description; |
initial.commit | f5b16fe | 2008-07-27 00:20:51 | [diff] [blame] | 77 | |
| 78 | // URL for the app. This is set from the meta tag whose name is |
| 79 | // 'application-url'. |
| 80 | GURL app_url; |
| 81 | |
| 82 | // Set of available icons. This is set for all link tags whose rel=icon. Only |
| 83 | // icons that have a non-zero (width and/or height) are added. |
| 84 | std::vector<IconInfo> icons; |
| 85 | }; |
| 86 | |
| 87 | // Parses the icon's size attribute as defined in the HTML 5 spec. Returns true |
| 88 | // on success, false on errors. On success either all the sizes specified in |
| 89 | // the attribute are added to sizes, or is_any is set to true. |
| 90 | // |
| 91 | // You shouldn't have a need to invoke this directly, it's public for testing. |
[email protected] | 00e3f15 | 2009-10-20 19:25:42 | [diff] [blame] | 92 | bool ParseIconSizes(const string16& text, |
initial.commit | f5b16fe | 2008-07-27 00:20:51 | [diff] [blame] | 93 | std::vector<gfx::Size>* sizes, |
| 94 | bool* is_any); |
| 95 | |
| 96 | // Gets the application info for the specified page. See the description of |
| 97 | // WebApplicationInfo for details as to where each field comes from. |
[email protected] | 50ae00ef | 2009-10-19 05:11:03 | [diff] [blame] | 98 | void GetApplicationInfo(WebKit::WebView* view, WebApplicationInfo* app_info); |
initial.commit | f5b16fe | 2008-07-27 00:20:51 | [diff] [blame] | 99 | |
[email protected] | af91a57 | 2008-12-22 22:08:40 | [diff] [blame] | 100 | // Invokes pauseAnimationAtTime on the AnimationController associated with the |
| 101 | // |view|s main frame. |
| 102 | // This is used by test shell. |
[email protected] | 50ae00ef | 2009-10-19 05:11:03 | [diff] [blame] | 103 | bool PauseAnimationAtTimeOnElementWithId(WebKit::WebView* view, |
[email protected] | af91a57 | 2008-12-22 22:08:40 | [diff] [blame] | 104 | const std::string& animation_name, |
| 105 | double time, |
| 106 | const std::string& element_id); |
| 107 | |
| 108 | // Invokes pauseTransitionAtTime on the AnimationController associated with the |
| 109 | // |view|s main frame. |
| 110 | // This is used by test shell. |
[email protected] | 50ae00ef | 2009-10-19 05:11:03 | [diff] [blame] | 111 | bool PauseTransitionAtTimeOnElementWithId(WebKit::WebView* view, |
[email protected] | af91a57 | 2008-12-22 22:08:40 | [diff] [blame] | 112 | const std::string& property_name, |
| 113 | double time, |
| 114 | const std::string& element_id); |
| 115 | |
[email protected] | 8cc47ce | 2009-01-13 01:56:22 | [diff] [blame] | 116 | // Returns true if the element with |element_id| as its id has autocomplete |
| 117 | // on. |
[email protected] | 50ae00ef | 2009-10-19 05:11:03 | [diff] [blame] | 118 | bool ElementDoesAutoCompleteForElementWithId(WebKit::WebView* view, |
[email protected] | 8cc47ce | 2009-01-13 01:56:22 | [diff] [blame] | 119 | const std::string& element_id); |
| 120 | |
[email protected] | 376bc0c | 2009-01-30 18:09:48 | [diff] [blame] | 121 | // Returns the number of animations currently running. |
[email protected] | 50ae00ef | 2009-10-19 05:11:03 | [diff] [blame] | 122 | int NumberOfActiveAnimations(WebKit::WebView* view); |
[email protected] | 8cc47ce | 2009-01-13 01:56:22 | [diff] [blame] | 123 | |
[email protected] | d9ec5c0f | 2009-12-23 11:55:07 | [diff] [blame] | 124 | // Returns the value in an elements resource url attribute. For IMG, SCRIPT or |
| 125 | // INPUT TYPE=image, returns the value in "src". For LINK TYPE=text/css, returns |
| 126 | // the value in "href". For BODY, TABLE, TR, TD, returns the value in |
| 127 | // "background". For BLOCKQUOTE, Q, DEL, INS, returns the value in "cite" |
| 128 | // attribute. Otherwise returns a null WebString. |
| 129 | WebKit::WebString GetSubResourceLinkFromElement( |
| 130 | const WebKit::WebElement& element); |
| 131 | |
initial.commit | f5b16fe | 2008-07-27 00:20:51 | [diff] [blame] | 132 | } // namespace webkit_glue |
| 133 | |
| 134 | #endif // WEBKIT_GLUE_DOM_OPERATIONS_H__ |