summaryrefslogtreecommitdiffstats
path: root/content/shell/shell_devtools_delegate_android.cc
blob: 59098f9b7fca53d0f5212a90ee7bde086e66a965 (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
// 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 "base/bind.h"
#include "base/stringprintf.h"
#include "content/public/browser/android/devtools_auth.h"
#include "content/public/browser/devtools_http_handler.h"
#include "grit/shell_resources.h"
#include "net/base/unix_domain_socket_posix.h"
#include "ui/base/layout.h"
#include "ui/base/resource/resource_bundle.h"

namespace {

// TODO(mnaganov): This hardcoded version should be replaced with the webkit
// revision of this build of content shell. This requires a feature addition
// to the devtools frontend.
const char* kFrontendVersion = "21.0.1175.0";
const char kSocketName[] = "content_shell_devtools_remote";
const char kFrontEndURL[] =
    "http://chrome-devtools-frontend.appspot.com/static/%s/devtools.html";

}

namespace content {

ShellDevToolsDelegate::ShellDevToolsDelegate(int port) {
  devtools_http_handler_ = DevToolsHttpHandler::Start(
      new net::UnixDomainSocketWithAbstractNamespaceFactory(
          kSocketName,
          base::Bind(&CanUserConnectToDevTools)),
      StringPrintf(kFrontEndURL, kFrontendVersion),
      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 false;
}

FilePath ShellDevToolsDelegate::GetDebugFrontendDir() {
  return FilePath();
}

std::string ShellDevToolsDelegate::GetPageThumbnailData(const GURL& url) {
  return "";
}

}  // namespace content