1 // Copyright 2015 The Android Open Source Project
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 //      http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #ifndef WEBSERVER_WEBSERVD_DBUS_REQUEST_HANDLER_H_
16 #define WEBSERVER_WEBSERVD_DBUS_REQUEST_HANDLER_H_
17 
18 #include <string>
19 
20 #include <base/macros.h>
21 #include <dbus/object_path.h>
22 
23 #include "libwebserv/dbus-proxies.h"
24 #include "webservd/request_handler_interface.h"
25 
26 namespace webservd {
27 
28 class Server;
29 
30 // A D-Bus interface for a request handler.
31 class DBusRequestHandler final : public RequestHandlerInterface {
32  public:
33   using RequestHandlerProxy = org::chromium::WebServer::RequestHandlerProxy;
34   DBusRequestHandler(Server* server,
35                      RequestHandlerProxy* handler_proxy);
36 
37   // Called to process an incoming HTTP request this handler is subscribed
38   // to handle.
39   void HandleRequest(Request* request) override;
40 
41  private:
42   Server* server_{nullptr};
43   RequestHandlerProxy* handler_proxy_{nullptr};
44 
45   DISALLOW_COPY_AND_ASSIGN(DBusRequestHandler);
46 };
47 
48 }  // namespace webservd
49 
50 #endif  // WEBSERVER_WEBSERVD_DBUS_REQUEST_HANDLER_H_
51