blob: 04af672d3237c8d071748b602b44942e9f0f01a9 (
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
|
// Copyright (c) 2012 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.
#include "content/renderer/devtools/devtools_client.h"
#include "base/command_line.h"
#include "base/message_loop/message_loop.h"
#include "base/strings/utf_string_conversions.h"
#include "content/common/devtools_messages.h"
#include "content/public/common/content_switches.h"
#include "content/public/common/url_constants.h"
#include "content/renderer/render_thread_impl.h"
#include "content/renderer/render_view_impl.h"
#include "third_party/WebKit/public/platform/WebFloatPoint.h"
#include "third_party/WebKit/public/platform/WebString.h"
#include "third_party/WebKit/public/web/WebDevToolsFrontend.h"
#include "ui/base/ui_base_switches.h"
using blink::WebDevToolsFrontend;
using blink::WebString;
namespace content {
DevToolsClient::DevToolsClient(RenderFrame* main_render_frame,
const std::string& compatibility_script)
: RenderFrameObserver(main_render_frame),
compatibility_script_(compatibility_script),
web_tools_frontend_(
WebDevToolsFrontend::Create(main_render_frame->GetWebFrame(), this)) {
}
DevToolsClient::~DevToolsClient() {
}
void DevToolsClient::DidClearWindowObject() {
if (!compatibility_script_.empty())
render_frame()->ExecuteJavaScript(base::UTF8ToUTF16(compatibility_script_));
}
void DevToolsClient::OnDestruct() {
delete this;
}
void DevToolsClient::SendMessageToEmbedder(const WebString& message) {
Send(new DevToolsHostMsg_DispatchOnEmbedder(routing_id(), message.Utf8()));
}
bool DevToolsClient::IsUnderTest() {
return RenderThreadImpl::current()->layout_test_mode();
}
} // namespace content
|