Rename browser_extensions_util to browser_guest_util (seee #3685)

After Alloy bootstrap deletion the remaining functions are no longer
related to extensions. This change is a functional no-op.
This commit is contained in:
Marshall Greenblatt 2024-07-02 13:50:48 -04:00
parent c0a3c897cf
commit bd57a40256
7 changed files with 21 additions and 34 deletions

View File

@ -479,6 +479,8 @@ source_set("libcef_static") {
"libcef/browser/browser_context.h", "libcef/browser/browser_context.h",
"libcef/browser/browser_frame.cc", "libcef/browser/browser_frame.cc",
"libcef/browser/browser_frame.h", "libcef/browser/browser_frame.h",
"libcef/browser/browser_guest_util.cc",
"libcef/browser/browser_guest_util.h",
"libcef/browser/browser_host_base.cc", "libcef/browser/browser_host_base.cc",
"libcef/browser/browser_host_base.h", "libcef/browser/browser_host_base.h",
"libcef/browser/browser_host_create.cc", "libcef/browser/browser_host_create.cc",
@ -554,8 +556,6 @@ source_set("libcef_static") {
"libcef/browser/download_manager_delegate.h", "libcef/browser/download_manager_delegate.h",
"libcef/browser/download_manager_delegate_impl.cc", "libcef/browser/download_manager_delegate_impl.cc",
"libcef/browser/download_manager_delegate_impl.h", "libcef/browser/download_manager_delegate_impl.h",
"libcef/browser/extensions/browser_extensions_util.cc",
"libcef/browser/extensions/browser_extensions_util.h",
"libcef/browser/file_dialog_manager.cc", "libcef/browser/file_dialog_manager.cc",
"libcef/browser/file_dialog_manager.h", "libcef/browser/file_dialog_manager.h",
"libcef/browser/file_dialog_runner.cc", "libcef/browser/file_dialog_runner.cc",

View File

@ -15,11 +15,11 @@
#include "cef/libcef/browser/alloy/browser_platform_delegate_alloy.h" #include "cef/libcef/browser/alloy/browser_platform_delegate_alloy.h"
#include "cef/libcef/browser/audio_capturer.h" #include "cef/libcef/browser/audio_capturer.h"
#include "cef/libcef/browser/browser_context.h" #include "cef/libcef/browser/browser_context.h"
#include "cef/libcef/browser/browser_guest_util.h"
#include "cef/libcef/browser/browser_info.h" #include "cef/libcef/browser/browser_info.h"
#include "cef/libcef/browser/browser_info_manager.h" #include "cef/libcef/browser/browser_info_manager.h"
#include "cef/libcef/browser/browser_platform_delegate.h" #include "cef/libcef/browser/browser_platform_delegate.h"
#include "cef/libcef/browser/context.h" #include "cef/libcef/browser/context.h"
#include "cef/libcef/browser/extensions/browser_extensions_util.h"
#include "cef/libcef/browser/hang_monitor.h" #include "cef/libcef/browser/hang_monitor.h"
#include "cef/libcef/browser/media_access_query.h" #include "cef/libcef/browser/media_access_query.h"
#include "cef/libcef/browser/osr/osr_util.h" #include "cef/libcef/browser/osr/osr_util.h"
@ -559,8 +559,8 @@ void AlloyBrowserHostImpl::CancelContextMenu() {
bool AlloyBrowserHostImpl::MaybeAllowNavigation( bool AlloyBrowserHostImpl::MaybeAllowNavigation(
content::RenderFrameHost* opener, content::RenderFrameHost* opener,
const content::OpenURLParams& params) { const content::OpenURLParams& params) {
const bool is_guest_view = extensions::IsBrowserPluginGuest( const bool is_guest_view =
content::WebContents::FromRenderFrameHost(opener)); IsBrowserPluginGuest(content::WebContents::FromRenderFrameHost(opener));
if (is_guest_view && !params.is_pdf && if (is_guest_view && !params.is_pdf &&
!params.url.SchemeIs(extensions::kExtensionScheme) && !params.url.SchemeIs(extensions::kExtensionScheme) &&
!params.url.SchemeIs(content::kChromeUIScheme)) { !params.url.SchemeIs(content::kChromeUIScheme)) {

View File

@ -2,15 +2,13 @@
// reserved. Use of this source code is governed by a BSD-style license that // reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file. // can be found in the LICENSE file.
#include "cef/libcef/browser/extensions/browser_extensions_util.h" #include "cef/libcef/browser/browser_guest_util.h"
#include "chrome/browser/browser_process.h" #include "chrome/browser/browser_process.h"
#include "chrome/browser/printing/print_preview_dialog_controller.h" #include "chrome/browser/printing/print_preview_dialog_controller.h"
#include "content/browser/browser_plugin/browser_plugin_guest.h" #include "content/browser/browser_plugin/browser_plugin_guest.h"
#include "content/browser/web_contents/web_contents_impl.h" #include "content/browser/web_contents/web_contents_impl.h"
namespace extensions {
namespace { namespace {
content::WebContents* GetOwnerForBrowserPluginGuest( content::WebContents* GetOwnerForBrowserPluginGuest(
@ -62,5 +60,3 @@ bool IsBrowserPluginGuest(const content::WebContents* web_contents) {
bool IsPrintPreviewDialog(const content::WebContents* web_contents) { bool IsPrintPreviewDialog(const content::WebContents* web_contents) {
return !!GetInitiatorForPrintPreviewDialog(web_contents); return !!GetInitiatorForPrintPreviewDialog(web_contents);
} }
} // namespace extensions

View File

@ -2,15 +2,13 @@
// reserved. Use of this source code is governed by a BSD-style license that // reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file. // can be found in the LICENSE file.
#ifndef CEF_LIBCEF_BROWSER_EXTENSIONS_BROWSER_EXTENSIONS_UTIL_H_ #ifndef CEF_LIBCEF_BROWSER_BROWSER_GUEST_UTIL_H_
#define CEF_LIBCEF_BROWSER_EXTENSIONS_BROWSER_EXTENSIONS_UTIL_H_ #define CEF_LIBCEF_BROWSER_BROWSER_GUEST_UTIL_H_
namespace content { namespace content {
class WebContents; class WebContents;
} // namespace content } // namespace content
namespace extensions {
// Returns the WebContents that owns the specified |guest|, if any. // Returns the WebContents that owns the specified |guest|, if any.
content::WebContents* GetOwnerForGuestContents( content::WebContents* GetOwnerForGuestContents(
const content::WebContents* guest); const content::WebContents* guest);
@ -19,6 +17,4 @@ content::WebContents* GetOwnerForGuestContents(
bool IsBrowserPluginGuest(const content::WebContents* web_contents); bool IsBrowserPluginGuest(const content::WebContents* web_contents);
bool IsPrintPreviewDialog(const content::WebContents* web_contents); bool IsPrintPreviewDialog(const content::WebContents* web_contents);
} // namespace extensions #endif // CEF_LIBCEF_BROWSER_BROWSER_GUEST_UTIL_H_
#endif // CEF_LIBCEF_BROWSER_EXTENSIONS_BROWSER_EXTENSIONS_UTIL_H_

View File

@ -7,10 +7,10 @@
#include <tuple> #include <tuple>
#include "base/logging.h" #include "base/logging.h"
#include "cef/libcef/browser/browser_guest_util.h"
#include "cef/libcef/browser/browser_info_manager.h" #include "cef/libcef/browser/browser_info_manager.h"
#include "cef/libcef/browser/browser_platform_delegate.h" #include "cef/libcef/browser/browser_platform_delegate.h"
#include "cef/libcef/browser/context.h" #include "cef/libcef/browser/context.h"
#include "cef/libcef/browser/extensions/browser_extensions_util.h"
#include "cef/libcef/browser/hang_monitor.h" #include "cef/libcef/browser/hang_monitor.h"
#include "cef/libcef/browser/image_impl.h" #include "cef/libcef/browser/image_impl.h"
#include "cef/libcef/browser/navigation_entry_impl.h" #include "cef/libcef/browser/navigation_entry_impl.h"
@ -128,7 +128,7 @@ CefRefPtr<CefBrowserHostBase> CefBrowserHostBase::GetBrowserForContents(
// Try the owner WebContents if |contents| originates from an excluded view // Try the owner WebContents if |contents| originates from an excluded view
// such as the PDF viewer or Print Preview. This is safe to call even if Alloy // such as the PDF viewer or Print Preview. This is safe to call even if Alloy
// extensions are disabled. // extensions are disabled.
if (auto* owner_contents = extensions::GetOwnerForGuestContents(contents)) { if (auto* owner_contents = GetOwnerForGuestContents(contents)) {
return WebContentsUserDataAdapter::Get(owner_contents); return WebContentsUserDataAdapter::Get(owner_contents);
} }

View File

@ -9,9 +9,9 @@
#include "base/command_line.h" #include "base/command_line.h"
#include "base/logging.h" #include "base/logging.h"
#include "base/task/sequenced_task_runner.h" #include "base/task/sequenced_task_runner.h"
#include "cef/libcef/browser/browser_guest_util.h"
#include "cef/libcef/browser/browser_host_base.h" #include "cef/libcef/browser/browser_host_base.h"
#include "cef/libcef/browser/browser_platform_delegate.h" #include "cef/libcef/browser/browser_platform_delegate.h"
#include "cef/libcef/browser/extensions/browser_extensions_util.h"
#include "cef/libcef/browser/thread_util.h" #include "cef/libcef/browser/thread_util.h"
#include "cef/libcef/common/cef_switches.h" #include "cef/libcef/common/cef_switches.h"
#include "cef/libcef/common/frame_util.h" #include "cef/libcef/common/frame_util.h"
@ -492,10 +492,8 @@ CefRefPtr<CefFrameHostImpl> CefBrowserInfoManager::GetFrameHost(
const bool is_pdf_process = rfh->GetProcess()->IsPdf(); const bool is_pdf_process = rfh->GetProcess()->IsPdf();
auto* web_contents = content::WebContents::FromRenderFrameHost(rfh); auto* web_contents = content::WebContents::FromRenderFrameHost(rfh);
const bool is_browser_process_guest = const bool is_browser_process_guest = IsBrowserPluginGuest(web_contents);
extensions::IsBrowserPluginGuest(web_contents); const bool is_print_preview_dialog = IsPrintPreviewDialog(web_contents);
const bool is_print_preview_dialog =
extensions::IsPrintPreviewDialog(web_contents);
bool excluded = bool excluded =
is_pdf_process || is_browser_process_guest || is_print_preview_dialog; is_pdf_process || is_browser_process_guest || is_print_preview_dialog;
@ -504,7 +502,7 @@ CefRefPtr<CefFrameHostImpl> CefBrowserInfoManager::GetFrameHost(
// A BrowserHost may match an excluded RFH type. Some associations are // A BrowserHost may match an excluded RFH type. Some associations are
// registered directly via CefBrowserInfo::MaybeCreateFrame and some are // registered directly via CefBrowserInfo::MaybeCreateFrame and some are
// discovered indirectly via extensions::GetOwnerForGuestContents. // discovered indirectly via GetOwnerForGuestContents.
auto browser = CefBrowserHostBase::GetBrowserForHost(rfh); auto browser = CefBrowserHostBase::GetBrowserForHost(rfh);
if (browser && !excluded) { if (browser && !excluded) {
frame = browser->browser_info()->GetFrameForHost(rfh, prefer_speculative); frame = browser->browser_info()->GetFrameForHost(rfh, prefer_speculative);
@ -544,13 +542,11 @@ bool CefBrowserInfoManager::IsExcludedFrameHost(content::RenderFrameHost* rfh) {
} }
auto* web_contents = content::WebContents::FromRenderFrameHost(rfh); auto* web_contents = content::WebContents::FromRenderFrameHost(rfh);
const bool is_browser_process_guest = const bool is_browser_process_guest = IsBrowserPluginGuest(web_contents);
extensions::IsBrowserPluginGuest(web_contents);
if (is_browser_process_guest) { if (is_browser_process_guest) {
return true; return true;
} }
const bool is_print_preview_dialog = const bool is_print_preview_dialog = IsPrintPreviewDialog(web_contents);
extensions::IsPrintPreviewDialog(web_contents);
if (is_print_preview_dialog) { if (is_print_preview_dialog) {
return true; return true;
} }
@ -777,8 +773,8 @@ void CefBrowserInfoManager::TimeoutNewBrowserInfoResponse(
// - When the PDF renderer is loaded in the print preview dialog. There will // - When the PDF renderer is loaded in the print preview dialog. There will
// be no RFH in this case. // be no RFH in this case.
// Any additional cases should be debugged and, if possible, // Any additional cases should be debugged and, if possible,
// extensions::GetOwnerForGuestContents should be improved to find the // GetOwnerForGuestContents should be improved to find the associated
// associated CefBrowserHost. // CefBrowserHost.
const bool has_rfh = const bool has_rfh =
!!content::RenderFrameHost::FromFrameToken(global_token); !!content::RenderFrameHost::FromFrameToken(global_token);

View File

@ -10,8 +10,8 @@
#include "base/functional/bind.h" #include "base/functional/bind.h"
#include "base/functional/callback_helpers.h" #include "base/functional/callback_helpers.h"
#include "base/logging.h" #include "base/logging.h"
#include "cef/libcef/browser/browser_guest_util.h"
#include "cef/libcef/browser/browser_host_base.h" #include "cef/libcef/browser/browser_host_base.h"
#include "cef/libcef/browser/extensions/browser_extensions_util.h"
#include "cef/libcef/browser/thread_util.h" #include "cef/libcef/browser/thread_util.h"
#include "components/javascript_dialogs/tab_modal_dialog_manager.h" #include "components/javascript_dialogs/tab_modal_dialog_manager.h"
@ -71,8 +71,7 @@ javascript_dialogs::TabModalDialogManager* GetTabModalDialogManager(
// Try the owner WebContents if the dialog originates from an excluded view // Try the owner WebContents if the dialog originates from an excluded view
// such as the PDF viewer or Print Preview. This is safe to call even if Alloy // such as the PDF viewer or Print Preview. This is safe to call even if Alloy
// extensions are disabled. // extensions are disabled.
if (auto* owner_contents = if (auto* owner_contents = GetOwnerForGuestContents(web_contents)) {
extensions::GetOwnerForGuestContents(web_contents)) {
return javascript_dialogs::TabModalDialogManager::FromWebContents( return javascript_dialogs::TabModalDialogManager::FromWebContents(
owner_contents); owner_contents);
} }