blob: 4741bce329f2ad829b83f6941e31ea6d3c9d55cb [file] [log] [blame]
[email protected]8066b152010-06-05 18:55:561// Copyright (c) 2010 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>
9#include <map>
[email protected]7f3281452010-02-24 21:27:0210#include <vector>
initial.commitf5b16fe2008-07-27 00:20:5111
[email protected]e0fc2f12010-03-14 23:30:5912#include "gfx/size.h"
initial.commitf5b16fe2008-07-27 00:20:5113#include "googleurl/src/gurl.h"
14#include "webkit/glue/password_form_dom_manager.h"
15
[email protected]50ae00ef2009-10-19 05:11:0316namespace WebKit {
17class WebView;
18}
19
initial.commitf5b16fe2008-07-27 00:20:5120// A collection of operations that access the underlying WebKit DOM directly.
21namespace webkit_glue {
22
initial.commitf5b16fe2008-07-27 00:20:5123// Fill matching password forms and trigger autocomplete in the case of multiple
24// matching logins.
[email protected]50ae00ef2009-10-19 05:11:0325void FillPasswordForm(WebKit::WebView* view,
initial.commitf5b16fe2008-07-27 00:20:5126 const PasswordFormDomManager::FillData& data);
27
initial.commitf5b16fe2008-07-27 00:20:5128// 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.
32struct 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]8066b152010-06-05 18:55:5650 DISALLOW_COPY_AND_ASSIGN(SavableResourcesResult);
initial.commitf5b16fe2008-07-27 00:20:5151};
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]50ae00ef2009-10-19 05:11:0357bool GetAllSavableResourceLinksForCurrentPage(WebKit::WebView* view,
[email protected]dbeb3952009-10-13 18:01:1858 const GURL& page_url, SavableResourcesResult* savable_resources_result,
59 const char** savable_schemes);
initial.commitf5b16fe2008-07-27 00:20:5160
61// Structure used when installing a web page as an app. Populated via
62// GetApplicationInfo.
63struct 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]00e3f152009-10-20 19:25:4272 string16 title;
initial.commitf5b16fe2008-07-27 00:20:5173
74 // Description of the application. This is set from the meta tag whose name
75 // is 'description'.
[email protected]00e3f152009-10-20 19:25:4276 string16 description;
initial.commitf5b16fe2008-07-27 00:20:5177
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]00e3f152009-10-20 19:25:4292bool ParseIconSizes(const string16& text,
initial.commitf5b16fe2008-07-27 00:20:5193 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]50ae00ef2009-10-19 05:11:0398void GetApplicationInfo(WebKit::WebView* view, WebApplicationInfo* app_info);
initial.commitf5b16fe2008-07-27 00:20:5199
[email protected]af91a572008-12-22 22:08:40100// Invokes pauseAnimationAtTime on the AnimationController associated with the
101// |view|s main frame.
102// This is used by test shell.
[email protected]50ae00ef2009-10-19 05:11:03103bool PauseAnimationAtTimeOnElementWithId(WebKit::WebView* view,
[email protected]af91a572008-12-22 22:08:40104 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]50ae00ef2009-10-19 05:11:03111bool PauseTransitionAtTimeOnElementWithId(WebKit::WebView* view,
[email protected]af91a572008-12-22 22:08:40112 const std::string& property_name,
113 double time,
114 const std::string& element_id);
115
[email protected]8cc47ce2009-01-13 01:56:22116// Returns true if the element with |element_id| as its id has autocomplete
117// on.
[email protected]50ae00ef2009-10-19 05:11:03118bool ElementDoesAutoCompleteForElementWithId(WebKit::WebView* view,
[email protected]8cc47ce2009-01-13 01:56:22119 const std::string& element_id);
120
[email protected]376bc0c2009-01-30 18:09:48121// Returns the number of animations currently running.
[email protected]50ae00ef2009-10-19 05:11:03122int NumberOfActiveAnimations(WebKit::WebView* view);
[email protected]8cc47ce2009-01-13 01:56:22123
[email protected]d9ec5c0f2009-12-23 11:55:07124// 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.
129WebKit::WebString GetSubResourceLinkFromElement(
130 const WebKit::WebElement& element);
131
initial.commitf5b16fe2008-07-27 00:20:51132} // namespace webkit_glue
133
134#endif // WEBKIT_GLUE_DOM_OPERATIONS_H__