|
| 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 |
| 6 | +// "License"); you may not use this file except in compliance |
| 7 | +// with the License. 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, |
| 12 | +// software distributed under the License is distributed on an |
| 13 | +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 14 | +// KIND, either express or implied. See the License for the |
| 15 | +// specific language governing permissions and limitations |
| 16 | +// under the License. |
| 17 | + |
| 18 | +package org.openqa.selenium.bidi.browser; |
| 19 | + |
| 20 | +import java.util.Map; |
| 21 | + |
| 22 | +public class ClientWindowInfo { |
| 23 | + private final String clientWindow; |
| 24 | + private final ClientWindowState state; |
| 25 | + private final Integer width; |
| 26 | + private final Integer height; |
| 27 | + private final Integer x; |
| 28 | + private final Integer y; |
| 29 | + private final boolean active; |
| 30 | + |
| 31 | + public ClientWindowInfo( |
| 32 | + String clientWindow, |
| 33 | + ClientWindowState state, |
| 34 | + Integer width, |
| 35 | + Integer height, |
| 36 | + Integer x, |
| 37 | + Integer y, |
| 38 | + boolean active) { |
| 39 | + this.clientWindow = clientWindow; |
| 40 | + this.state = state; |
| 41 | + this.width = width; |
| 42 | + this.height = height; |
| 43 | + this.x = x; |
| 44 | + this.y = y; |
| 45 | + this.active = active; |
| 46 | + } |
| 47 | + |
| 48 | + public static ClientWindowInfo fromJson(Map<String, Object> map) { |
| 49 | + return new ClientWindowInfo( |
| 50 | + (String) map.get("clientWindow"), |
| 51 | + ClientWindowState.fromString((String) map.get("state")), |
| 52 | + ((Number) map.get("width")).intValue(), |
| 53 | + ((Number) map.get("height")).intValue(), |
| 54 | + ((Number) map.get("x")).intValue(), |
| 55 | + ((Number) map.get("y")).intValue(), |
| 56 | + (Boolean) map.get("active")); |
| 57 | + } |
| 58 | + |
| 59 | + public String getClientWindow() { |
| 60 | + return clientWindow; |
| 61 | + } |
| 62 | + |
| 63 | + public ClientWindowState getState() { |
| 64 | + return state; |
| 65 | + } |
| 66 | + |
| 67 | + public Integer getWidth() { |
| 68 | + return width; |
| 69 | + } |
| 70 | + |
| 71 | + public Integer getHeight() { |
| 72 | + return height; |
| 73 | + } |
| 74 | + |
| 75 | + public Integer getX() { |
| 76 | + return x; |
| 77 | + } |
| 78 | + |
| 79 | + public Integer getY() { |
| 80 | + return y; |
| 81 | + } |
| 82 | + |
| 83 | + public boolean isActive() { |
| 84 | + return active; |
| 85 | + } |
| 86 | +} |
0 commit comments