2929#include " atom/browser/web_contents_preferences.h"
3030#include " atom/browser/web_contents_zoom_controller.h"
3131#include " atom/browser/web_view_guest_delegate.h"
32- #include " atom/common/api/api_messages.h"
3332#include " atom/common/api/atom_api_native_image.h"
3433#include " atom/common/api/event_emitter_caller.h"
3534#include " atom/common/color_util.h"
@@ -570,9 +569,7 @@ void WebContents::SetContentsBounds(content::WebContents* source,
570569
571570void WebContents::CloseContents (content::WebContents* source) {
572571 Emit (" close" );
573- #if defined(TOOLKIT_VIEWS)
574572 HideAutofillPopup ();
575- #endif
576573 if (managed_web_contents ())
577574 managed_web_contents ()->GetView ()->SetDelegate (nullptr );
578575 for (ExtendedWebContentsObserver& observer : observers_)
@@ -1095,7 +1092,6 @@ void WebContents::DevToolsClosed() {
10951092 Emit (" devtools-closed" );
10961093}
10971094
1098- #if defined(TOOLKIT_VIEWS)
10991095void WebContents::ShowAutofillPopup (content::RenderFrameHost* frame_host,
11001096 const gfx::RectF& bounds,
11011097 const std::vector<base::string16>& values,
@@ -1115,7 +1111,6 @@ void WebContents::ShowAutofillPopup(content::RenderFrameHost* frame_host,
11151111 CommonWebContentsDelegate::ShowAutofillPopup (
11161112 frame_host, embedder_frame_host, offscreen, popup_bounds, values, labels);
11171113}
1118- #endif
11191114
11201115bool WebContents::OnMessageReceived (const IPC::Message& message) {
11211116 bool handled = true ;
@@ -1128,20 +1123,6 @@ bool WebContents::OnMessageReceived(const IPC::Message& message) {
11281123 return handled;
11291124}
11301125
1131- bool WebContents::OnMessageReceived (const IPC::Message& message,
1132- content::RenderFrameHost* frame_host) {
1133- bool handled = true ;
1134- IPC_BEGIN_MESSAGE_MAP_WITH_PARAM (WebContents, message, frame_host)
1135- #if defined(TOOLKIT_VIEWS)
1136- IPC_MESSAGE_HANDLER (AtomAutofillFrameHostMsg_ShowPopup, ShowAutofillPopup)
1137- IPC_MESSAGE_HANDLER (AtomAutofillFrameHostMsg_HidePopup, HideAutofillPopup)
1138- #endif
1139- IPC_MESSAGE_UNHANDLED (handled = false )
1140- IPC_END_MESSAGE_MAP ()
1141-
1142- return handled;
1143- }
1144-
11451126// There are three ways of destroying a webContents:
11461127// 1. call webContents.destroy();
11471128// 2. garbage collection;
@@ -2031,6 +2012,17 @@ void WebContents::DoGetZoomLevel(DoGetZoomLevelCallback callback) {
20312012 std::move (callback).Run (GetZoomLevel ());
20322013}
20332014
2015+ void WebContents::ShowAutofillPopup (const gfx::RectF& bounds,
2016+ const std::vector<base::string16>& values,
2017+ const std::vector<base::string16>& labels) {
2018+ content::RenderFrameHost* frame_host = bindings_.dispatch_context ();
2019+ ShowAutofillPopup (frame_host, bounds, values, labels);
2020+ }
2021+
2022+ void WebContents::HideAutofillPopup () {
2023+ CommonWebContentsDelegate::HideAutofillPopup ();
2024+ }
2025+
20342026v8::Local<v8::Value> WebContents::GetPreloadPath (v8::Isolate* isolate) const {
20352027 if (auto * web_preferences = WebContentsPreferences::From (web_contents ())) {
20362028 base::FilePath::StringType preload;
0 commit comments