Add long running gmail memory benchmark for background tab.
[chromium-blink-merge.git] / content / browser / devtools / browser_devtools_agent_host.cc
blobe7dbaa60098095004a5e85df64d6306249d4c435
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "content/browser/devtools/browser_devtools_agent_host.h"
7 #include "base/bind.h"
8 #include "content/browser/devtools/devtools_protocol_handler.h"
9 #include "content/browser/devtools/protocol/system_info_handler.h"
10 #include "content/browser/devtools/protocol/tethering_handler.h"
11 #include "content/browser/devtools/protocol/tracing_handler.h"
13 namespace content {
15 scoped_refptr<DevToolsAgentHost> DevToolsAgentHost::CreateForBrowser(
16 scoped_refptr<base::SingleThreadTaskRunner> tethering_task_runner,
17 const CreateServerSocketCallback& socket_callback) {
18 return new BrowserDevToolsAgentHost(tethering_task_runner, socket_callback);
21 BrowserDevToolsAgentHost::BrowserDevToolsAgentHost(
22 scoped_refptr<base::SingleThreadTaskRunner> tethering_task_runner,
23 const CreateServerSocketCallback& socket_callback)
24 : system_info_handler_(new devtools::system_info::SystemInfoHandler()),
25 tethering_handler_(
26 new devtools::tethering::TetheringHandler(socket_callback,
27 tethering_task_runner)),
28 tracing_handler_(new devtools::tracing::TracingHandler(
29 devtools::tracing::TracingHandler::Browser)),
30 protocol_handler_(new DevToolsProtocolHandler(
31 this,
32 base::Bind(&BrowserDevToolsAgentHost::SendMessageToClient,
33 base::Unretained(this)))) {
34 DevToolsProtocolDispatcher* dispatcher = protocol_handler_->dispatcher();
35 dispatcher->SetSystemInfoHandler(system_info_handler_.get());
36 dispatcher->SetTetheringHandler(tethering_handler_.get());
37 dispatcher->SetTracingHandler(tracing_handler_.get());
40 BrowserDevToolsAgentHost::~BrowserDevToolsAgentHost() {
43 void BrowserDevToolsAgentHost::Attach() {
46 void BrowserDevToolsAgentHost::Detach() {
49 DevToolsAgentHost::Type BrowserDevToolsAgentHost::GetType() {
50 return TYPE_BROWSER;
53 std::string BrowserDevToolsAgentHost::GetTitle() {
54 return "";
57 GURL BrowserDevToolsAgentHost::GetURL() {
58 return GURL();
61 bool BrowserDevToolsAgentHost::Activate() {
62 return false;
65 bool BrowserDevToolsAgentHost::Close() {
66 return false;
69 bool BrowserDevToolsAgentHost::DispatchProtocolMessage(
70 const std::string& message) {
71 protocol_handler_->HandleMessage(message);
72 return true;
75 } // content