webserver: Moved platform2/libwebserv to platform2/webserver
Cleaned up the code structure a bit inside the web server directory
to reflect the current layout of functionality:
- Renamed the top-level director from libwebserv to webserver
- Moved the client library code to sub-directory of libwebserv to
be on the same level as the web server daemon (webservd).
- Updated the source code to reflect the new include paths.
BUG=brillo:10
TEST=FEATURES=test emerge-storm webserver privetd ap-daemons
CQ-DEPEND=CL:245755,CL:*195317
Change-Id: Idb8d665b6e0c15b5ee0219ff72327045a7084363
Reviewed-on: https://chromium-review.googlesource.com/245736
Reviewed-by: Christopher Wiley <wiley@chromium.org>
Commit-Queue: Alex Vakulenko <avakulenko@chromium.org>
Tested-by: Alex Vakulenko <avakulenko@chromium.org>
diff --git a/libwebserv/request_handler_callback.h b/libwebserv/request_handler_callback.h
new file mode 100644
index 0000000..1be1817
--- /dev/null
+++ b/libwebserv/request_handler_callback.h
@@ -0,0 +1,34 @@
+// Copyright 2014 The Chromium OS 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 WEBSERVER_LIBWEBSERV_REQUEST_HANDLER_CALLBACK_H_
+#define WEBSERVER_LIBWEBSERV_REQUEST_HANDLER_CALLBACK_H_
+
+#include <base/callback.h>
+#include <base/macros.h>
+#include <libwebserv/export.h>
+#include <libwebserv/request_handler_interface.h>
+
+namespace libwebserv {
+
+// A simple request handler that wraps a callback function.
+// Essentially, it redirects the RequestHandlerInterface::HandleRequest calls
+// to the provided callback.
+class LIBWEBSERV_EXPORT RequestHandlerCallback
+ : public RequestHandlerInterface {
+ public:
+ explicit RequestHandlerCallback(
+ const base::Callback<HandlerSignature>& callback);
+
+ void HandleRequest(scoped_ptr<Request> request,
+ scoped_ptr<Response> response) override;
+
+ private:
+ base::Callback<HandlerSignature> callback_;
+ DISALLOW_COPY_AND_ASSIGN(RequestHandlerCallback);
+};
+
+} // namespace libwebserv
+
+#endif // WEBSERVER_LIBWEBSERV_REQUEST_HANDLER_CALLBACK_H_