Avoid calling GetWebContentsFromProcessID for twice
This commit is contained in:
Родитель
b0faa62f76
Коммит
14c4be50c1
|
@ -287,29 +287,23 @@ brightray::BrowserMainParts* AtomBrowserClient::OverrideCreateBrowserMainParts(
|
|||
|
||||
void AtomBrowserClient::WebNotificationAllowed(
|
||||
int render_process_id,
|
||||
const base::Callback<void(bool)>& callback) {
|
||||
const base::Callback<void(bool, bool)>& callback) {
|
||||
content::WebContents* web_contents =
|
||||
WebContentsPreferences::GetWebContentsFromProcessID(render_process_id);
|
||||
if (!web_contents) {
|
||||
callback.Run(false);
|
||||
callback.Run(false, false);
|
||||
return;
|
||||
}
|
||||
auto permission_helper =
|
||||
WebContentsPermissionHelper::FromWebContents(web_contents);
|
||||
if (!permission_helper) {
|
||||
callback.Run(false);
|
||||
callback.Run(false, false);
|
||||
return;
|
||||
}
|
||||
permission_helper->RequestWebNotificationPermission(callback);
|
||||
permission_helper->RequestWebNotificationPermission(
|
||||
base::Bind(callback, web_contents->IsAudioMuted()));
|
||||
}
|
||||
|
||||
bool AtomBrowserClient::WebContentsAudioMuted(
|
||||
int render_process_id) {
|
||||
content::WebContents* web_contents =
|
||||
WebContentsPreferences::GetWebContentsFromProcessID(render_process_id);
|
||||
return web_contents->IsAudioMuted();
|
||||
}
|
||||
|
||||
void AtomBrowserClient::RenderProcessHostDestroyed(
|
||||
content::RenderProcessHost* host) {
|
||||
int process_id = host->GetID();
|
||||
|
|
|
@ -100,9 +100,7 @@ class AtomBrowserClient : public brightray::BrowserClient,
|
|||
const content::MainFunctionParams&) override;
|
||||
void WebNotificationAllowed(
|
||||
int render_process_id,
|
||||
const base::Callback<void(bool)>& callback) override;
|
||||
bool WebContentsAudioMuted(
|
||||
int render_process_id) override;
|
||||
const base::Callback<void(bool, bool)>& callback) override;
|
||||
|
||||
// content::RenderProcessHostObserver:
|
||||
void RenderProcessHostDestroyed(content::RenderProcessHost* host) override;
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit f9bc45b03c94a2db729b53885691db5e04b757df
|
||||
Subproject commit 0e8ffb4d653f9e85722bc98df7ddde9a0e6d0650
|
Загрузка…
Ссылка в новой задаче