Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
seleniumhq
GitHub Repository: seleniumhq/selenium
Path: blob/trunk/cpp/iedriver/CommandHandlers/GetAllWindowHandlesCommandHandler.cpp
2868 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
#include "GetAllWindowHandlesCommandHandler.h"
18
#include "../Browser.h"
19
#include "../IECommandExecutor.h"
20
21
namespace webdriver {
22
23
GetAllWindowHandlesCommandHandler::GetAllWindowHandlesCommandHandler(void) {
24
}
25
26
GetAllWindowHandlesCommandHandler::~GetAllWindowHandlesCommandHandler(void) {
27
}
28
29
void GetAllWindowHandlesCommandHandler::ExecuteInternal(
30
const IECommandExecutor& executor,
31
const ParametersMap& command_parameters,
32
Response* response) {
33
Json::Value handles(Json::arrayValue);
34
std::vector<std::string> handle_list;
35
executor.GetManagedBrowserHandles(&handle_list);
36
for (unsigned int i = 0; i < handle_list.size(); ++i) {
37
handles.append(handle_list[i]);
38
}
39
40
response->SetSuccessResponse(handles);
41
}
42
43
} // namespace webdriver
44
45