Skip to content

Commit

Permalink
net: Put net/server/* into namespace net.
Browse files Browse the repository at this point in the history
BUG=64263
TEST=None

R=willchan@chromium.org

Review URL: http://codereview.chromium.org/6875024

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@81921 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
tfarina@chromium.org committed Apr 18, 2011
1 parent 46f438d commit b6dbb0a
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 37 deletions.
32 changes: 16 additions & 16 deletions chrome/browser/debugger/devtools_http_protocol_handler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ namespace {
class DevToolsClientHostImpl : public DevToolsClientHost {
public:
DevToolsClientHostImpl(
HttpServer* server,
net::HttpServer* server,
int connection_id)
: server_(server),
connection_id_(connection_id) {
Expand All @@ -50,7 +50,7 @@ class DevToolsClientHostImpl : public DevToolsClientHost {
BrowserThread::IO,
FROM_HERE,
NewRunnableMethod(server_,
&HttpServer::Close,
&net::HttpServer::Close,
connection_id_));
}

Expand All @@ -75,13 +75,13 @@ class DevToolsClientHostImpl : public DevToolsClientHost {
BrowserThread::IO,
FROM_HERE,
NewRunnableMethod(server_,
&HttpServer::SendOverWebSocket,
&net::HttpServer::SendOverWebSocket,
connection_id_,
data));
}

virtual void FrameNavigating(const std::string& url) {}
HttpServer* server_;
net::HttpServer* server_;
int connection_id_;
};

Expand Down Expand Up @@ -119,7 +119,7 @@ void DevToolsHttpProtocolHandler::Stop() {

void DevToolsHttpProtocolHandler::OnHttpRequest(
int connection_id,
const HttpServerRequestInfo& info) {
const net::HttpServerRequestInfo& info) {
if (info.path == "" || info.path == "/") {
// Pages discovery request.
BrowserThread::PostTask(
Expand Down Expand Up @@ -169,7 +169,7 @@ void DevToolsHttpProtocolHandler::OnHttpRequest(

void DevToolsHttpProtocolHandler::OnWebSocketRequest(
int connection_id,
const HttpServerRequestInfo& request) {
const net::HttpServerRequestInfo& request) {
BrowserThread::PostTask(
BrowserThread::UI,
FROM_HERE,
Expand Down Expand Up @@ -231,7 +231,7 @@ typedef std::vector<PageInfo> PageList;
static PageList GeneratePageList(
DevToolsHttpProtocolHandler::TabContentsProvider* tab_contents_provider,
int connection_id,
const HttpServerRequestInfo& info) {
const net::HttpServerRequestInfo& info) {
typedef DevToolsHttpProtocolHandler::InspectableTabs Tabs;
Tabs inspectable_tabs = tab_contents_provider->GetInspectableTabs();

Expand Down Expand Up @@ -262,7 +262,7 @@ static PageList GeneratePageList(

void DevToolsHttpProtocolHandler::OnRootRequestUI(
int connection_id,
const HttpServerRequestInfo& info) {
const net::HttpServerRequestInfo& info) {
std::string host = info.headers["Host"];
std::string response = "<html><body>";
PageList page_list = GeneratePageList(tab_contents_provider_.get(),
Expand Down Expand Up @@ -294,7 +294,7 @@ void DevToolsHttpProtocolHandler::OnRootRequestUI(

void DevToolsHttpProtocolHandler::OnJsonRequestUI(
int connection_id,
const HttpServerRequestInfo& info) {
const net::HttpServerRequestInfo& info) {
PageList page_list = GeneratePageList(tab_contents_provider_.get(),
connection_id, info);
ListValue json_pages_list;
Expand Down Expand Up @@ -327,7 +327,7 @@ void DevToolsHttpProtocolHandler::OnJsonRequestUI(

void DevToolsHttpProtocolHandler::OnWebSocketRequestUI(
int connection_id,
const HttpServerRequestInfo& request) {
const net::HttpServerRequestInfo& request) {
std::string prefix = "/devtools/page/";
size_t pos = request.path.find(prefix);
if (pos != 0) {
Expand Down Expand Up @@ -464,7 +464,7 @@ DevToolsHttpProtocolHandler::DevToolsHttpProtocolHandler(
}

void DevToolsHttpProtocolHandler::Init() {
server_ = new HttpServer(ip_, port_, this);
server_ = new net::HttpServer(ip_, port_, this);
}

// Run on I/O thread
Expand Down Expand Up @@ -507,7 +507,7 @@ void DevToolsHttpProtocolHandler::Send200(int connection_id,
BrowserThread::PostTask(
BrowserThread::IO, FROM_HERE,
NewRunnableMethod(server_.get(),
&HttpServer::Send200,
&net::HttpServer::Send200,
connection_id,
data,
mime_type));
Expand All @@ -517,7 +517,7 @@ void DevToolsHttpProtocolHandler::Send404(int connection_id) {
BrowserThread::PostTask(
BrowserThread::IO, FROM_HERE,
NewRunnableMethod(server_.get(),
&HttpServer::Send404,
&net::HttpServer::Send404,
connection_id));
}

Expand All @@ -526,18 +526,18 @@ void DevToolsHttpProtocolHandler::Send500(int connection_id,
BrowserThread::PostTask(
BrowserThread::IO, FROM_HERE,
NewRunnableMethod(server_.get(),
&HttpServer::Send500,
&net::HttpServer::Send500,
connection_id,
message));
}

void DevToolsHttpProtocolHandler::AcceptWebSocket(
int connection_id,
const HttpServerRequestInfo& request) {
const net::HttpServerRequestInfo& request) {
BrowserThread::PostTask(
BrowserThread::IO, FROM_HERE,
NewRunnableMethod(server_.get(),
&HttpServer::AcceptWebSocket,
&net::HttpServer::AcceptWebSocket,
connection_id,
request));
}
Expand Down
18 changes: 9 additions & 9 deletions chrome/browser/debugger/devtools_http_protocol_handler.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class TabContents;
class TabContentsWrapper;

class DevToolsHttpProtocolHandler
: public HttpServer::Delegate,
: public net::HttpServer::Delegate,
public net::URLRequest::Delegate,
public base::RefCountedThreadSafe<DevToolsHttpProtocolHandler> {
public:
Expand Down Expand Up @@ -56,21 +56,21 @@ class DevToolsHttpProtocolHandler
virtual ~DevToolsHttpProtocolHandler();
void Start();

// HttpServer::Delegate implementation.
// net::HttpServer::Delegate implementation.
virtual void OnHttpRequest(int connection_id,
const HttpServerRequestInfo& info);
const net::HttpServerRequestInfo& info);
virtual void OnWebSocketRequest(int connection_id,
const HttpServerRequestInfo& info);
const net::HttpServerRequestInfo& info);
virtual void OnWebSocketMessage(int connection_id,
const std::string& data);
virtual void OnClose(int connection_id);

virtual void OnRootRequestUI(int connection_id,
const HttpServerRequestInfo& info);
const net::HttpServerRequestInfo& info);
virtual void OnJsonRequestUI(int connection_id,
const HttpServerRequestInfo& info);
const net::HttpServerRequestInfo& info);
virtual void OnWebSocketRequestUI(int connection_id,
const HttpServerRequestInfo& info);
const net::HttpServerRequestInfo& info);
virtual void OnWebSocketMessageUI(int connection_id,
const std::string& data);
virtual void OnCloseUI(int connection_id);
Expand All @@ -91,14 +91,14 @@ class DevToolsHttpProtocolHandler
void Send500(int connection_id,
const std::string& message);
void AcceptWebSocket(int connection_id,
const HttpServerRequestInfo& request);
const net::HttpServerRequestInfo& request);

TabContents* GetTabContents(int session_id);

std::string ip_;
int port_;
std::string overriden_frontend_url_;
scoped_refptr<HttpServer> server_;
scoped_refptr<net::HttpServer> server_;
typedef std::map<net::URLRequest*, int>
RequestToSocketMap;
RequestToSocketMap request_to_connection_io_;
Expand Down
23 changes: 14 additions & 9 deletions net/server/http_server.cc
Original file line number Diff line number Diff line change
@@ -1,25 +1,28 @@
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Copyright (c) 2011 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 <map>

#ifdef _WIN32
#include <winsock2.h>
#else
#include <arpa/inet.h>
#endif
#include "net/server/http_server.h"

#include "base/compiler_specific.h"
#include "base/logging.h"
#include "base/md5.h"
#include "base/string_number_conversions.h"
#include "base/string_util.h"
#include "base/stringprintf.h"
#include "net/server/http_server.h"
#include "build/build_config.h"
#include "net/server/http_server_request_info.h"

#if defined(OS_WIN)
#include <winsock2.h>
#else
#include <arpa/inet.h>
#endif

namespace net {

int HttpServer::Connection::lastId_ = 0;

HttpServer::HttpServer(const std::string& host,
int port,
HttpServer::Delegate* del)
Expand Down Expand Up @@ -433,3 +436,5 @@ HttpServer::Connection* HttpServer::FindConnection(ListenSocket* socket) {
return NULL;
return it->second;
}

} // namespace net
4 changes: 4 additions & 0 deletions net/server/http_server.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
#include "base/memory/ref_counted.h"
#include "net/base/listen_socket.h"

namespace net {

class HttpServerRequestInfo;

class HttpServer : public ListenSocket::ListenSocketDelegate,
Expand Down Expand Up @@ -99,4 +101,6 @@ class HttpServer : public ListenSocket::ListenSocketDelegate,
DISALLOW_COPY_AND_ASSIGN(HttpServer);
};

} // namespace net

#endif // NET_SERVER_HTTP_SERVER_H_
6 changes: 5 additions & 1 deletion net/server/http_server_request_info.cc
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Copyright (c) 2011 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 "net/server/http_server_request_info.h"

namespace net {

HttpServerRequestInfo::HttpServerRequestInfo() {}

HttpServerRequestInfo::~HttpServerRequestInfo() {}

} // namespace net
8 changes: 6 additions & 2 deletions net/server/http_server_request_info.h
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Copyright (c) 2011 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.

#ifndef NET_SERVER_HTTP_SERVER_REQUEST_INFO_H_
#define NET_SERVER_HTTP_SERVER_REQUEST_INFO_H_
#pragma once

#include <string>
#include <map>
#include <string>

namespace net {

// Meta information about an HTTP request.
// This is geared toward servers in that it keeps a map of the headers and
Expand All @@ -32,4 +34,6 @@ class HttpServerRequestInfo {
mutable HeadersMap headers;
};

} // namespace net

#endif // NET_SERVER_HTTP_SERVER_REQUEST_INFO_H_

0 comments on commit b6dbb0a

Please sign in to comment.