#include "chrome/test/chromedriver/chrome/chrome_impl.h"
#include <stddef.h>
#include <memory>
#include <optional>
#include <utility>
#include "base/check.h"
#include "base/containers/contains.h"
#include "base/ranges/algorithm.h"
#include "base/threading/platform_thread.h"
#include "base/time/time.h"
#include "base/values.h"
#include "chrome/test/chromedriver/chrome/browser_info.h"
#include "chrome/test/chromedriver/chrome/chrome.h"
#include "chrome/test/chromedriver/chrome/devtools_client.h"
#include "chrome/test/chromedriver/chrome/devtools_client_impl.h"
#include "chrome/test/chromedriver/chrome/devtools_event_listener.h"
#include "chrome/test/chromedriver/chrome/devtools_http_client.h"
#include "chrome/test/chromedriver/chrome/page_tracker.h"
#include "chrome/test/chromedriver/chrome/status.h"
#include "chrome/test/chromedriver/chrome/target_utils.h"
#include "chrome/test/chromedriver/chrome/web_view_impl.h"
namespace {
Status MakeFailedStatus(const std::string& desired_state,
const std::string& current_state) { … }
}
namespace internal {
WindowBounds::WindowBounds() = default;
WindowBounds::~WindowBounds() = default;
base::Value::Dict WindowBounds::ToDict() const { … }
bool WindowBounds::Matches(const Window& window) const { … }
}
ChromeImpl::~ChromeImpl() = default;
Status ChromeImpl::GetAsDesktop(ChromeDesktopImpl** desktop) { … }
const BrowserInfo* ChromeImpl::GetBrowserInfo() const { … }
bool ChromeImpl::HasCrashedWebView() { … }
Status ChromeImpl::GetWebViewIdForFirstTab(std::string* web_view_id,
bool w3c_compliant) { … }
Status ChromeImpl::GetWebViewCount(size_t* web_view_count, bool w3c_compliant) { … }
Status ChromeImpl::GetWebViewIds(std::list<std::string>* web_view_ids,
bool w3c_compliant) { … }
bool ChromeImpl::IsBrowserWindow(const WebViewInfo& view) const { … }
Status ChromeImpl::UpdateWebViews(const WebViewsInfo& views_info,
bool w3c_compliant) { … }
Status ChromeImpl::GetWebViewById(const std::string& id, WebView** web_view) { … }
Status ChromeImpl::NewWindow(const std::string& target_id,
WindowType type,
bool is_background,
std::string* window_handle) { … }
Status ChromeImpl::GetWindow(const std::string& target_id,
internal::Window& window) { … }
Status ChromeImpl::GetWindowRect(const std::string& target_id,
WindowRect* rect) { … }
Status ChromeImpl::MaximizeWindow(const std::string& target_id) { … }
Status ChromeImpl::MinimizeWindow(const std::string& target_id) { … }
Status ChromeImpl::FullScreenWindow(const std::string& target_id) { … }
Status ChromeImpl::SetWindowRect(const std::string& target_id,
const base::Value::Dict& params) { … }
Status ChromeImpl::GetWindowBounds(int window_id, internal::Window& window) { … }
Status ChromeImpl::SetWindowBounds(
internal::Window window,
const std::string& target_id,
const internal::WindowBounds& window_bounds) { … }
Status ChromeImpl::ParseWindow(const base::Value::Dict& params,
internal::Window& window) { … }
Status ChromeImpl::ParseWindowBounds(const base::Value::Dict& params,
internal::Window& window) { … }
Status ChromeImpl::CloseTarget(const std::string& id) { … }
Status ChromeImpl::CloseWebView(const std::string& id) { … }
Status ChromeImpl::ActivateWebView(const std::string& id) { … }
Status ChromeImpl::SetAcceptInsecureCerts() { … }
Status ChromeImpl::SetPermission(
std::unique_ptr<base::Value::Dict> permission_descriptor,
PermissionState desired_state,
WebView* current_view) { … }
bool ChromeImpl::IsMobileEmulationEnabled() const { … }
bool ChromeImpl::HasTouchScreen() const { … }
std::string ChromeImpl::page_load_strategy() const { … }
Status ChromeImpl::Quit() { … }
DevToolsClient* ChromeImpl::Client() const { … }
ChromeImpl::ChromeImpl(BrowserInfo browser_info,
std::set<WebViewInfo::Type> window_types,
std::unique_ptr<DevToolsClient> websocket_client,
std::vector<std::unique_ptr<DevToolsEventListener>>
devtools_event_listeners,
std::optional<MobileDevice> mobile_device,
std::string page_load_strategy,
bool autoaccept_beforeunload)
: … { … }