pass on web_contents to properly handle devtools
This commit is contained in:
parent
573f664899
commit
276e12ce71
5 changed files with 28 additions and 7 deletions
|
@ -770,7 +770,7 @@ void WebContents::DidChangeThemeColor(SkColor theme_color) {
|
||||||
if (theme_color != SK_ColorTRANSPARENT) {
|
if (theme_color != SK_ColorTRANSPARENT) {
|
||||||
Emit("did-change-theme-color", atom::ToRGBHex(theme_color));
|
Emit("did-change-theme-color", atom::ToRGBHex(theme_color));
|
||||||
} else {
|
} else {
|
||||||
Emit("did-change-theme-color", nullptr);
|
Emit("did-change-theme-color", atom::ToRGBHex(SK_ColorTRANSPARENT));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -933,9 +933,10 @@ bool WebContents::OnMessageReceived(const IPC::Message& message,
|
||||||
auto relay = NativeWindowRelay::FromWebContents(web_contents());
|
auto relay = NativeWindowRelay::FromWebContents(web_contents());
|
||||||
if (!relay)
|
if (!relay)
|
||||||
return false;
|
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_BEGIN_MESSAGE_MAP_WITH_PARAM(NativeWindow, message, frame_host)
|
||||||
IPC_MESSAGE_FORWARD(AtomAutofillFrameHostMsg_ShowPopup,
|
|
||||||
relay->window.get(), NativeWindow::ShowAutofillPopup)
|
|
||||||
IPC_MESSAGE_FORWARD(AtomAutofillFrameHostMsg_HidePopup,
|
IPC_MESSAGE_FORWARD(AtomAutofillFrameHostMsg_HidePopup,
|
||||||
relay->window.get(), NativeWindow::HideAutofillPopup)
|
relay->window.get(), NativeWindow::HideAutofillPopup)
|
||||||
IPC_MESSAGE_UNHANDLED(handled = false)
|
IPC_MESSAGE_UNHANDLED(handled = false)
|
||||||
|
@ -944,6 +945,17 @@ bool WebContents::OnMessageReceived(const IPC::Message& message,
|
||||||
return handled;
|
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, web_contents(), bounds, values, labels);
|
||||||
|
}
|
||||||
|
|
||||||
// There are three ways of destroying a webContents:
|
// There are three ways of destroying a webContents:
|
||||||
// 1. call webContents.destroy();
|
// 1. call webContents.destroy();
|
||||||
// 2. garbage collection;
|
// 2. garbage collection;
|
||||||
|
|
|
@ -357,6 +357,12 @@ class WebContents : public mate::TrackableObject<WebContents>,
|
||||||
void DevToolsOpened() override;
|
void DevToolsOpened() override;
|
||||||
void DevToolsClosed() override;
|
void DevToolsClosed() override;
|
||||||
|
|
||||||
|
void ShowAutofillPopup(
|
||||||
|
content::RenderFrameHost* frame_host,
|
||||||
|
const gfx::RectF& bounds,
|
||||||
|
const std::vector<base::string16>& values,
|
||||||
|
const std::vector<base::string16>& labels);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AtomBrowserContext* GetBrowserContext() const;
|
AtomBrowserContext* GetBrowserContext() const;
|
||||||
|
|
||||||
|
|
|
@ -232,6 +232,7 @@ class NativeWindow : public base::SupportsUserData,
|
||||||
const content::NativeWebKeyboardEvent& event) {}
|
const content::NativeWebKeyboardEvent& event) {}
|
||||||
virtual void ShowAutofillPopup(
|
virtual void ShowAutofillPopup(
|
||||||
content::RenderFrameHost* frame_host,
|
content::RenderFrameHost* frame_host,
|
||||||
|
content::WebContents* web_contents,
|
||||||
const gfx::RectF& bounds,
|
const gfx::RectF& bounds,
|
||||||
const std::vector<base::string16>& values,
|
const std::vector<base::string16>& values,
|
||||||
const std::vector<base::string16>& labels) {}
|
const std::vector<base::string16>& labels) {}
|
||||||
|
|
|
@ -1358,15 +1358,16 @@ void NativeWindowViews::HandleKeyboardEvent(
|
||||||
|
|
||||||
void NativeWindowViews::ShowAutofillPopup(
|
void NativeWindowViews::ShowAutofillPopup(
|
||||||
content::RenderFrameHost* frame_host,
|
content::RenderFrameHost* frame_host,
|
||||||
|
content::WebContents* web_contents,
|
||||||
const gfx::RectF& bounds,
|
const gfx::RectF& bounds,
|
||||||
const std::vector<base::string16>& values,
|
const std::vector<base::string16>& values,
|
||||||
const std::vector<base::string16>& labels) {
|
const std::vector<base::string16>& labels) {
|
||||||
WebContentsPreferences* web_preferences =
|
WebContentsPreferences* web_preferences =
|
||||||
WebContentsPreferences::FromWebContents(web_contents());
|
WebContentsPreferences::FromWebContents(web_contents);
|
||||||
|
|
||||||
bool isOffsceen = web_preferences->IsOffScreen(web_contents());
|
bool isOffsceen = web_preferences->IsOffScreen(web_contents);
|
||||||
bool isEmbedderOffscreen = web_preferences->IsGuest(web_contents()) &&
|
bool isEmbedderOffscreen = web_preferences->IsGuest(web_contents) &&
|
||||||
web_preferences->IsOffScreen(web_preferences->Embedder(web_contents()));
|
web_preferences->IsOffScreen(web_preferences->Embedder(web_contents));
|
||||||
|
|
||||||
autofill_popup_->CreateView(
|
autofill_popup_->CreateView(
|
||||||
frame_host,
|
frame_host,
|
||||||
|
|
|
@ -190,6 +190,7 @@ class NativeWindowViews : public NativeWindow,
|
||||||
const content::NativeWebKeyboardEvent& event) override;
|
const content::NativeWebKeyboardEvent& event) override;
|
||||||
void ShowAutofillPopup(
|
void ShowAutofillPopup(
|
||||||
content::RenderFrameHost* frame_host,
|
content::RenderFrameHost* frame_host,
|
||||||
|
content::WebContents* web_contents,
|
||||||
const gfx::RectF& bounds,
|
const gfx::RectF& bounds,
|
||||||
const std::vector<base::string16>& values,
|
const std::vector<base::string16>& values,
|
||||||
const std::vector<base::string16>& labels) override;
|
const std::vector<base::string16>& labels) override;
|
||||||
|
|
Loading…
Reference in a new issue