Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
seleniumhq
GitHub Repository: seleniumhq/selenium
Path: blob/trunk/cpp/webdriver-server/command_handler.h
2867 views
1
// Licensed to the Software Freedom Conservancy (SFC) under one
2
// or more contributor license agreements. See the NOTICE file
3
// distributed with this work for additional information
4
// regarding copyright ownership. The SFC licenses this file
5
// to you under the Apache License, Version 2.0 (the "License");
6
// you may not use this file except in compliance with the License.
7
// You may obtain a copy of the License at
8
//
9
// http://www.apache.org/licenses/LICENSE-2.0
10
//
11
// Unless required by applicable law or agreed to in writing, software
12
// distributed under the License is distributed on an "AS IS" BASIS,
13
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
// See the License for the specific language governing permissions and
15
// limitations under the License.
16
17
// Defines a template class for a command handler. Implementations of
18
// this class are intended to provide a command executor class which is
19
// responsible for the actual execution of commands.
20
21
#ifndef WEBDRIVER_SERVER_COMMAND_HANDLER_H_
22
#define WEBDRIVER_SERVER_COMMAND_HANDLER_H_
23
24
#include <map>
25
#include <string>
26
#include "json.h"
27
#include "command.h"
28
#include "response.h"
29
30
namespace webdriver {
31
32
template <class T>
33
class CommandHandler {
34
public:
35
CommandHandler(void) {}
36
virtual ~CommandHandler(void) {}
37
void Execute(const T& executor, const Command& command, Response* response) {
38
this->ExecuteInternal(executor,
39
command.command_parameters(),
40
response);
41
}
42
43
protected:
44
virtual void ExecuteInternal(const T& executor,
45
const ParametersMap& command_parameters,
46
Response* response) = 0;
47
48
DISALLOW_COPY_AND_ASSIGN(CommandHandler);
49
};
50
51
} // namespace webdriver
52
53
#endif // WEBDRIVER_SERVER_COMMAND_HANDLER_H_
54
55