Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
package com.hubspot.chrome.devtools.client.core.browser;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.hubspot.chrome.devtools.base.ChromeRequest;
import com.hubspot.chrome.devtools.base.ChromeSessionCore;
import com.hubspot.chrome.devtools.client.core.target.TargetID;
import java.util.List;
import java.util.concurrent.CompletableFuture;
/**
* The Browser domain defines methods and events for browser managing.
*/
public final class Browser {
ChromeSessionCore chromeSession;
ObjectMapper objectMapper;
public Browser(ChromeSessionCore chromeSession, ObjectMapper objectMapper) {
this.chromeSession = chromeSession;
this.objectMapper = objectMapper;
}
/**
* Close browser gracefully.
*/
public void close() {
ChromeRequest chromeRequest = new ChromeRequest("Browser.close");
chromeSession.send(chromeRequest);
}
/**
* Close browser gracefully.
*/
public void closeAsync() {
ChromeRequest chromeRequest = new ChromeRequest("Browser.close");
chromeSession.sendAsync(chromeRequest);
}
/**
* Returns version information.
*/
public GetVersionResult getVersion() {
ChromeRequest chromeRequest = new ChromeRequest("Browser.getVersion");
return chromeSession.send(chromeRequest, new TypeReference(){});
}
/**
* Returns version information.
*/
public CompletableFuture getVersionAsync() {
ChromeRequest chromeRequest = new ChromeRequest("Browser.getVersion");
return chromeSession.sendAsync(chromeRequest, new TypeReference(){});
}
/**
* Get Chrome histograms.
*
* @param query [Optional] Requested substring in name. Only histograms which have query as a
* substring in their name are extracted. An empty or absent query returns
* all histograms.
*/
public List getHistograms(String query) {
ChromeRequest chromeRequest = new ChromeRequest("Browser.getHistograms");
chromeRequest
.putParams("query", query);
return chromeSession.send(chromeRequest, new TypeReference>(){});
}
/**
* Get Chrome histograms.
*
* @param query [Optional] Requested substring in name. Only histograms which have query as a
* substring in their name are extracted. An empty or absent query returns
* all histograms.
*/
public CompletableFuture> getHistogramsAsync(String query) {
ChromeRequest chromeRequest = new ChromeRequest("Browser.getHistograms");
chromeRequest
.putParams("query", query);
return chromeSession.sendAsync(chromeRequest, new TypeReference>(){});
}
/**
* Get a Chrome histogram by name.
*
* @param name Requested histogram name.
*/
public Histogram getHistogram(String name) {
ChromeRequest chromeRequest = new ChromeRequest("Browser.getHistogram");
chromeRequest
.putParams("name", name);
return chromeSession.send(chromeRequest, new TypeReference(){});
}
/**
* Get a Chrome histogram by name.
*
* @param name Requested histogram name.
*/
public CompletableFuture getHistogramAsync(String name) {
ChromeRequest chromeRequest = new ChromeRequest("Browser.getHistogram");
chromeRequest
.putParams("name", name);
return chromeSession.sendAsync(chromeRequest, new TypeReference(){});
}
/**
* Get position and size of the browser window.
*
* @param windowId Browser window id.
*/
public Bounds getWindowBounds(WindowID windowId) {
ChromeRequest chromeRequest = new ChromeRequest("Browser.getWindowBounds");
chromeRequest
.putParams("windowId", windowId);
return chromeSession.send(chromeRequest, new TypeReference(){});
}
/**
* Get position and size of the browser window.
*
* @param windowId Browser window id.
*/
public CompletableFuture getWindowBoundsAsync(WindowID windowId) {
ChromeRequest chromeRequest = new ChromeRequest("Browser.getWindowBounds");
chromeRequest
.putParams("windowId", windowId);
return chromeSession.sendAsync(chromeRequest, new TypeReference(){});
}
/**
* Get the browser window that contains the devtools target.
*
* @param targetId Devtools agent host id.
*/
public GetWindowForTargetResult getWindowForTarget(TargetID targetId) {
ChromeRequest chromeRequest = new ChromeRequest("Browser.getWindowForTarget");
chromeRequest
.putParams("targetId", targetId);
return chromeSession.send(chromeRequest, new TypeReference(){});
}
/**
* Get the browser window that contains the devtools target.
*
* @param targetId Devtools agent host id.
*/
public CompletableFuture getWindowForTargetAsync(TargetID targetId) {
ChromeRequest chromeRequest = new ChromeRequest("Browser.getWindowForTarget");
chromeRequest
.putParams("targetId", targetId);
return chromeSession.sendAsync(chromeRequest, new TypeReference(){});
}
/**
* Set position and/or size of the browser window.
*
* @param windowId Browser window id.
* @param bounds New window bounds. The 'minimized', 'maximized' and 'fullscreen' states cannot be combined
* with 'left', 'top', 'width' or 'height'. Leaves unspecified fields unchanged.
*/
public void setWindowBounds(WindowID windowId, Bounds bounds) {
ChromeRequest chromeRequest = new ChromeRequest("Browser.setWindowBounds");
chromeRequest
.putParams("windowId", windowId)
.putParams("bounds", bounds);
chromeSession.send(chromeRequest);
}
/**
* Set position and/or size of the browser window.
*
* @param windowId Browser window id.
* @param bounds New window bounds. The 'minimized', 'maximized' and 'fullscreen' states cannot be combined
* with 'left', 'top', 'width' or 'height'. Leaves unspecified fields unchanged.
*/
public void setWindowBoundsAsync(WindowID windowId, Bounds bounds) {
ChromeRequest chromeRequest = new ChromeRequest("Browser.setWindowBounds");
chromeRequest
.putParams("windowId", windowId)
.putParams("bounds", bounds);
chromeSession.sendAsync(chromeRequest);
}
}