1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
// Copyright (c) 2006-2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// WebCore provides hooks for several kinds of functionality, allowing separate
// classes termed "delegates" to receive notifications (in the form of direct
// function calls) when certain events are about to occur or have just occurred.
// In some cases, the delegate implements the needed functionality; in others,
// the delegate has some control over the behavior but doesn't actually
// implement it. For example, the UI delegate is responsible for showing a
// dialog box or otherwise handling a JavaScript window.alert() call, via the
// RunJavaScriptAlert() method. On the other hand, the editor delegate doesn't
// actually handle editing functionality, although it could (for example)
// override whether a content-editable node accepts editing focus by returning
// false from ShouldBeginEditing(). (It would also possible for a more
// special-purpose editing delegate to act on the edited node in some way, e.g.
// to highlight modified text in the DidChangeContents() method.)
// WebKit divides the delegated tasks into several different classes, but we
// combine them into a single WebViewDelegate. This single delegate encompasses
// the needed functionality of the WebKit UIDelegate, ContextMenuDelegate,
// PolicyDelegate, FrameLoadDelegate, and EditorDelegate; additional portions
// of ChromeClient and FrameLoaderClient not delegated in the WebKit
// implementation; and some WebView additions.
#ifndef WEBKIT_GLUE_WEBVIEW_DELEGATE_H_
#define WEBKIT_GLUE_WEBVIEW_DELEGATE_H_
#include <vector>
#include "webkit/api/public/WebDragOperation.h"
#include "webkit/api/public/WebFrame.h"
#include "webkit/api/public/WebTextDirection.h"
#include "webkit/api/public/WebViewClient.h"
#include "webkit/glue/context_menu.h"
namespace WebCore {
class AccessibilityObject;
}
namespace WebKit {
class WebDragData;
class WebNotificationPresenter;
class WebWidget;
struct WebPopupMenuInfo;
struct WebPoint;
struct WebRect;
}
class FilePath;
class SkBitmap;
class WebDevToolsAgentDelegate;
class WebView;
// TODO(darin): Eliminate WebViewDelegate in favor of WebViewClient.
class WebViewDelegate : public WebKit::WebViewClient {
public:
// WebView additions -------------------------------------------------------
// Returns whether this WebView was opened by a user gesture.
virtual bool WasOpenedByUserGesture() const {
return true;
}
// Called by ChromeClientImpl::focus() if accessibility on the renderer side
// is enabled, and a focus change has occurred. Will retrieve the id of the
// input AccessibilityObject and send it through IPC for handling on the
// browser side.
virtual void FocusAccessibilityObject(WebCore::AccessibilityObject* acc_obj) {
}
// ChromeClient ------------------------------------------------------------
// Queries the browser for suggestions to be shown for the form text field
// named |field_name|. |text| is the text entered by the user so far and
// |node_id| is the id of the node of the input field.
virtual void QueryFormFieldAutofill(const std::wstring& field_name,
const std::wstring& text,
int64 node_id) {
}
// Instructs the browser to remove the autofill entry specified from it DB.
virtual void RemoveStoredAutofillEntry(const std::wstring& name,
const std::wstring& value) {
}
// DevTools ----------------------------------------------------------------
virtual WebDevToolsAgentDelegate* GetWebDevToolsAgentDelegate() {
return NULL;
}
protected:
~WebViewDelegate() { }
};
#endif // WEBKIT_GLUE_WEBVIEW_DELEGATE_H_
|