| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef WEBKIT_GLUE_DOM_OPERATIONS_H__ | 5 #ifndef WEBKIT_GLUE_DOM_OPERATIONS_H__ |
| 6 #define WEBKIT_GLUE_DOM_OPERATIONS_H__ | 6 #define WEBKIT_GLUE_DOM_OPERATIONS_H__ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <map> | 9 #include <map> |
| 10 | 10 |
| 11 #include "base/gfx/size.h" | 11 #include "base/gfx/size.h" |
| 12 #include "googleurl/src/gurl.h" | 12 #include "googleurl/src/gurl.h" |
| 13 #include "webkit/glue/password_form_dom_manager.h" | 13 #include "webkit/glue/password_form_dom_manager.h" |
| 14 | 14 |
| 15 namespace WebCore { | 15 namespace WebCore { |
| 16 class Element; | 16 class Element; |
| 17 class HTMLInputElement; | 17 class HTMLInputElement; |
| 18 class Node; | 18 class Node; |
| 19 } | 19 } |
| 20 | 20 |
| 21 namespace WebKit { |
| 22 class WebView; |
| 23 } |
| 24 |
| 21 struct FormData; | 25 struct FormData; |
| 22 class WebFrameImpl; | 26 class WebFrameImpl; |
| 23 class WebView; | |
| 24 | 27 |
| 25 // A collection of operations that access the underlying WebKit DOM directly. | 28 // A collection of operations that access the underlying WebKit DOM directly. |
| 26 namespace webkit_glue { | 29 namespace webkit_glue { |
| 27 | 30 |
| 28 // Automatically fill a form to upload a file. | 31 // Automatically fill a form to upload a file. |
| 29 // | 32 // |
| 30 // Look in all frames for a form with the name or ID |form_name|. If the form is | 33 // Look in all frames for a form with the name or ID |form_name|. If the form is |
| 31 // found, set the input type=file with name or ID equal to |file_name| to | 34 // found, set the input type=file with name or ID equal to |file_name| to |
| 32 // |file_path|. If |form_name| is empty, look for any form containing the | 35 // |file_path|. If |form_name| is empty, look for any form containing the |
| 33 // provided submit button. | 36 // provided submit button. |
| 34 // | 37 // |
| 35 // If |submit_name| is non empty and a submit button with a matching name or ID | 38 // If |submit_name| is non empty and a submit button with a matching name or ID |
| 36 // exists, the form is submitted using that submit button. If any form input | 39 // exists, the form is submitted using that submit button. If any form input |
| 37 // has a name or ID matching an |other_form_values| key, it will be set to the | 40 // has a name or ID matching an |other_form_values| key, it will be set to the |
| 38 // corresponding value. | 41 // corresponding value. |
| 39 // | 42 // |
| 40 // Return true if a form was found and processed. | 43 // Return true if a form was found and processed. |
| 41 typedef std::map<std::wstring, std::wstring> FormValueMap; | 44 typedef std::map<std::wstring, std::wstring> FormValueMap; |
| 42 struct FileUploadData { | 45 struct FileUploadData { |
| 43 std::wstring file_path; | 46 std::wstring file_path; |
| 44 std::wstring form_name; | 47 std::wstring form_name; |
| 45 std::wstring file_name; | 48 std::wstring file_name; |
| 46 std::wstring submit_name; | 49 std::wstring submit_name; |
| 47 FormValueMap other_form_values; | 50 FormValueMap other_form_values; |
| 48 }; | 51 }; |
| 49 | 52 |
| 50 bool FillFormToUploadFile(WebView* view, const FileUploadData& data); | 53 bool FillFormToUploadFile(WebKit::WebView* view, const FileUploadData& data); |
| 51 | 54 |
| 52 // Fill in a form identified by form |data|. | 55 // Fill in a form identified by form |data|. |
| 53 bool FillForm(WebView* view, const FormData& data); | 56 bool FillForm(WebKit::WebView* view, const FormData& data); |
| 54 | 57 |
| 55 // Fill matching password forms and trigger autocomplete in the case of multiple | 58 // Fill matching password forms and trigger autocomplete in the case of multiple |
| 56 // matching logins. | 59 // matching logins. |
| 57 void FillPasswordForm(WebView* view, | 60 void FillPasswordForm(WebKit::WebView* view, |
| 58 const PasswordFormDomManager::FillData& data); | 61 const PasswordFormDomManager::FillData& data); |
| 59 | 62 |
| 60 // Structure for storage the result of getting all savable resource links | 63 // Structure for storage the result of getting all savable resource links |
| 61 // for current page. The consumer of the SavableResourcesResult is responsible | 64 // for current page. The consumer of the SavableResourcesResult is responsible |
| 62 // for keeping these pointers valid for the lifetime of the | 65 // for keeping these pointers valid for the lifetime of the |
| 63 // SavableResourcesResult instance. | 66 // SavableResourcesResult instance. |
| 64 struct SavableResourcesResult { | 67 struct SavableResourcesResult { |
| 65 // vector which contains all savable links of sub resource. | 68 // vector which contains all savable links of sub resource. |
| 66 std::vector<GURL>* resources_list; | 69 std::vector<GURL>* resources_list; |
| 67 // vector which contains corresponding all referral links of sub resource, | 70 // vector which contains corresponding all referral links of sub resource, |
| (...skipping 11 matching lines...) Expand all Loading... |
| 79 frames_list(frames_list) { } | 82 frames_list(frames_list) { } |
| 80 | 83 |
| 81 private: | 84 private: |
| 82 DISALLOW_EVIL_CONSTRUCTORS(SavableResourcesResult); | 85 DISALLOW_EVIL_CONSTRUCTORS(SavableResourcesResult); |
| 83 }; | 86 }; |
| 84 | 87 |
| 85 // Get all savable resource links from current webview, include main frame | 88 // Get all savable resource links from current webview, include main frame |
| 86 // and sub-frame. After collecting all savable resource links, this function | 89 // and sub-frame. After collecting all savable resource links, this function |
| 87 // will send those links to embedder. Return value indicates whether we get | 90 // will send those links to embedder. Return value indicates whether we get |
| 88 // all saved resource links successfully. | 91 // all saved resource links successfully. |
| 89 bool GetAllSavableResourceLinksForCurrentPage(WebView* view, | 92 bool GetAllSavableResourceLinksForCurrentPage(WebKit::WebView* view, |
| 90 const GURL& page_url, SavableResourcesResult* savable_resources_result, | 93 const GURL& page_url, SavableResourcesResult* savable_resources_result, |
| 91 const char** savable_schemes); | 94 const char** savable_schemes); |
| 92 | 95 |
| 93 // Structure used when installing a web page as an app. Populated via | 96 // Structure used when installing a web page as an app. Populated via |
| 94 // GetApplicationInfo. | 97 // GetApplicationInfo. |
| 95 struct WebApplicationInfo { | 98 struct WebApplicationInfo { |
| 96 struct IconInfo { | 99 struct IconInfo { |
| 97 GURL url; | 100 GURL url; |
| 98 int width; | 101 int width; |
| 99 int height; | 102 int height; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 120 // on success, false on errors. On success either all the sizes specified in | 123 // on success, false on errors. On success either all the sizes specified in |
| 121 // the attribute are added to sizes, or is_any is set to true. | 124 // the attribute are added to sizes, or is_any is set to true. |
| 122 // | 125 // |
| 123 // You shouldn't have a need to invoke this directly, it's public for testing. | 126 // You shouldn't have a need to invoke this directly, it's public for testing. |
| 124 bool ParseIconSizes(const std::wstring& text, | 127 bool ParseIconSizes(const std::wstring& text, |
| 125 std::vector<gfx::Size>* sizes, | 128 std::vector<gfx::Size>* sizes, |
| 126 bool* is_any); | 129 bool* is_any); |
| 127 | 130 |
| 128 // Gets the application info for the specified page. See the description of | 131 // Gets the application info for the specified page. See the description of |
| 129 // WebApplicationInfo for details as to where each field comes from. | 132 // WebApplicationInfo for details as to where each field comes from. |
| 130 void GetApplicationInfo(WebView* view, WebApplicationInfo* app_info); | 133 void GetApplicationInfo(WebKit::WebView* view, WebApplicationInfo* app_info); |
| 131 | 134 |
| 132 // Invokes pauseAnimationAtTime on the AnimationController associated with the | 135 // Invokes pauseAnimationAtTime on the AnimationController associated with the |
| 133 // |view|s main frame. | 136 // |view|s main frame. |
| 134 // This is used by test shell. | 137 // This is used by test shell. |
| 135 bool PauseAnimationAtTimeOnElementWithId(WebView* view, | 138 bool PauseAnimationAtTimeOnElementWithId(WebKit::WebView* view, |
| 136 const std::string& animation_name, | 139 const std::string& animation_name, |
| 137 double time, | 140 double time, |
| 138 const std::string& element_id); | 141 const std::string& element_id); |
| 139 | 142 |
| 140 // Invokes pauseTransitionAtTime on the AnimationController associated with the | 143 // Invokes pauseTransitionAtTime on the AnimationController associated with the |
| 141 // |view|s main frame. | 144 // |view|s main frame. |
| 142 // This is used by test shell. | 145 // This is used by test shell. |
| 143 bool PauseTransitionAtTimeOnElementWithId(WebView* view, | 146 bool PauseTransitionAtTimeOnElementWithId(WebKit::WebView* view, |
| 144 const std::string& property_name, | 147 const std::string& property_name, |
| 145 double time, | 148 double time, |
| 146 const std::string& element_id); | 149 const std::string& element_id); |
| 147 | 150 |
| 148 // Returns true if the element with |element_id| as its id has autocomplete | 151 // Returns true if the element with |element_id| as its id has autocomplete |
| 149 // on. | 152 // on. |
| 150 bool ElementDoesAutoCompleteForElementWithId(WebView* view, | 153 bool ElementDoesAutoCompleteForElementWithId(WebKit::WebView* view, |
| 151 const std::string& element_id); | 154 const std::string& element_id); |
| 152 | 155 |
| 153 // Returns the number of animations currently running. | 156 // Returns the number of animations currently running. |
| 154 int NumberOfActiveAnimations(WebView* view); | 157 int NumberOfActiveAnimations(WebKit::WebView* view); |
| 155 | 158 |
| 156 // Returns the passed element/node casted to an HTMLInputElement if it is one, | 159 // Returns the passed element/node casted to an HTMLInputElement if it is one, |
| 157 // NULL if it is not an HTMLInputElement. | 160 // NULL if it is not an HTMLInputElement. |
| 158 WebCore::HTMLInputElement* ElementToHTMLInputElement(WebCore::Element* element); | 161 WebCore::HTMLInputElement* ElementToHTMLInputElement(WebCore::Element* element); |
| 159 WebCore::HTMLInputElement* NodeToHTMLInputElement(WebCore::Node* node); | 162 WebCore::HTMLInputElement* NodeToHTMLInputElement(WebCore::Node* node); |
| 160 | 163 |
| 161 } // namespace webkit_glue | 164 } // namespace webkit_glue |
| 162 | 165 |
| 163 #endif // WEBKIT_GLUE_DOM_OPERATIONS_H__ | 166 #endif // WEBKIT_GLUE_DOM_OPERATIONS_H__ |
| OLD | NEW |