Path: blob/trunk/cpp/iedriver/CommandHandlers/GetCurrentWindowHandleCommandHandler.cpp
2868 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#include "GetCurrentWindowHandleCommandHandler.h"17#include "errorcodes.h"18#include "../Browser.h"19#include "../IECommandExecutor.h"2021namespace webdriver {2223GetCurrentWindowHandleCommandHandler::GetCurrentWindowHandleCommandHandler(void) {24}2526GetCurrentWindowHandleCommandHandler::~GetCurrentWindowHandleCommandHandler(void) {27}2829void GetCurrentWindowHandleCommandHandler::ExecuteInternal(30const IECommandExecutor& executor,31const ParametersMap& command_parameters,32Response* response) {33std::string current_handle = executor.current_browser_id();34BrowserHandle browser;35int status_code = executor.GetManagedBrowser(current_handle, &browser);36if (status_code != WD_SUCCESS) {37response->SetErrorResponse(ERROR_NO_SUCH_WINDOW, "Window is closed");38} else {39response->SetSuccessResponse(current_handle);40}41}4243} // namespace webdriver444546