Skip to content

Commit

Permalink
Remove devtools window runner abstraction (see #3685)
Browse files Browse the repository at this point in the history
Remove code abstractions that are no longer required after deletion of
the Alloy bootstrap. This is a functional no-op.
  • Loading branch information
magreenblatt committed Jul 5, 2024
1 parent cd3f617 commit 1cdf028
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 73 deletions.
4 changes: 1 addition & 3 deletions BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion libcef/browser/browser_host_base.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
5 changes: 2 additions & 3 deletions libcef/browser/chrome/chrome_browser_delegate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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();

Expand Down
40 changes: 0 additions & 40 deletions libcef/browser/chrome/chrome_devtools_window_runner.h

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -46,26 +46,26 @@ void ChromeDevToolsWindowRunner::ShowDevTools(
DCHECK(browser_host_);
}

void ChromeDevToolsWindowRunner::CloseDevTools() {
void CefDevToolsWindowRunner::CloseDevTools() {
CEF_REQUIRE_UIT();
if (browser_host_) {
browser_host_->TryCloseBrowser();
browser_host_ = nullptr;
}
}

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_);
Expand Down
30 changes: 21 additions & 9 deletions libcef/browser/devtools/devtools_window_runner.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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_
11 changes: 0 additions & 11 deletions libcef/browser/devtools/devtools_window_runner_create.cc

This file was deleted.

0 comments on commit 1cdf028

Please sign in to comment.