Service CreateNewWindow on the UI thread with a new mojo interface

https://codereview.chromium.org/2821473002
This commit is contained in:
Aleksei Kuzmin 2017-08-05 00:38:06 +03:00 committed by Cheng Zhao
parent b81ae1c36f
commit ee9a547985
4 changed files with 8 additions and 15 deletions

View file

@ -656,14 +656,11 @@ void App::OnCreateWindow(
WindowOpenDisposition disposition,
const std::vector<std::string>& features,
const scoped_refptr<content::ResourceRequestBody>& body,
int render_process_id,
int render_frame_id) {
content::RenderFrameHost* opener) {
v8::Locker locker(isolate());
v8::HandleScope handle_scope(isolate());
content::RenderFrameHost* rfh =
content::RenderFrameHost::FromID(render_process_id, render_frame_id);
content::WebContents* web_contents =
content::WebContents::FromRenderFrameHost(rfh);
content::WebContents::FromRenderFrameHost(opener);
if (web_contents) {
auto api_web_contents = WebContents::CreateFrom(isolate(), web_contents);
api_web_contents->OnCreateWindow(target_url,

View file

@ -81,8 +81,7 @@ class App : public AtomBrowserClient::Delegate,
WindowOpenDisposition disposition,
const std::vector<std::string>& features,
const scoped_refptr<content::ResourceRequestBody>& body,
int render_process_id,
int render_frame_id);
content::RenderFrameHost* opener);
#if defined(USE_NSS_CERTS)
void OnCertificateManagerModelCreated(

View file

@ -333,8 +333,7 @@ void AtomBrowserClient::ResourceDispatcherHostCreated() {
}
bool AtomBrowserClient::CanCreateWindow(
int opener_render_process_id,
int opener_render_frame_id,
content::RenderFrameHost* opener,
const GURL& opener_url,
const GURL& opener_top_level_frame_url,
const GURL& source_origin,
@ -348,10 +347,11 @@ bool AtomBrowserClient::CanCreateWindow(
const scoped_refptr<content::ResourceRequestBody>& body,
bool user_gesture,
bool opener_suppressed,
content::ResourceContext* context,
bool* no_javascript_access) {
DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
int opener_render_process_id = opener->GetProcess()->GetID();
if (IsRendererSandboxed(opener_render_process_id)) {
*no_javascript_access = false;
return true;
@ -377,8 +377,7 @@ bool AtomBrowserClient::CanCreateWindow(
disposition,
additional_features,
body,
opener_render_process_id,
opener_render_frame_id));
opener));
}
return false;

View file

@ -81,8 +81,7 @@ class AtomBrowserClient : public brightray::BrowserClient,
std::unique_ptr<content::ClientCertificateDelegate> delegate) override;
void ResourceDispatcherHostCreated() override;
bool CanCreateWindow(
int opener_render_process_id,
int opener_render_frame_id,
content::RenderFrameHost* opener,
const GURL& opener_url,
const GURL& opener_top_level_frame_url,
const GURL& source_origin,
@ -96,7 +95,6 @@ class AtomBrowserClient : public brightray::BrowserClient,
const scoped_refptr<content::ResourceRequestBody>& body,
bool user_gesture,
bool opener_suppressed,
content::ResourceContext* context,
bool* no_javascript_access) override;
void GetAdditionalAllowedSchemesForFileSystem(
std::vector<std::string>* schemes) override;