• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2006, 2007 Apple 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
6  * are met:
7  * 1. Redistributions of source code must retain the above copyright
8  *    notice, this list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright
10  *    notice, this list of conditions and the following disclaimer in the
11  *    documentation and/or other materials provided with the distribution.
12  *
13  * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
14  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
17  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24  */
25 
26 #ifndef WebView_H
27 #define WebView_H
28 
29 #include "COMPtr.h"
30 #include "WebKit.h"
31 #include "WebFrame.h"
32 #include "WebPreferences.h"
33 
34 #include <WebCore/IntRect.h>
35 #include <WebCore/Timer.h>
36 #include <WebCore/WindowMessageListener.h>
37 #include <wtf/HashSet.h>
38 #include <wtf/OwnPtr.h>
39 
40 class WebFrame;
41 class WebBackForwardList;
42 class WebInspector;
43 class WebInspectorClient;
44 
45 WebView* kit(WebCore::Page*);
46 WebCore::Page* core(IWebView*);
47 
48 interface IDropTargetHelper;
49 
50 class WebView
51     : public IWebView
52     , public IWebViewPrivate
53     , public IWebIBActions
54     , public IWebViewCSS
55     , public IWebViewEditing
56     , public IWebViewUndoableEditing
57     , public IWebViewEditingActions
58     , public IWebNotificationObserver
59     , public IDropTarget
60     , WebCore::WindowMessageListener
61 {
62 public:
63     static WebView* createInstance();
64 protected:
65     WebView();
66     ~WebView();
67 
68 public:
69     // IUnknown
70     virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
71     virtual ULONG STDMETHODCALLTYPE AddRef(void);
72     virtual ULONG STDMETHODCALLTYPE Release(void);
73 
74     // IWebView
75 
76     virtual HRESULT STDMETHODCALLTYPE canShowMIMEType(
77         /* [in] */ BSTR mimeType,
78         /* [retval][out] */ BOOL *canShow);
79 
80     virtual HRESULT STDMETHODCALLTYPE canShowMIMETypeAsHTML(
81         /* [in] */ BSTR mimeType,
82         /* [retval][out] */ BOOL *canShow);
83 
84     virtual HRESULT STDMETHODCALLTYPE MIMETypesShownAsHTML(
85         /* [retval][out] */ IEnumVARIANT **enumVariant);
86 
87     virtual HRESULT STDMETHODCALLTYPE setMIMETypesShownAsHTML(
88         /* [size_is][in] */ BSTR *mimeTypes,
89         /* [in] */ int cMimeTypes);
90 
91     virtual HRESULT STDMETHODCALLTYPE URLFromPasteboard(
92         /* [in] */ IDataObject *pasteboard,
93         /* [retval][out] */ BSTR *url);
94 
95     virtual HRESULT STDMETHODCALLTYPE URLTitleFromPasteboard(
96         /* [in] */ IDataObject *pasteboard,
97         /* [retval][out] */ BSTR *urlTitle);
98 
99     virtual HRESULT STDMETHODCALLTYPE initWithFrame(
100         /* [in] */ RECT frame,
101         /* [in] */ BSTR frameName,
102         /* [in] */ BSTR groupName);
103 
104     virtual HRESULT STDMETHODCALLTYPE setUIDelegate(
105         /* [in] */ IWebUIDelegate *d);
106 
107     virtual HRESULT STDMETHODCALLTYPE uiDelegate(
108         /* [out][retval] */ IWebUIDelegate **d);
109 
110     virtual HRESULT STDMETHODCALLTYPE setResourceLoadDelegate(
111         /* [in] */ IWebResourceLoadDelegate *d);
112 
113     virtual HRESULT STDMETHODCALLTYPE resourceLoadDelegate(
114         /* [out][retval] */ IWebResourceLoadDelegate **d);
115 
116     virtual HRESULT STDMETHODCALLTYPE setDownloadDelegate(
117         /* [in] */ IWebDownloadDelegate *d);
118 
119     virtual HRESULT STDMETHODCALLTYPE downloadDelegate(
120         /* [out][retval] */ IWebDownloadDelegate **d);
121 
122     virtual HRESULT STDMETHODCALLTYPE setFrameLoadDelegate(
123         /* [in] */ IWebFrameLoadDelegate *d);
124 
125     virtual HRESULT STDMETHODCALLTYPE frameLoadDelegate(
126         /* [out][retval] */ IWebFrameLoadDelegate **d);
127 
128     virtual HRESULT STDMETHODCALLTYPE setPolicyDelegate(
129         /* [in] */ IWebPolicyDelegate *d);
130 
131     virtual HRESULT STDMETHODCALLTYPE policyDelegate(
132         /* [out][retval] */ IWebPolicyDelegate **d);
133 
134     virtual HRESULT STDMETHODCALLTYPE mainFrame(
135         /* [out][retval] */ IWebFrame **frame);
136 
137     virtual HRESULT STDMETHODCALLTYPE focusedFrame(
138         /* [out][retval] */ IWebFrame **frame);
139 
140     virtual HRESULT STDMETHODCALLTYPE backForwardList(
141         /* [out][retval] */ IWebBackForwardList **list);
142 
143     virtual HRESULT STDMETHODCALLTYPE setMaintainsBackForwardList(
144         /* [in] */ BOOL flag);
145 
146     virtual HRESULT STDMETHODCALLTYPE goBack(
147         /* [retval][out] */ BOOL *succeeded);
148 
149     virtual HRESULT STDMETHODCALLTYPE goForward(
150         /* [retval][out] */ BOOL *succeeded);
151 
152     virtual HRESULT STDMETHODCALLTYPE goToBackForwardItem(
153         /* [in] */ IWebHistoryItem *item,
154         /* [retval][out] */ BOOL *succeeded);
155 
156     virtual HRESULT STDMETHODCALLTYPE setTextSizeMultiplier(
157         /* [in] */ float multiplier);
158 
159     virtual HRESULT STDMETHODCALLTYPE textSizeMultiplier(
160         /* [retval][out] */ float *multiplier);
161 
162     virtual HRESULT STDMETHODCALLTYPE setApplicationNameForUserAgent(
163         /* [in] */ BSTR applicationName);
164 
165     virtual HRESULT STDMETHODCALLTYPE applicationNameForUserAgent(
166         /* [retval][out] */ BSTR *applicationName);
167 
168     virtual HRESULT STDMETHODCALLTYPE setCustomUserAgent(
169         /* [in] */ BSTR userAgentString);
170 
171     virtual HRESULT STDMETHODCALLTYPE customUserAgent(
172         /* [retval][out] */ BSTR *userAgentString);
173 
174     virtual HRESULT STDMETHODCALLTYPE userAgentForURL(
175         /* [in] */ BSTR url,
176         /* [retval][out] */ BSTR *userAgent);
177 
178     virtual HRESULT STDMETHODCALLTYPE supportsTextEncoding(
179         /* [retval][out] */ BOOL *supports);
180 
181     virtual HRESULT STDMETHODCALLTYPE setCustomTextEncodingName(
182         /* [in] */ BSTR encodingName);
183 
184     virtual HRESULT STDMETHODCALLTYPE customTextEncodingName(
185         /* [retval][out] */ BSTR *encodingName);
186 
187     virtual HRESULT STDMETHODCALLTYPE setMediaStyle(
188         /* [in] */ BSTR media);
189 
190     virtual HRESULT STDMETHODCALLTYPE mediaStyle(
191         /* [retval][out] */ BSTR *media);
192 
193     virtual HRESULT STDMETHODCALLTYPE stringByEvaluatingJavaScriptFromString(
194         /* [in] */ BSTR script,
195         /* [retval][out] */ BSTR *result);
196 
197     virtual HRESULT STDMETHODCALLTYPE windowScriptObject(
198         /* [retval][out] */ IWebScriptObject **webScriptObject);
199 
200     virtual HRESULT STDMETHODCALLTYPE setPreferences(
201         /* [in] */ IWebPreferences *prefs);
202 
203     virtual HRESULT STDMETHODCALLTYPE preferences(
204         /* [retval][out] */ IWebPreferences **prefs);
205 
206     virtual HRESULT STDMETHODCALLTYPE setPreferencesIdentifier(
207         /* [in] */ BSTR anIdentifier);
208 
209     virtual HRESULT STDMETHODCALLTYPE preferencesIdentifier(
210         /* [retval][out] */ BSTR *anIdentifier);
211 
212     virtual HRESULT STDMETHODCALLTYPE setHostWindow(
213         /* [in] */ OLE_HANDLE window);
214 
215     virtual HRESULT STDMETHODCALLTYPE hostWindow(
216         /* [retval][out] */ OLE_HANDLE *window);
217 
218     virtual HRESULT STDMETHODCALLTYPE searchFor(
219         /* [in] */ BSTR str,
220         /* [in] */ BOOL forward,
221         /* [in] */ BOOL caseFlag,
222         /* [in] */ BOOL wrapFlag,
223         /* [retval][out] */ BOOL *found);
224 
225     virtual HRESULT STDMETHODCALLTYPE registerViewClass(
226         /* [in] */ IWebDocumentView *view,
227         /* [in] */ IWebDocumentRepresentation *representation,
228         /* [in] */ BSTR forMIMEType);
229 
230     virtual HRESULT STDMETHODCALLTYPE setGroupName(
231         /* [in] */ BSTR groupName);
232 
233     virtual HRESULT STDMETHODCALLTYPE groupName(
234         /* [retval][out] */ BSTR *groupName);
235 
236     virtual HRESULT STDMETHODCALLTYPE estimatedProgress(
237         /* [retval][out] */ double *estimatedProgress);
238 
239     virtual HRESULT STDMETHODCALLTYPE isLoading(
240         /* [retval][out] */ BOOL *isLoading);
241 
242     virtual HRESULT STDMETHODCALLTYPE elementAtPoint(
243         /* [in] */ LPPOINT point,
244         /* [retval][out] */ IPropertyBag **elementDictionary);
245 
246     virtual HRESULT STDMETHODCALLTYPE pasteboardTypesForSelection(
247         /* [retval][out] */ IEnumVARIANT **enumVariant);
248 
249     virtual HRESULT STDMETHODCALLTYPE writeSelectionWithPasteboardTypes(
250         /* [size_is][in] */ BSTR *types,
251         /* [in] */ int cTypes,
252         /* [in] */ IDataObject *pasteboard);
253 
254     virtual HRESULT STDMETHODCALLTYPE pasteboardTypesForElement(
255         /* [in] */ IPropertyBag *elementDictionary,
256         /* [retval][out] */ IEnumVARIANT **enumVariant);
257 
258     virtual HRESULT STDMETHODCALLTYPE writeElement(
259         /* [in] */ IPropertyBag *elementDictionary,
260         /* [size_is][in] */ BSTR *withPasteboardTypes,
261         /* [in] */ int cWithPasteboardTypes,
262         /* [in] */ IDataObject *pasteboard);
263 
264     virtual HRESULT STDMETHODCALLTYPE selectedText(
265         /* [out, retval] */ BSTR* str);
266 
267     virtual HRESULT STDMETHODCALLTYPE centerSelectionInVisibleArea(
268         /* [in] */ IUnknown* sender);
269 
270     virtual HRESULT STDMETHODCALLTYPE moveDragCaretToPoint(
271         /* [in] */ LPPOINT point);
272 
273     virtual HRESULT STDMETHODCALLTYPE removeDragCaret( void);
274 
275     virtual HRESULT STDMETHODCALLTYPE setDrawsBackground(
276         /* [in] */ BOOL drawsBackground);
277 
278     virtual HRESULT STDMETHODCALLTYPE drawsBackground(
279         /* [retval][out] */ BOOL *drawsBackground);
280 
281     virtual HRESULT STDMETHODCALLTYPE setMainFrameURL(
282         /* [in] */ BSTR urlString);
283 
284     virtual HRESULT STDMETHODCALLTYPE mainFrameURL(
285         /* [retval][out] */ BSTR *urlString);
286 
287     virtual HRESULT STDMETHODCALLTYPE mainFrameDocument(
288         /* [retval][out] */ IDOMDocument **document);
289 
290     virtual HRESULT STDMETHODCALLTYPE mainFrameTitle(
291         /* [retval][out] */ BSTR *title);
292 
293     virtual HRESULT STDMETHODCALLTYPE mainFrameIcon(
294         /* [retval][out] */ OLE_HANDLE *hBitmap);
295 
296     virtual HRESULT STDMETHODCALLTYPE registerURLSchemeAsLocal(
297         /* [in] */ BSTR scheme);
298 
299     virtual HRESULT STDMETHODCALLTYPE close();
300 
301     // IWebIBActions
302 
303     virtual HRESULT STDMETHODCALLTYPE takeStringURLFrom(
304         /* [in] */ IUnknown *sender);
305 
306     virtual HRESULT STDMETHODCALLTYPE stopLoading(
307         /* [in] */ IUnknown *sender);
308 
309     virtual HRESULT STDMETHODCALLTYPE reload(
310         /* [in] */ IUnknown *sender);
311 
312     virtual HRESULT STDMETHODCALLTYPE canGoBack(
313         /* [in] */ IUnknown *sender,
314         /* [retval][out] */ BOOL *result);
315 
316     virtual HRESULT STDMETHODCALLTYPE goBack(
317         /* [in] */ IUnknown *sender);
318 
319     virtual HRESULT STDMETHODCALLTYPE canGoForward(
320         /* [in] */ IUnknown *sender,
321         /* [retval][out] */ BOOL *result);
322 
323     virtual HRESULT STDMETHODCALLTYPE goForward(
324         /* [in] */ IUnknown *sender);
325 
326     virtual HRESULT STDMETHODCALLTYPE canMakeTextLarger(
327         /* [in] */ IUnknown *sender,
328         /* [retval][out] */ BOOL *result);
329 
330     virtual HRESULT STDMETHODCALLTYPE makeTextLarger(
331         /* [in] */ IUnknown *sender);
332 
333     virtual HRESULT STDMETHODCALLTYPE canMakeTextSmaller(
334         /* [in] */ IUnknown *sender,
335         /* [retval][out] */ BOOL *result);
336 
337     virtual HRESULT STDMETHODCALLTYPE makeTextSmaller(
338         /* [in] */ IUnknown *sender);
339 
340     virtual HRESULT STDMETHODCALLTYPE canMakeTextStandardSize(
341         /* [in] */ IUnknown *sender,
342         /* [retval][out] */ BOOL *result);
343 
344     virtual HRESULT STDMETHODCALLTYPE makeTextStandardSize(
345         /* [in] */ IUnknown *sender);
346 
347     virtual HRESULT STDMETHODCALLTYPE toggleContinuousSpellChecking(
348         /* [in] */ IUnknown *sender);
349 
350     virtual HRESULT STDMETHODCALLTYPE toggleSmartInsertDelete(
351         /* [in] */ IUnknown *sender);
352 
353     virtual HRESULT STDMETHODCALLTYPE toggleGrammarChecking(
354         /* [in] */ IUnknown *sender);
355 
356     // IWebViewCSS
357 
358     virtual HRESULT STDMETHODCALLTYPE computedStyleForElement(
359         /* [in] */ IDOMElement *element,
360         /* [in] */ BSTR pseudoElement,
361         /* [retval][out] */ IDOMCSSStyleDeclaration **style);
362 
363     // IWebViewEditing
364 
365     virtual HRESULT STDMETHODCALLTYPE editableDOMRangeForPoint(
366         /* [in] */ LPPOINT point,
367         /* [retval][out] */ IDOMRange **range);
368 
369     virtual HRESULT STDMETHODCALLTYPE setSelectedDOMRange(
370         /* [in] */ IDOMRange *range,
371         /* [in] */ WebSelectionAffinity affinity);
372 
373     virtual HRESULT STDMETHODCALLTYPE selectedDOMRange(
374         /* [retval][out] */ IDOMRange **range);
375 
376     virtual HRESULT STDMETHODCALLTYPE selectionAffinity(
377         /* [retval][out][retval][out] */ WebSelectionAffinity *affinity);
378 
379     virtual HRESULT STDMETHODCALLTYPE setEditable(
380         /* [in] */ BOOL flag);
381 
382     virtual HRESULT STDMETHODCALLTYPE isEditable(
383         /* [retval][out] */ BOOL *isEditable);
384 
385     virtual HRESULT STDMETHODCALLTYPE setTypingStyle(
386         /* [in] */ IDOMCSSStyleDeclaration *style);
387 
388     virtual HRESULT STDMETHODCALLTYPE typingStyle(
389         /* [retval][out] */ IDOMCSSStyleDeclaration **style);
390 
391     virtual HRESULT STDMETHODCALLTYPE setSmartInsertDeleteEnabled(
392         /* [in] */ BOOL flag);
393 
394     virtual HRESULT STDMETHODCALLTYPE smartInsertDeleteEnabled(
395         /* [in] */ BOOL *enabled);
396 
397     virtual HRESULT STDMETHODCALLTYPE setSelectTrailingWhitespaceEnabled(
398         /* [in] */ BOOL flag);
399 
400     virtual HRESULT STDMETHODCALLTYPE isSelectTrailingWhitespaceEnabled(
401         /* [in] */ BOOL *enabled);
402 
403     virtual HRESULT STDMETHODCALLTYPE setContinuousSpellCheckingEnabled(
404         /* [in] */ BOOL flag);
405 
406     virtual HRESULT STDMETHODCALLTYPE isContinuousSpellCheckingEnabled(
407         /* [retval][out] */ BOOL *enabled);
408 
409     virtual HRESULT STDMETHODCALLTYPE spellCheckerDocumentTag(
410         /* [retval][out] */ int *tag);
411 
412     virtual HRESULT STDMETHODCALLTYPE undoManager(
413         /* [retval][out] */ IWebUndoManager **manager);
414 
415     virtual HRESULT STDMETHODCALLTYPE setEditingDelegate(
416         /* [in] */ IWebEditingDelegate *d);
417 
418     virtual HRESULT STDMETHODCALLTYPE editingDelegate(
419         /* [retval][out] */ IWebEditingDelegate **d);
420 
421     virtual HRESULT STDMETHODCALLTYPE styleDeclarationWithText(
422         /* [in] */ BSTR text,
423         /* [retval][out] */ IDOMCSSStyleDeclaration **style);
424 
425     virtual HRESULT STDMETHODCALLTYPE hasSelectedRange(
426         /* [retval][out] */ BOOL *hasSelectedRange);
427 
428     virtual HRESULT STDMETHODCALLTYPE cutEnabled(
429         /* [retval][out] */ BOOL *enabled);
430 
431     virtual HRESULT STDMETHODCALLTYPE copyEnabled(
432         /* [retval][out] */ BOOL *enabled);
433 
434     virtual HRESULT STDMETHODCALLTYPE pasteEnabled(
435         /* [retval][out] */ BOOL *enabled);
436 
437     virtual HRESULT STDMETHODCALLTYPE deleteEnabled(
438         /* [retval][out] */ BOOL *enabled);
439 
440     virtual HRESULT STDMETHODCALLTYPE editingEnabled(
441         /* [retval][out] */ BOOL *enabled);
442 
443     virtual HRESULT STDMETHODCALLTYPE isGrammarCheckingEnabled(
444         /* [retval][out] */ BOOL *enabled);
445 
446     virtual HRESULT STDMETHODCALLTYPE setGrammarCheckingEnabled(
447         BOOL enabled);
448 
449     virtual HRESULT STDMETHODCALLTYPE setPageSizeMultiplier(
450         /* [in] */ float multiplier);
451 
452     virtual HRESULT STDMETHODCALLTYPE pageSizeMultiplier(
453         /* [retval][out] */ float *multiplier);
454 
455     virtual HRESULT STDMETHODCALLTYPE canZoomPageIn(
456         /* [in] */ IUnknown *sender,
457         /* [retval][out] */ BOOL *result);
458 
459     virtual HRESULT STDMETHODCALLTYPE zoomPageIn(
460         /* [in] */ IUnknown *sender);
461 
462     virtual HRESULT STDMETHODCALLTYPE canZoomPageOut(
463         /* [in] */ IUnknown *sender,
464         /* [retval][out] */ BOOL *result);
465 
466     virtual HRESULT STDMETHODCALLTYPE zoomPageOut(
467         /* [in] */ IUnknown *sender);
468 
469     virtual HRESULT STDMETHODCALLTYPE canResetPageZoom(
470         /* [in] */ IUnknown *sender,
471         /* [retval][out] */ BOOL *result);
472 
473     virtual HRESULT STDMETHODCALLTYPE resetPageZoom(
474         /* [in] */ IUnknown *sender);
475 
476     // IWebViewUndoableEditing
477 
478     virtual HRESULT STDMETHODCALLTYPE replaceSelectionWithNode(
479         /* [in] */ IDOMNode *node);
480 
481     virtual HRESULT STDMETHODCALLTYPE replaceSelectionWithText(
482         /* [in] */ BSTR text);
483 
484     virtual HRESULT STDMETHODCALLTYPE replaceSelectionWithMarkupString(
485         /* [in] */ BSTR markupString);
486 
487     virtual HRESULT STDMETHODCALLTYPE replaceSelectionWithArchive(
488         /* [in] */ IWebArchive *archive);
489 
490     virtual HRESULT STDMETHODCALLTYPE deleteSelection( void);
491 
492     virtual HRESULT STDMETHODCALLTYPE clearSelection(void);
493 
494     virtual HRESULT STDMETHODCALLTYPE applyStyle(
495         /* [in] */ IDOMCSSStyleDeclaration *style);
496 
497     // IWebViewEditingActions
498 
499     virtual HRESULT STDMETHODCALLTYPE copy(
500         /* [in] */ IUnknown *sender);
501 
502     virtual HRESULT STDMETHODCALLTYPE cut(
503         /* [in] */ IUnknown *sender);
504 
505     virtual HRESULT STDMETHODCALLTYPE paste(
506         /* [in] */ IUnknown *sender);
507 
508     virtual HRESULT STDMETHODCALLTYPE copyURL(
509         /* [in] */ BSTR url);
510 
511     virtual HRESULT STDMETHODCALLTYPE copyFont(
512         /* [in] */ IUnknown *sender);
513 
514     virtual HRESULT STDMETHODCALLTYPE pasteFont(
515         /* [in] */ IUnknown *sender);
516 
517     virtual HRESULT STDMETHODCALLTYPE delete_(
518         /* [in] */ IUnknown *sender);
519 
520     virtual HRESULT STDMETHODCALLTYPE pasteAsPlainText(
521         /* [in] */ IUnknown *sender);
522 
523     virtual HRESULT STDMETHODCALLTYPE pasteAsRichText(
524         /* [in] */ IUnknown *sender);
525 
526     virtual HRESULT STDMETHODCALLTYPE changeFont(
527         /* [in] */ IUnknown *sender);
528 
529     virtual HRESULT STDMETHODCALLTYPE changeAttributes(
530         /* [in] */ IUnknown *sender);
531 
532     virtual HRESULT STDMETHODCALLTYPE changeDocumentBackgroundColor(
533         /* [in] */ IUnknown *sender);
534 
535     virtual HRESULT STDMETHODCALLTYPE changeColor(
536         /* [in] */ IUnknown *sender);
537 
538     virtual HRESULT STDMETHODCALLTYPE alignCenter(
539         /* [in] */ IUnknown *sender);
540 
541     virtual HRESULT STDMETHODCALLTYPE alignJustified(
542         /* [in] */ IUnknown *sender);
543 
544     virtual HRESULT STDMETHODCALLTYPE alignLeft(
545         /* [in] */ IUnknown *sender);
546 
547     virtual HRESULT STDMETHODCALLTYPE alignRight(
548         /* [in] */ IUnknown *sender);
549 
550     virtual HRESULT STDMETHODCALLTYPE checkSpelling(
551         /* [in] */ IUnknown *sender);
552 
553     virtual HRESULT STDMETHODCALLTYPE showGuessPanel(
554         /* [in] */ IUnknown *sender);
555 
556     virtual HRESULT STDMETHODCALLTYPE performFindPanelAction(
557         /* [in] */ IUnknown *sender);
558 
559     virtual HRESULT STDMETHODCALLTYPE startSpeaking(
560         /* [in] */ IUnknown *sender);
561 
562     virtual HRESULT STDMETHODCALLTYPE stopSpeaking(
563         /* [in] */ IUnknown *sender);
564 
565     // IWebNotificationObserver
566 
567     virtual HRESULT STDMETHODCALLTYPE onNotify(
568         /* [in] */ IWebNotification *notification);
569 
570     // IWebViewPrivate
571     virtual HRESULT STDMETHODCALLTYPE setCustomDropTarget(
572         /* [in] */ IDropTarget* dt);
573 
574     virtual HRESULT STDMETHODCALLTYPE removeCustomDropTarget();
575 
576     virtual HRESULT STDMETHODCALLTYPE setInViewSourceMode(
577         /* [in] */ BOOL flag);
578 
579     virtual HRESULT STDMETHODCALLTYPE inViewSourceMode(
580         /* [retval][out] */ BOOL* flag);
581 
582     virtual HRESULT STDMETHODCALLTYPE viewWindow(
583         /* [retval][out] */ OLE_HANDLE *window);
584 
585     virtual HRESULT STDMETHODCALLTYPE setFormDelegate(
586         /* [in] */ IWebFormDelegate *formDelegate);
587 
588     virtual HRESULT STDMETHODCALLTYPE formDelegate(
589         /* [retval][out] */ IWebFormDelegate **formDelegate);
590 
591     virtual HRESULT STDMETHODCALLTYPE setFrameLoadDelegatePrivate(
592         /* [in] */ IWebFrameLoadDelegatePrivate *frameLoadDelegatePrivate);
593 
594     virtual HRESULT STDMETHODCALLTYPE frameLoadDelegatePrivate(
595         /* [retval][out] */ IWebFrameLoadDelegatePrivate **frameLoadDelegatePrivate);
596 
597     virtual HRESULT STDMETHODCALLTYPE scrollOffset(
598         /* [retval][out] */ LPPOINT offset);
599 
600     virtual HRESULT STDMETHODCALLTYPE scrollBy(
601         /* [in] */ LPPOINT offset);
602 
603     virtual HRESULT STDMETHODCALLTYPE visibleContentRect(
604         /* [retval][out] */ LPRECT rect);
605 
606     virtual HRESULT STDMETHODCALLTYPE updateFocusedAndActiveState();
607 
608     virtual HRESULT STDMETHODCALLTYPE executeCoreCommandByName(BSTR name, BSTR value);
609 
610     virtual HRESULT STDMETHODCALLTYPE clearMainFrameName();
611 
612     virtual HRESULT STDMETHODCALLTYPE markAllMatchesForText(
613         BSTR search, BOOL caseSensitive, BOOL highlight, UINT limit, UINT* matches);
614 
615     virtual HRESULT STDMETHODCALLTYPE unmarkAllTextMatches();
616 
617     virtual HRESULT STDMETHODCALLTYPE rectsForTextMatches(
618         IEnumTextMatches** pmatches);
619 
620     virtual HRESULT STDMETHODCALLTYPE generateSelectionImage(
621         BOOL forceWhiteText, OLE_HANDLE* hBitmap);
622 
623     virtual HRESULT STDMETHODCALLTYPE selectionRect(
624         RECT* rc);
625 
626     virtual HRESULT STDMETHODCALLTYPE DragEnter(
627         IDataObject* pDataObject, DWORD grfKeyState, POINTL pt, DWORD* pdwEffect);
628 
629     virtual HRESULT STDMETHODCALLTYPE DragOver(
630         DWORD grfKeyState, POINTL pt, DWORD* pdwEffect);
631 
632     virtual HRESULT STDMETHODCALLTYPE DragLeave();
633 
634     virtual HRESULT STDMETHODCALLTYPE Drop(
635         IDataObject* pDataObject, DWORD grfKeyState, POINTL pt, DWORD* pdwEffect);
636 
637     virtual HRESULT STDMETHODCALLTYPE canHandleRequest(
638         IWebURLRequest *request,
639         BOOL *result);
640 
641     virtual HRESULT STDMETHODCALLTYPE standardUserAgentWithApplicationName(
642         /* [in] */ BSTR applicationName,
643         /* [retval][out] */ BSTR *groupName);
644 
645     virtual HRESULT STDMETHODCALLTYPE clearFocusNode();
646 
647     virtual HRESULT STDMETHODCALLTYPE setInitialFocus(
648         /* [in] */ BOOL forward);
649 
650     virtual HRESULT STDMETHODCALLTYPE setTabKeyCyclesThroughElements(
651         /* [in] */ BOOL cycles);
652 
653     virtual HRESULT STDMETHODCALLTYPE tabKeyCyclesThroughElements(
654         /* [retval][out] */ BOOL *result);
655 
656     virtual HRESULT STDMETHODCALLTYPE setAllowSiteSpecificHacks(
657         /* [in] */ BOOL allows);
658 
659     virtual HRESULT STDMETHODCALLTYPE addAdditionalPluginDirectory(
660         /* [in] */ BSTR directory);
661 
662     virtual HRESULT STDMETHODCALLTYPE loadBackForwardListFromOtherView(
663         /* [in] */ IWebView *otherView);
664 
665     virtual HRESULT STDMETHODCALLTYPE inspector(
666         /* [retval][out] */ IWebInspector**);
667 
668     virtual HRESULT STDMETHODCALLTYPE clearUndoRedoOperations( void);
669     virtual HRESULT STDMETHODCALLTYPE shouldClose(
670         /* [retval][out] */ BOOL* result);
671 
672     virtual HRESULT STDMETHODCALLTYPE setProhibitsMainFrameScrolling(BOOL);
673     virtual HRESULT STDMETHODCALLTYPE setShouldApplyMacFontAscentHack(BOOL);
674 
675     virtual HRESULT STDMETHODCALLTYPE windowAncestryDidChange();
676 
677     virtual HRESULT STDMETHODCALLTYPE paintDocumentRectToContext(
678         /* [in] */ RECT rect,
679         /* [in] */ OLE_HANDLE dc);
680 
681     virtual HRESULT STDMETHODCALLTYPE setCustomHTMLTokenizerTimeDelay(
682         /* [in] */ double timeDelay);
683 
684     virtual HRESULT STDMETHODCALLTYPE setCustomHTMLTokenizerChunkSize(
685         /* [in] */ int chunkSize);
686 
687     virtual HRESULT STDMETHODCALLTYPE backingStore(
688         /* [out, retval] */ OLE_HANDLE* hBitmap);
689 
690     virtual HRESULT STDMETHODCALLTYPE setTransparent(
691         /* [in] */ BOOL transparent);
692 
693     virtual HRESULT STDMETHODCALLTYPE transparent(
694         /* [out, retval] */ BOOL* transparent);
695 
696     virtual HRESULT STDMETHODCALLTYPE setDefersCallbacks(
697         /* [in] */ BOOL defersCallbacks);
698 
699     virtual HRESULT STDMETHODCALLTYPE defersCallbacks(
700         /* [out, retval] */ BOOL* defersCallbacks);
701 
702     virtual HRESULT STDMETHODCALLTYPE globalHistoryItem(
703         /* [out, retval] */ IWebHistoryItem** item);
704 
705     virtual HRESULT STDMETHODCALLTYPE setAlwaysUsesComplexTextCodePath(
706         /* [in] */ BOOL complex);
707 
708     virtual HRESULT STDMETHODCALLTYPE alwaysUsesComplexTextCodePath(
709         /* [out, retval] */ BOOL* complex);
710 
711     virtual HRESULT STDMETHODCALLTYPE setCookieEnabled(
712         /* [in] */ BOOL enable);
713 
714     virtual HRESULT STDMETHODCALLTYPE cookieEnabled(
715         /* [out, retval] */ BOOL* enabled);
716 
717     virtual HRESULT STDMETHODCALLTYPE setMediaVolume(
718         /* [in] */ float volume);
719 
720     virtual HRESULT STDMETHODCALLTYPE mediaVolume(
721         /* [out, retval] */ float* volume);
722 
723     virtual HRESULT STDMETHODCALLTYPE registerEmbeddedViewMIMEType(
724         /* [in] */ BSTR mimeType);
725 
726     virtual HRESULT STDMETHODCALLTYPE setMemoryCacheDelegateCallsEnabled(
727         /* [in] */ BOOL enabled);
728 
729     virtual HRESULT STDMETHODCALLTYPE setJavaScriptURLsAreAllowed(
730         /* [in] */ BOOL areAllowed);
731 
732     virtual HRESULT STDMETHODCALLTYPE setCanStartPlugins(
733         /* [in] */ BOOL canStartPlugins);
734 
735     // WebView
736     bool shouldUseEmbeddedView(const WebCore::String& mimeType) const;
737 
738     WebCore::Page* page();
739     bool handleMouseEvent(UINT, WPARAM, LPARAM);
setMouseActivated(bool flag)740     void setMouseActivated(bool flag) { m_mouseActivated = flag; }
741     bool handleContextMenuEvent(WPARAM, LPARAM);
742     bool onMeasureItem(WPARAM, LPARAM);
743     bool onDrawItem(WPARAM, LPARAM);
744     bool onInitMenuPopup(WPARAM, LPARAM);
745     bool onUninitMenuPopup(WPARAM, LPARAM);
746     void performContextMenuAction(WPARAM, LPARAM, bool byPosition);
747     bool mouseWheel(WPARAM, LPARAM, bool isMouseHWheel);
748     bool gesture(WPARAM, LPARAM);
749     bool gestureNotify(WPARAM, LPARAM);
750     bool execCommand(WPARAM wParam, LPARAM lParam);
751     bool keyDown(WPARAM, LPARAM, bool systemKeyDown = false);
752     bool keyUp(WPARAM, LPARAM, bool systemKeyDown = false);
753     bool keyPress(WPARAM, LPARAM, bool systemKeyDown = false);
754     bool inResizer(LPARAM lParam);
755     void paint(HDC, LPARAM);
756     void paintIntoWindow(HDC bitmapDC, HDC windowDC, const WebCore::IntRect& dirtyRect);
757     bool ensureBackingStore();
758     void addToDirtyRegion(const WebCore::IntRect&);
759     void addToDirtyRegion(HRGN);
760     void scrollBackingStore(WebCore::FrameView*, int dx, int dy, const WebCore::IntRect& scrollViewRect, const WebCore::IntRect& clipRect);
761     void deleteBackingStore();
762     void repaint(const WebCore::IntRect&, bool contentChanged, bool immediate = false, bool repaintContentOnly = false);
763     void frameRect(RECT* rect);
764     void closeWindow();
765     void closeWindowSoon();
didClose()766     bool didClose() const { return m_didClose; }
767 
transparent()768     bool transparent() const { return m_transparent; }
769 
770     bool onIMEStartComposition();
771     bool onIMEComposition(LPARAM);
772     bool onIMEEndComposition();
773     bool onIMEChar(WPARAM, LPARAM);
774     bool onIMENotify(WPARAM, LPARAM, LRESULT*);
775     bool onIMERequest(WPARAM, LPARAM, LRESULT*);
776     bool onIMESelect(WPARAM, LPARAM);
777     bool onIMESetContext(WPARAM, LPARAM);
778     void selectionChanged();
779     void resetIME(WebCore::Frame*);
780     void setInputMethodState(bool);
781 
782     HRESULT registerDragDrop();
783     HRESULT revokeDragDrop();
784 
785     // Convenient to be able to violate the rules of COM here for easy movement to the frame.
topLevelFrame()786     WebFrame* topLevelFrame() const { return m_mainFrame; }
787     const WebCore::String& userAgentForKURL(const WebCore::KURL& url);
788 
789     static bool canHandleRequest(const WebCore::ResourceRequest&);
790 
791     static WebCore::String standardUserAgentWithApplicationName(const WebCore::String&);
792 
setIsBeingDestroyed()793     void setIsBeingDestroyed() { m_isBeingDestroyed = true; }
isBeingDestroyed()794     bool isBeingDestroyed() const { return m_isBeingDestroyed; }
795 
796     const char* interpretKeyEvent(const WebCore::KeyboardEvent*);
797     bool handleEditingKeyboardEvent(WebCore::KeyboardEvent*);
798 
isPainting()799     bool isPainting() const { return m_paintCount > 0; }
800 
801     void setToolTip(const WebCore::String&);
802 
803     void registerForIconNotification(bool listen);
804     void dispatchDidReceiveIconFromWebFrame(WebFrame*);
805 
806     HRESULT notifyDidAddIcon(IWebNotification*);
807     HRESULT notifyPreferencesChanged(IWebNotification*);
808 
809     static void setCacheModel(WebCacheModel);
810     static WebCacheModel cacheModel();
811     static bool didSetCacheModel();
812     static WebCacheModel maxCacheModelInAnyInstance();
813 
814     void updateActiveStateSoon() const;
815     void deleteBackingStoreSoon();
816     void cancelDeleteBackingStoreSoon();
817 
topLevelParent()818     HWND topLevelParent() const { return m_topLevelParent; }
819 
820     void updateActiveState();
821 
822     bool onGetObject(WPARAM, LPARAM, LRESULT&) const;
823     static STDMETHODIMP AccessibleObjectFromWindow(HWND, DWORD objectID, REFIID, void** ppObject);
824 
825     void downloadURL(const WebCore::KURL&);
826 
827 private:
828     void setZoomMultiplier(float multiplier, bool isTextOnly);
829     float zoomMultiplier(bool isTextOnly);
830     bool canZoomIn(bool isTextOnly);
831     HRESULT zoomIn(bool isTextOnly);
832     bool canZoomOut(bool isTextOnly);
833     HRESULT zoomOut(bool isTextOnly);
834     bool canResetZoom(bool isTextOnly);
835     HRESULT resetZoom(bool isTextOnly);
836     bool active();
837 
838     enum WindowsToPaint { PaintWebViewOnly, PaintWebViewAndChildren };
839     void paintIntoBackingStore(WebCore::FrameView*, HDC bitmapDC, const WebCore::IntRect& dirtyRect, WindowsToPaint);
840     void updateBackingStore(WebCore::FrameView*, HDC = 0, bool backingStoreCompletelyDirty = false, WindowsToPaint = PaintWebViewOnly);
841 
842 protected:
843     HIMC getIMMContext();
844     void releaseIMMContext(HIMC);
allowSiteSpecificHacks()845     static bool allowSiteSpecificHacks() { return s_allowSiteSpecificHacks; }
846     void preflightSpellChecker();
847     bool continuousCheckingAllowed();
848     void initializeToolTipWindow();
849     void closeWindowTimerFired(WebCore::Timer<WebView>*);
850     void prepareCandidateWindow(WebCore::Frame*, HIMC);
851     void updateSelectionForIME();
852     bool onIMERequestCharPosition(WebCore::Frame*, IMECHARPOSITION*, LRESULT*);
853     bool onIMERequestReconvertString(WebCore::Frame*, RECONVERTSTRING*, LRESULT*);
854     bool developerExtrasEnabled() const;
855 
856     // AllWebViewSet functions
857     void addToAllWebViewsSet();
858     void removeFromAllWebViewsSet();
859 
860     virtual void windowReceivedMessage(HWND, UINT message, WPARAM, LPARAM);
861 
862     ULONG m_refCount;
863     HWND m_hostWindow;
864     HWND m_viewWindow;
865     WebFrame* m_mainFrame;
866     WebCore::Page* m_page;
867 
868     OwnPtr<HBITMAP> m_backingStoreBitmap;
869     SIZE m_backingStoreSize;
870     OwnPtr<HRGN> m_backingStoreDirtyRegion;
871 
872     COMPtr<IWebEditingDelegate> m_editingDelegate;
873     COMPtr<IWebFrameLoadDelegate> m_frameLoadDelegate;
874     COMPtr<IWebFrameLoadDelegatePrivate> m_frameLoadDelegatePrivate;
875     COMPtr<IWebUIDelegate> m_uiDelegate;
876     COMPtr<IWebUIDelegatePrivate> m_uiDelegatePrivate;
877     COMPtr<IWebFormDelegate> m_formDelegate;
878     COMPtr<IWebPolicyDelegate> m_policyDelegate;
879     COMPtr<IWebResourceLoadDelegate> m_resourceLoadDelegate;
880     COMPtr<IWebDownloadDelegate> m_downloadDelegate;
881     COMPtr<WebPreferences> m_preferences;
882     COMPtr<WebInspector> m_webInspector;
883 
884     bool m_userAgentOverridden;
885     bool m_useBackForwardList;
886     WebCore::String m_userAgentCustom;
887     WebCore::String m_userAgentStandard;
888     float m_zoomMultiplier;
889     WebCore::String m_overrideEncoding;
890     WebCore::String m_applicationName;
891     bool m_mouseActivated;
892     // WebCore dragging logic needs to be able to inspect the drag data
893     // this is updated in DragEnter/Leave/Drop
894     COMPtr<IDataObject> m_dragData;
895     COMPtr<IDropTargetHelper> m_dropTargetHelper;
896     UChar m_currentCharacterCode;
897     bool m_isBeingDestroyed;
898     unsigned m_paintCount;
899     bool m_hasSpellCheckerDocumentTag;
900     bool m_smartInsertDeleteEnabled;
901     bool m_selectTrailingWhitespaceEnabled;
902     bool m_didClose;
903     bool m_hasCustomDropTarget;
904     unsigned m_inIMEComposition;
905     HWND m_toolTipHwnd;
906     WebCore::String m_toolTip;
907     bool m_deleteBackingStoreTimerActive;
908 
909     bool m_transparent;
910 
911     static bool s_allowSiteSpecificHacks;
912 
913     WebCore::Timer<WebView> m_closeWindowTimer;
914     OwnPtr<TRACKMOUSEEVENT> m_mouseOutTracker;
915 
916     HWND m_topLevelParent;
917 
918     OwnPtr<HashSet<WebCore::String> > m_embeddedViewMIMETypes;
919 
920     //Variables needed to store gesture information
921     long m_lastPanX;
922     long m_lastPanY;
923     long m_xOverpan;
924     long m_yOverpan;
925 };
926 
927 #endif
928