Path: blob/trunk/cpp/webdriver-server/command_handler.h
2867 views
// Licensed to the Software Freedom Conservancy (SFC) under one1// or more contributor license agreements. See the NOTICE file2// distributed with this work for additional information3// regarding copyright ownership. The SFC licenses this file4// to you under the Apache License, Version 2.0 (the "License");5// you may not use this file except in compliance with the License.6// You may obtain a copy of the License at7//8// http://www.apache.org/licenses/LICENSE-2.09//10// Unless required by applicable law or agreed to in writing, software11// distributed under the License is distributed on an "AS IS" BASIS,12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.13// See the License for the specific language governing permissions and14// limitations under the License.1516// Defines a template class for a command handler. Implementations of17// this class are intended to provide a command executor class which is18// responsible for the actual execution of commands.1920#ifndef WEBDRIVER_SERVER_COMMAND_HANDLER_H_21#define WEBDRIVER_SERVER_COMMAND_HANDLER_H_2223#include <map>24#include <string>25#include "json.h"26#include "command.h"27#include "response.h"2829namespace webdriver {3031template <class T>32class CommandHandler {33public:34CommandHandler(void) {}35virtual ~CommandHandler(void) {}36void Execute(const T& executor, const Command& command, Response* response) {37this->ExecuteInternal(executor,38command.command_parameters(),39response);40}4142protected:43virtual void ExecuteInternal(const T& executor,44const ParametersMap& command_parameters,45Response* response) = 0;4647DISALLOW_COPY_AND_ASSIGN(CommandHandler);48};4950} // namespace webdriver5152#endif // WEBDRIVER_SERVER_COMMAND_HANDLER_H_535455