OLD | NEW |
| (Empty) |
1 /* | |
2 * Copyright (C) 2009, 2010, 2011, 2012 Google Inc. All rights reserved. | |
3 * | |
4 * Redistribution and use in source and binary forms, with or without | |
5 * modification, are permitted provided that the following conditions are | |
6 * met: | |
7 * | |
8 * * Redistributions of source code must retain the above copyright | |
9 * notice, this list of conditions and the following disclaimer. | |
10 * * Redistributions in binary form must reproduce the above | |
11 * copyright notice, this list of conditions and the following disclaimer | |
12 * in the documentation and/or other materials provided with the | |
13 * distribution. | |
14 * * Neither the name of Google Inc. nor the names of its | |
15 * contributors may be used to endorse or promote products derived from | |
16 * this software without specific prior written permission. | |
17 * | |
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
29 */ | |
30 | |
31 #ifndef SKY_ENGINE_PUBLIC_WEB_WEBVIEW_H_ | |
32 #define SKY_ENGINE_PUBLIC_WEB_WEBVIEW_H_ | |
33 | |
34 #include "../platform/WebColor.h" | |
35 #include "../platform/WebString.h" | |
36 #include "../platform/WebVector.h" | |
37 #include "sky/engine/public/web/WebPageVisibilityState.h" | |
38 #include "sky/engine/public/web/WebWidget.h" | |
39 | |
40 class GURL; | |
41 | |
42 namespace blink { | |
43 | |
44 class WebFrame; | |
45 class WebFrameClient; | |
46 class WebSettings; | |
47 class WebSpellCheckClient; | |
48 class WebViewClient; | |
49 struct WebPoint; | |
50 | |
51 class WebView : public WebWidget { | |
52 public: | |
53 // Initialization ------------------------------------------------------ | |
54 | |
55 // Creates a WebView that is NOT yet initialized. You will need to | |
56 // call setMainFrame to finish the initialization. It is valid | |
57 // to pass a null client pointer. | |
58 BLINK_EXPORT static WebView* create(WebViewClient*); | |
59 | |
60 // After creating a WebView, you should immediately call this method. | |
61 // You can optionally modify the settings before calling this method. | |
62 // This WebFrame will receive events for the main frame and must not | |
63 // be null. | |
64 virtual void setMainFrame(WebFrame*) = 0; | |
65 | |
66 // Initializes the various client interfaces. | |
67 virtual void setSpellCheckClient(WebSpellCheckClient*) = 0; | |
68 | |
69 // Options ------------------------------------------------------------- | |
70 | |
71 // The returned pointer is valid for the lifetime of the WebView. | |
72 virtual WebSettings* settings() = 0; | |
73 | |
74 // Makes the WebView transparent. This is useful if you want to have | |
75 // some custom background rendered behind it. | |
76 virtual bool isTransparent() const = 0; | |
77 virtual void setIsTransparent(bool) = 0; | |
78 | |
79 // Sets the base color used for this WebView's background. This is in effect | |
80 // the default background color used for pages with no background-color | |
81 // style in effect, or used as the alpha-blended basis for any pages with | |
82 // translucent background-color style. (For pages with opaque | |
83 // background-color style, this property is effectively ignored). | |
84 // Setting this takes effect for the currently loaded page, if any, and | |
85 // persists across subsequent navigations. Defaults to white prior to the | |
86 // first call to this method. | |
87 virtual void setBaseBackgroundColor(WebColor) = 0; | |
88 | |
89 // Controls the WebView's active state, which may affect the rendering | |
90 // of elements on the page (i.e., tinting of input elements). | |
91 virtual bool isActive() const = 0; | |
92 virtual void setIsActive(bool) = 0; | |
93 | |
94 // Frames -------------------------------------------------------------- | |
95 | |
96 virtual WebFrame* mainFrame() = 0; | |
97 | |
98 virtual void injectModule(const WebString& path) = 0; | |
99 | |
100 // Focus --------------------------------------------------------------- | |
101 | |
102 virtual WebFrame* focusedFrame() = 0; | |
103 virtual void setFocusedFrame(WebFrame*) = 0; | |
104 | |
105 // Focus the first (last if reverse is true) focusable node. | |
106 virtual void setInitialFocus(bool reverse) = 0; | |
107 | |
108 // Clears the focused element (and selection if a text field is focused) | |
109 // to ensure that a text field on the page is not eating keystrokes we | |
110 // send it. | |
111 virtual void clearFocusedElement() = 0; | |
112 | |
113 // Advance the focus of the WebView forward to the next element or to the | |
114 // previous element in the tab sequence (if reverse is true). | |
115 virtual void advanceFocus(bool reverse) { } | |
116 | |
117 | |
118 // Zoom ---------------------------------------------------------------- | |
119 | |
120 // The ratio of the current device's screen DPI to the target device's scree
n DPI. | |
121 virtual float deviceScaleFactor() const = 0; | |
122 | |
123 // Sets the ratio as computed by computePageScaleConstraints. | |
124 virtual void setDeviceScaleFactor(float) = 0; | |
125 | |
126 | |
127 // Data exchange ------------------------------------------------------- | |
128 | |
129 // Retrieves a list of spelling markers. | |
130 virtual void spellingMarkers(WebVector<uint32_t>* markers) = 0; | |
131 virtual void removeSpellingMarkersUnderWords(const WebVector<WebString>& wor
ds) = 0; | |
132 | |
133 | |
134 // Developer tools ----------------------------------------------------- | |
135 | |
136 virtual void setShowPaintRects(bool) = 0; | |
137 | |
138 // Visibility ----------------------------------------------------------- | |
139 | |
140 // Sets the visibility of the WebView. | |
141 virtual void setVisibilityState(WebPageVisibilityState visibilityState, | |
142 bool isInitialState) { } | |
143 | |
144 // i18n ----------------------------------------------------------------- | |
145 | |
146 // Inform the WebView that the accept languages have changed. | |
147 // If the WebView wants to get the accept languages value, it will have | |
148 // to call the WebViewClient::acceptLanguages(). | |
149 virtual void acceptLanguagesChanged() = 0; | |
150 | |
151 // Testing functionality for TestRunner --------------------------------- | |
152 | |
153 protected: | |
154 ~WebView() {} | |
155 }; | |
156 | |
157 } // namespace blink | |
158 | |
159 #endif // SKY_ENGINE_PUBLIC_WEB_WEBVIEW_H_ | |
OLD | NEW |