forked from nwjs/nw.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathshell_devtools_delegate.cc
More file actions
49 lines (39 loc) · 1.35 KB
/
shell_devtools_delegate.cc
File metadata and controls
49 lines (39 loc) · 1.35 KB
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
// 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/shell/shell_devtools_delegate.h"
#include "content/public/browser/devtools_http_handler.h"
#include "grit/nw_resources.h"
#include "net/base/tcp_listen_socket.h"
#include "net/url_request/url_request_context_getter.h"
#include "ui/base/layout.h"
#include "ui/base/resource/resource_bundle.h"
namespace content {
ShellDevToolsDelegate::ShellDevToolsDelegate(
int port,
net::URLRequestContextGetter* context_getter)
: context_getter_(context_getter) {
devtools_http_handler_ = DevToolsHttpHandler::Start(
new net::TCPListenSocketFactory("127.0.0.1", port),
"",
context_getter_,
this);
}
ShellDevToolsDelegate::~ShellDevToolsDelegate() {
}
void ShellDevToolsDelegate::Stop() {
// The call below destroys this.
devtools_http_handler_->Stop();
}
std::string ShellDevToolsDelegate::GetDiscoveryPageHTML() {
return ResourceBundle::GetSharedInstance().GetRawDataResource(
IDR_CONTENT_SHELL_DEVTOOLS_DISCOVERY_PAGE,
ui::SCALE_FACTOR_NONE).as_string();
}
bool ShellDevToolsDelegate::BundlesFrontendResources() {
return true;
}
std::string ShellDevToolsDelegate::GetFrontendResourcesBaseURL() {
return "";
}
} // namespace content