restructure code to use web_preferences if possible

This commit is contained in:
Heilig Benedek 2017-11-02 22:50:04 +01:00 committed by Cheng Zhao
parent cafb9477b0
commit f8b3009ebf
16 changed files with 88 additions and 47 deletions

View file

@ -933,10 +933,9 @@ bool WebContents::OnMessageReceived(const IPC::Message& message,
auto relay = NativeWindowRelay::FromWebContents(web_contents());
if (!relay)
return false;
IPC_BEGIN_MESSAGE_MAP_WITH_PARAM(WebContents, message, frame_host)
IPC_MESSAGE_HANDLER(AtomAutofillFrameHostMsg_ShowPopup, ShowAutofillPopup)
IPC_END_MESSAGE_MAP()
IPC_BEGIN_MESSAGE_MAP_WITH_PARAM(NativeWindow, message, frame_host)
IPC_MESSAGE_FORWARD(AtomAutofillFrameHostMsg_ShowPopup,
relay->window.get(), NativeWindow::ShowAutofillPopup)
IPC_MESSAGE_FORWARD(AtomAutofillFrameHostMsg_HidePopup,
relay->window.get(), NativeWindow::HideAutofillPopup)
IPC_MESSAGE_UNHANDLED(handled = false)
@ -945,16 +944,6 @@ bool WebContents::OnMessageReceived(const IPC::Message& message,
return handled;
}
void WebContents::ShowAutofillPopup(
content::RenderFrameHost* frame_host,
const gfx::RectF& bounds,
const std::vector<base::string16>& values,
const std::vector<base::string16>& labels) {
auto relay = NativeWindowRelay::FromWebContents(web_contents());
if (relay)
relay->window->ShowAutofillPopup(frame_host, this, bounds, values, labels);
}
// There are three ways of destroying a webContents:
// 1. call webContents.destroy();
// 2. garbage collection;
@ -1634,10 +1623,6 @@ bool WebContents::IsOffScreen() const {
#endif
}
bool WebContents::IsOffScreenOrEmbedderOffscreen() const {
return IsOffScreen() || (IsGuest() && embedder_ && embedder_->IsOffScreen());
}
void WebContents::OnPaint(const gfx::Rect& dirty_rect, const SkBitmap& bitmap) {
Emit("paint", dirty_rect, gfx::Image::CreateFrom1xBitmap(bitmap));
}