[Reland][Extensions] Remove ExtensionHostDelegate::GetJavaScriptDialogManager()
This is a reland of https://chromium-review.googlesource.com/c/chromium/src/+/6013243. The original CL was reverted because it didn't update the DesktopAndroid variants of the ExtensionHostDelegate, and we don't (yet) have desktop-android bots on the CQ. The reland updates that class. Original CL description: ExtensionHostDelegate::GetJavaScriptDialogManager() is used by ExtensionHost (in //extensions) to retrieve the JavaScriptDialogManager instance to use for the web contents owned by the ExtensionHost. In the //chrome implementation (the only real implementation), this forwards to javascript_dialogs::AppModalDialogManager::GetInstance(). This can be done directly at the //extensions layer, since //extensions can depend directly upon //components/javascript_dialogs. Remove ExtensionHostDelegate::GetJavaScriptDialogManager() and inline the usage directly in ExtensionHost. Bug: None Change-Id: I37fabc9734c2db80a28de655c315bf4027f0ee96 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6020106 Reviewed-by: Tim <tjudkins@chromium.org> Commit-Queue: Devlin Cronin <rdevlin.cronin@chromium.org> Cr-Commit-Position: refs/heads/main@{#1382663}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
9436aae00f
commit
e966de53c7
chrome/browser/extensions
extensions
@ -13,7 +13,6 @@
|
||||
#include "chrome/browser/media/webrtc/media_capture_devices_dispatcher.h"
|
||||
#include "chrome/browser/picture_in_picture/picture_in_picture_window_manager.h"
|
||||
#include "chrome/browser/ui/prefs/prefs_tab_helper.h"
|
||||
#include "components/javascript_dialogs/app_modal_dialog_manager.h"
|
||||
#include "extensions/browser/extension_host.h"
|
||||
#include "extensions/browser/extension_system.h"
|
||||
#include "extensions/browser/extensions_browser_client.h"
|
||||
@ -39,11 +38,6 @@ void ChromeExtensionHostDelegate::OnMainFrameCreatedForBackgroundPage(
|
||||
service->DidCreateMainFrameForBackgroundPage(host);
|
||||
}
|
||||
|
||||
content::JavaScriptDialogManager*
|
||||
ChromeExtensionHostDelegate::GetJavaScriptDialogManager() {
|
||||
return javascript_dialogs::AppModalDialogManager::GetInstance();
|
||||
}
|
||||
|
||||
void ChromeExtensionHostDelegate::CreateTab(
|
||||
std::unique_ptr<content::WebContents> web_contents,
|
||||
const ExtensionId& extension_id,
|
||||
|
@ -19,7 +19,6 @@ class ChromeExtensionHostDelegate : public ExtensionHostDelegate {
|
||||
// ExtensionHostDelegate implementation.
|
||||
void OnExtensionHostCreated(content::WebContents* web_contents) override;
|
||||
void OnMainFrameCreatedForBackgroundPage(ExtensionHost* host) override;
|
||||
content::JavaScriptDialogManager* GetJavaScriptDialogManager() override;
|
||||
void CreateTab(std::unique_ptr<content::WebContents> web_contents,
|
||||
const ExtensionId& extension_id,
|
||||
WindowOpenDisposition disposition,
|
||||
|
@ -21,13 +21,6 @@ void DesktopAndroidExtensionHostDelegate::OnExtensionHostCreated(
|
||||
void DesktopAndroidExtensionHostDelegate::OnMainFrameCreatedForBackgroundPage(
|
||||
ExtensionHost* host) {}
|
||||
|
||||
content::JavaScriptDialogManager*
|
||||
DesktopAndroidExtensionHostDelegate::GetJavaScriptDialogManager() {
|
||||
// TODO(crbug.com/373434594): Support dialogs.
|
||||
NOTIMPLEMENTED();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void DesktopAndroidExtensionHostDelegate::CreateTab(
|
||||
std::unique_ptr<content::WebContents> web_contents,
|
||||
const ExtensionId& extension_id,
|
||||
|
@ -22,7 +22,6 @@ class DesktopAndroidExtensionHostDelegate : public ExtensionHostDelegate {
|
||||
// ExtensionHostDelegate:
|
||||
void OnExtensionHostCreated(content::WebContents* web_contents) override;
|
||||
void OnMainFrameCreatedForBackgroundPage(ExtensionHost* host) override;
|
||||
content::JavaScriptDialogManager* GetJavaScriptDialogManager() override;
|
||||
void CreateTab(std::unique_ptr<content::WebContents> web_contents,
|
||||
const ExtensionId& extension_id,
|
||||
WindowOpenDisposition disposition,
|
||||
|
@ -517,6 +517,7 @@ source_set("browser_sources") {
|
||||
"//components/crx_file:crx_creator",
|
||||
"//components/guest_view/buildflags",
|
||||
"//components/input",
|
||||
"//components/javascript_dialogs",
|
||||
"//components/keyed_service/content",
|
||||
"//components/keyed_service/content:content",
|
||||
"//components/keyed_service/core",
|
||||
|
@ -5,6 +5,7 @@ include_rules = [
|
||||
"+components/crash/core",
|
||||
"+components/guest_view",
|
||||
"+components/input",
|
||||
"+components/javascript_dialogs",
|
||||
"+components/keyed_service",
|
||||
"+components/pref_registry",
|
||||
"+components/services/unzip/content",
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "base/timer/elapsed_timer.h"
|
||||
#include "components/input/native_web_keyboard_event.h"
|
||||
#include "components/javascript_dialogs/app_modal_dialog_manager.h"
|
||||
#include "content/public/browser/browser_context.h"
|
||||
#include "content/public/browser/content_browser_client.h"
|
||||
#include "content/public/browser/render_frame_host.h"
|
||||
@ -517,7 +518,7 @@ void ExtensionHost::OnEventAck(int event_id,
|
||||
|
||||
content::JavaScriptDialogManager* ExtensionHost::GetJavaScriptDialogManager(
|
||||
WebContents* source) {
|
||||
return delegate_->GetJavaScriptDialogManager();
|
||||
return javascript_dialogs::AppModalDialogManager::GetInstance();
|
||||
}
|
||||
|
||||
content::WebContents* ExtensionHost::AddNewContents(
|
||||
|
@ -14,7 +14,6 @@
|
||||
|
||||
namespace content {
|
||||
enum class PictureInPictureResult;
|
||||
class JavaScriptDialogManager;
|
||||
class RenderFrameHost;
|
||||
class WebContents;
|
||||
}
|
||||
@ -41,10 +40,6 @@ class ExtensionHostDelegate {
|
||||
// Called after |host| creates the renderer main frame for an extension.
|
||||
virtual void OnMainFrameCreatedForBackgroundPage(ExtensionHost* host) = 0;
|
||||
|
||||
// Returns the embedder's JavaScriptDialogManager or NULL if the embedder
|
||||
// does not support JavaScript dialogs.
|
||||
virtual content::JavaScriptDialogManager* GetJavaScriptDialogManager() = 0;
|
||||
|
||||
// Creates a new tab or popup window with |web_contents|. The embedder may
|
||||
// choose to do nothing if tabs and popups are not supported.
|
||||
virtual void CreateTab(std::unique_ptr<content::WebContents> web_contents,
|
||||
|
@ -23,13 +23,6 @@ void ShellExtensionHostDelegate::OnExtensionHostCreated(
|
||||
void ShellExtensionHostDelegate::OnMainFrameCreatedForBackgroundPage(
|
||||
ExtensionHost* host) {}
|
||||
|
||||
content::JavaScriptDialogManager*
|
||||
ShellExtensionHostDelegate::GetJavaScriptDialogManager() {
|
||||
// TODO(jamescook): Create a JavaScriptDialogManager or reuse the one from
|
||||
// content_shell.
|
||||
NOTREACHED();
|
||||
}
|
||||
|
||||
void ShellExtensionHostDelegate::CreateTab(
|
||||
std::unique_ptr<content::WebContents> web_contents,
|
||||
const ExtensionId& extension_id,
|
||||
|
@ -24,7 +24,6 @@ class ShellExtensionHostDelegate : public ExtensionHostDelegate {
|
||||
// ExtensionHostDelegate implementation.
|
||||
void OnExtensionHostCreated(content::WebContents* web_contents) override;
|
||||
void OnMainFrameCreatedForBackgroundPage(ExtensionHost* host) override;
|
||||
content::JavaScriptDialogManager* GetJavaScriptDialogManager() override;
|
||||
void CreateTab(std::unique_ptr<content::WebContents> web_contents,
|
||||
const ExtensionId& extension_id,
|
||||
WindowOpenDisposition disposition,
|
||||
|
Reference in New Issue
Block a user