blob: e60e7d59d28488e9b86ec39770e1af790600c2d7 (
plain)
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
|
// Copyright (c) 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.
#ifndef WEBKIT_GLUE_WEBDEVTOOLSFRONTEND_IMPL_H_
#define WEBKIT_GLUE_WEBDEVTOOLSFRONTEND_IMPL_H_
#include <string>
#include "ContextMenuSelectionHandler.h"
#include <wtf/HashMap.h>
#include <wtf/Noncopyable.h>
#include <wtf/OwnPtr.h>
#include <wtf/RefPtr.h>
#include "v8.h"
#include "third_party/WebKit/WebKit/chromium/public/WebDevToolsFrontend.h"
#include "webkit/glue/devtools/devtools_rpc.h"
namespace WebCore {
class ContextMenuItem;
class Node;
class Page;
class String;
}
namespace WebKit {
class WebViewImpl;
struct WebDevToolsMessageData;
}
class JsDebuggerAgentBoundObj;
class JsNetAgentBoundObj;
class JsProfilerAgentBoundObj;
class JsToolsAgentBoundObj;
class ToolsAgentNativeDelegateImpl;
class WebDevToolsClientDelegate;
class WebDevToolsFrontendImpl : public WebKit::WebDevToolsFrontend,
public DevToolsRpc::Delegate,
public Noncopyable {
public:
WebDevToolsFrontendImpl(
WebKit::WebViewImpl* web_view_impl,
WebKit::WebDevToolsFrontendClient* client,
const String& application_locale);
virtual ~WebDevToolsFrontendImpl();
// DevToolsRpc::Delegate implementation.
virtual void SendRpcMessage(const WebKit::WebDevToolsMessageData& data);
// WebDevToolsFrontend implementation.
virtual void dispatchMessageFromAgent(const WebKit::WebString& class_name,
const WebKit::WebString& method_name,
const WebKit::WebString& param1,
const WebKit::WebString& param2,
const WebKit::WebString& param3);
virtual void dispatchMessageFromAgent(
const WebKit::WebDevToolsMessageData& data);
private:
class MenuSelectionHandler : public WebCore::ContextMenuSelectionHandler {
public:
static PassRefPtr<MenuSelectionHandler> create(
WebDevToolsFrontendImpl* frontend_host) {
return adoptRef(new MenuSelectionHandler(frontend_host));
}
virtual ~MenuSelectionHandler() {}
void disconnect() { frontend_host_ = 0; }
virtual void contextMenuItemSelected(WebCore::ContextMenuItem* item) {
if (frontend_host_)
frontend_host_->ContextMenuItemSelected(item);
}
virtual void contextMenuCleared() {
if (frontend_host_)
frontend_host_->ContextMenuCleared();
}
private:
MenuSelectionHandler(WebDevToolsFrontendImpl* frontend_host)
: frontend_host_(frontend_host) {}
WebDevToolsFrontendImpl* frontend_host_;
};
void AddResourceSourceToFrame(int resource_id,
String mime_type,
WebCore::Node* frame);
void ExecuteScript(const Vector<String>& v);
void DispatchOnWebInspector(const String& method, const String& param);
friend class MenuSelectionHandler;
void ContextMenuItemSelected(WebCore::ContextMenuItem* menu_item);
void ContextMenuCleared();
static v8::Handle<v8::Value> JsReset(const v8::Arguments& args);
static v8::Handle<v8::Value> JsAddSourceToFrame(const v8::Arguments& args);
static v8::Handle<v8::Value> JsAddResourceSourceToFrame(
const v8::Arguments& args);
static v8::Handle<v8::Value> JsLoaded(const v8::Arguments& args);
static v8::Handle<v8::Value> JsPlatform(const v8::Arguments& args);
static v8::Handle<v8::Value> JsPort(const v8::Arguments& args);
static v8::Handle<v8::Value> JsActivateWindow(const v8::Arguments& args);
static v8::Handle<v8::Value> JsCloseWindow(const v8::Arguments& args);
static v8::Handle<v8::Value> JsDockWindow(const v8::Arguments& args);
static v8::Handle<v8::Value> JsUndockWindow(const v8::Arguments& args);
static v8::Handle<v8::Value> JsLocalizedStringsURL(
const v8::Arguments& args);
static v8::Handle<v8::Value> JsHiddenPanels(
const v8::Arguments& args);
static v8::Handle<v8::Value> JsDebuggerCommand(
const v8::Arguments& args);
static v8::Handle<v8::Value> JsSetting(
const v8::Arguments& args);
static v8::Handle<v8::Value> JsSetSetting(
const v8::Arguments& args);
static v8::Handle<v8::Value> JsDebuggerPauseScript(
const v8::Arguments& args);
static v8::Handle<v8::Value> JsWindowUnloading(
const v8::Arguments& args);
static v8::Handle<v8::Value> JsShowContextMenu(
const v8::Arguments& args);
WebKit::WebViewImpl* web_view_impl_;
WebKit::WebDevToolsFrontendClient* client_;
String application_locale_;
OwnPtr<JsDebuggerAgentBoundObj> debugger_agent_obj_;
OwnPtr<JsProfilerAgentBoundObj> profiler_agent_obj_;
OwnPtr<JsToolsAgentBoundObj> tools_agent_obj_;
bool loaded_;
Vector<Vector<String> > pending_incoming_messages_;
OwnPtr<ToolsAgentNativeDelegateImpl> tools_agent_native_delegate_impl_;
RefPtr<MenuSelectionHandler> menu_selection_handler_;
};
#endif // WEBKIT_GLUE_WEBDEVTOOLSFRONTEND_IMPL_H_
|