Remove devtools window runner abstraction (see #3685)

Remove code abstractions that are no longer required after deletion of
the Alloy bootstrap. This is a functional no-op.
This commit is contained in:
Marshall Greenblatt 2024-07-02 14:27:11 -04:00
parent cd3f617171
commit 1cdf02815e
7 changed files with 31 additions and 73 deletions

View File

@ -514,8 +514,6 @@ source_set("libcef_static") {
"libcef/browser/chrome/chrome_content_browser_client_cef.h",
"libcef/browser/chrome/chrome_context_menu_handler.cc",
"libcef/browser/chrome/chrome_context_menu_handler.h",
"libcef/browser/chrome/chrome_devtools_window_runner.cc",
"libcef/browser/chrome/chrome_devtools_window_runner.h",
"libcef/browser/chrome/chrome_startup_browser_creator.cc",
"libcef/browser/chrome/chrome_startup_browser_creator.h",
"libcef/browser/chrome/chrome_web_contents_view_delegate_cef.h",
@ -548,8 +546,8 @@ source_set("libcef_static") {
"libcef/browser/devtools/devtools_controller.h",
"libcef/browser/devtools/devtools_protocol_manager.cc",
"libcef/browser/devtools/devtools_protocol_manager.h",
"libcef/browser/devtools/devtools_window_runner.cc",
"libcef/browser/devtools/devtools_window_runner.h",
"libcef/browser/devtools/devtools_window_runner_create.cc",
"libcef/browser/download_item_impl.cc",
"libcef/browser/download_item_impl.h",
"libcef/browser/download_manager_delegate.cc",

View File

@ -1360,7 +1360,7 @@ CefMediaStreamRegistrar* CefBrowserHostBase::GetMediaStreamRegistrar() {
CefDevToolsWindowRunner* CefBrowserHostBase::GetDevToolsWindowRunner() {
if (!devtools_window_runner_) {
devtools_window_runner_ = CefDevToolsWindowRunner::Create();
devtools_window_runner_ = std::make_unique<CefDevToolsWindowRunner>();
}
return devtools_window_runner_.get();
}

View File

@ -12,9 +12,9 @@
#include "cef/libcef/browser/browser_platform_delegate.h"
#include "cef/libcef/browser/chrome/chrome_browser_context.h"
#include "cef/libcef/browser/chrome/chrome_browser_host_impl.h"
#include "cef/libcef/browser/chrome/chrome_devtools_window_runner.h"
#include "cef/libcef/browser/chrome/views/chrome_browser_view.h"
#include "cef/libcef/browser/chrome/views/chrome_child_window.h"
#include "cef/libcef/browser/devtools/devtools_window_runner.h"
#include "cef/libcef/browser/hang_monitor.h"
#include "cef/libcef/browser/media_access_query.h"
#include "cef/libcef/browser/request_context_impl.h"
@ -98,8 +98,7 @@ Browser* ChromeBrowserDelegate::CreateDevToolsBrowser(
CefBrowserCreateParams create_params;
CefWindowInfo window_info;
auto* devtools_window_runner = static_cast<ChromeDevToolsWindowRunner*>(
opener_browser_host->GetDevToolsWindowRunner());
auto* devtools_window_runner = opener_browser_host->GetDevToolsWindowRunner();
auto pending_show_devtools_params =
devtools_window_runner->TakePendingParams();

View File

@ -1,40 +0,0 @@
// Copyright 2024 The Chromium Embedded Framework Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CEF_LIBCEF_BROWSER_CHROME_CHROME_DEVTOOLS_WINDOW_RUNNER_H_
#define CEF_LIBCEF_BROWSER_CHROME_CHROME_DEVTOOLS_WINDOW_RUNNER_H_
#pragma once
#include "base/memory/weak_ptr.h"
#include "cef/libcef/browser/devtools/devtools_window_runner.h"
class ChromeBrowserHostImpl;
// Creates and runs a DevTools window instance. Only accessed on the UI thread.
class ChromeDevToolsWindowRunner : public CefDevToolsWindowRunner {
public:
ChromeDevToolsWindowRunner() = default;
ChromeDevToolsWindowRunner(const ChromeDevToolsWindowRunner&) = delete;
ChromeDevToolsWindowRunner& operator=(const ChromeDevToolsWindowRunner&) =
delete;
// CefDevToolsWindowRunner methods:
void ShowDevTools(CefBrowserHostBase* opener,
std::unique_ptr<CefShowDevToolsParams> params) override;
void CloseDevTools() override;
bool HasDevTools() override;
std::unique_ptr<CefShowDevToolsParams> TakePendingParams();
void SetDevToolsBrowserHost(
base::WeakPtr<ChromeBrowserHostImpl> browser_host);
private:
std::unique_ptr<CefShowDevToolsParams> pending_params_;
base::WeakPtr<ChromeBrowserHostImpl> browser_host_;
};
#endif // CEF_LIBCEF_BROWSER_CHROME_CHROME_DEVTOOLS_WINDOW_RUNNER_H_

View File

@ -2,14 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "cef/libcef/browser/chrome/chrome_devtools_window_runner.h"
#include "cef/libcef/browser/devtools/devtools_window_runner.h"
#include "cef/libcef/browser/chrome/chrome_browser_host_impl.h"
#include "cef/libcef/browser/request_context_impl.h"
#include "cef/libcef/browser/thread_util.h"
#include "chrome/browser/devtools/devtools_window.h"
void ChromeDevToolsWindowRunner::ShowDevTools(
void CefDevToolsWindowRunner::ShowDevTools(
CefBrowserHostBase* opener,
std::unique_ptr<CefShowDevToolsParams> params) {
CEF_REQUIRE_UIT();
@ -46,7 +46,7 @@ void ChromeDevToolsWindowRunner::ShowDevTools(
DCHECK(browser_host_);
}
void ChromeDevToolsWindowRunner::CloseDevTools() {
void CefDevToolsWindowRunner::CloseDevTools() {
CEF_REQUIRE_UIT();
if (browser_host_) {
browser_host_->TryCloseBrowser();
@ -54,18 +54,18 @@ void ChromeDevToolsWindowRunner::CloseDevTools() {
}
}
bool ChromeDevToolsWindowRunner::HasDevTools() {
bool CefDevToolsWindowRunner::HasDevTools() {
CEF_REQUIRE_UIT();
return !!browser_host_;
}
std::unique_ptr<CefShowDevToolsParams>
ChromeDevToolsWindowRunner::TakePendingParams() {
CefDevToolsWindowRunner::TakePendingParams() {
CEF_REQUIRE_UIT();
return std::move(pending_params_);
}
void ChromeDevToolsWindowRunner::SetDevToolsBrowserHost(
void CefDevToolsWindowRunner::SetDevToolsBrowserHost(
base::WeakPtr<ChromeBrowserHostImpl> browser_host) {
CEF_REQUIRE_UIT();
DCHECK(!browser_host_);

View File

@ -8,9 +8,11 @@
#include <memory>
#include "base/memory/weak_ptr.h"
#include "cef/include/cef_client.h"
class CefBrowserHostBase;
class ChromeBrowserHostImpl;
// Parameters passed to ShowDevTools.
struct CefShowDevToolsParams {
@ -30,18 +32,28 @@ struct CefShowDevToolsParams {
};
// Creates and runs a DevTools window instance. Only accessed on the UI thread.
class CefDevToolsWindowRunner {
class CefDevToolsWindowRunner final {
public:
// Creates the appropriate runner type based on the current runtime.
static std::unique_ptr<CefDevToolsWindowRunner> Create();
CefDevToolsWindowRunner() = default;
// See documentation on CefBrowserHost methods of the same name.
virtual void ShowDevTools(CefBrowserHostBase* opener,
std::unique_ptr<CefShowDevToolsParams> params) = 0;
virtual void CloseDevTools() = 0;
virtual bool HasDevTools() = 0;
CefDevToolsWindowRunner(const CefDevToolsWindowRunner&) = delete;
CefDevToolsWindowRunner& operator=(const CefDevToolsWindowRunner&) =
delete;
virtual ~CefDevToolsWindowRunner() = default;
void ShowDevTools(CefBrowserHostBase* opener,
std::unique_ptr<CefShowDevToolsParams> params);
void CloseDevTools();
bool HasDevTools();
std::unique_ptr<CefShowDevToolsParams> TakePendingParams();
void SetDevToolsBrowserHost(
base::WeakPtr<ChromeBrowserHostImpl> browser_host);
private:
std::unique_ptr<CefShowDevToolsParams> pending_params_;
base::WeakPtr<ChromeBrowserHostImpl> browser_host_;
};
#endif // CEF_LIBCEF_BROWSER_DEVTOOLS_DEVTOOLS_WINDOW_RUNNER_H_

View File

@ -1,11 +0,0 @@
// Copyright 2024 The Chromium Embedded Framework Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "cef/libcef/browser/chrome/chrome_devtools_window_runner.h"
#include "cef/libcef/browser/devtools/devtools_window_runner.h"
// static
std::unique_ptr<CefDevToolsWindowRunner> CefDevToolsWindowRunner::Create() {
return std::make_unique<ChromeDevToolsWindowRunner>();
}