2013-03-13 19:12:05 +00:00
|
|
|
// 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-CHROMIUM file.
|
|
|
|
|
2013-03-14 13:03:50 +00:00
|
|
|
#include "browser/browser_main_parts.h"
|
2013-03-13 19:12:05 +00:00
|
|
|
|
2013-03-14 13:03:50 +00:00
|
|
|
#include "browser/browser_context.h"
|
|
|
|
#include "browser/devtools_delegate.h"
|
|
|
|
|
|
|
|
#include "content/public/browser/devtools_http_handler.h"
|
|
|
|
#include "net/base/tcp_listen_socket.h"
|
2013-03-13 19:12:05 +00:00
|
|
|
|
|
|
|
namespace brightray {
|
|
|
|
|
|
|
|
BrowserMainParts::BrowserMainParts() {
|
|
|
|
}
|
|
|
|
|
|
|
|
BrowserMainParts::~BrowserMainParts() {
|
2013-03-14 13:03:50 +00:00
|
|
|
devtools_http_handler_->Stop();
|
|
|
|
devtools_http_handler_ = nullptr;
|
2013-03-13 19:12:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void BrowserMainParts::PreMainMessageLoopRun() {
|
2013-04-02 00:10:00 +00:00
|
|
|
browser_context_.reset(CreateBrowserContext());
|
2013-03-14 13:03:50 +00:00
|
|
|
|
|
|
|
// These two objects are owned by devtools_http_handler_.
|
|
|
|
auto delegate = new DevToolsDelegate;
|
|
|
|
auto factory = new net::TCPListenSocketFactory("127.0.0.1", 0);
|
|
|
|
|
|
|
|
devtools_http_handler_ = content::DevToolsHttpHandler::Start(factory, std::string(), delegate);
|
2013-03-13 19:12:05 +00:00
|
|
|
}
|
|
|
|
|
2013-04-02 00:10:00 +00:00
|
|
|
BrowserContext* BrowserMainParts::CreateBrowserContext() {
|
|
|
|
return new BrowserContext;
|
|
|
|
}
|
|
|
|
|
2013-03-13 19:12:05 +00:00
|
|
|
}
|