Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(341)

Side by Side Diff: headless/lib/browser/headless_web_contents_impl.cc

Issue 2566583002: Change allowed bindings to be per RenderFrame instead of per RenderView. (Closed)
Patch Set: rebase Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "headless/lib/browser/headless_web_contents_impl.h" 5 #include "headless/lib/browser/headless_web_contents_impl.h"
6 6
7 #include <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 166
167 HeadlessWebContentsImpl::~HeadlessWebContentsImpl() { 167 HeadlessWebContentsImpl::~HeadlessWebContentsImpl() {
168 web_contents_->Close(); 168 web_contents_->Close();
169 if (render_process_host_) 169 if (render_process_host_)
170 render_process_host_->RemoveObserver(this); 170 render_process_host_->RemoveObserver(this);
171 } 171 }
172 172
173 void HeadlessWebContentsImpl::RenderFrameCreated( 173 void HeadlessWebContentsImpl::RenderFrameCreated(
174 content::RenderFrameHost* render_frame_host) { 174 content::RenderFrameHost* render_frame_host) {
175 if (!mojo_services_.empty()) { 175 if (!mojo_services_.empty()) {
176 render_frame_host->GetRenderViewHost()->AllowBindings( 176 render_frame_host->AllowBindings(content::BINDINGS_POLICY_HEADLESS);
177 content::BINDINGS_POLICY_HEADLESS);
178 } 177 }
179 178
180 service_manager::InterfaceRegistry* interface_registry = 179 service_manager::InterfaceRegistry* interface_registry =
181 render_frame_host->GetInterfaceRegistry(); 180 render_frame_host->GetInterfaceRegistry();
182 181
183 for (const MojoService& service : mojo_services_) { 182 for (const MojoService& service : mojo_services_) {
184 interface_registry->AddInterface(service.service_name, 183 interface_registry->AddInterface(service.service_name,
185 service.service_factory, 184 service.service_factory,
186 browser()->BrowserMainThread()); 185 browser()->BrowserMainThread());
187 } 186 }
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 HeadlessWebContents::Builder::MojoService::MojoService() {} 307 HeadlessWebContents::Builder::MojoService::MojoService() {}
309 308
310 HeadlessWebContents::Builder::MojoService::MojoService( 309 HeadlessWebContents::Builder::MojoService::MojoService(
311 const std::string& service_name, 310 const std::string& service_name,
312 const base::Callback<void(mojo::ScopedMessagePipeHandle)>& service_factory) 311 const base::Callback<void(mojo::ScopedMessagePipeHandle)>& service_factory)
313 : service_name(service_name), service_factory(service_factory) {} 312 : service_name(service_name), service_factory(service_factory) {}
314 313
315 HeadlessWebContents::Builder::MojoService::~MojoService() {} 314 HeadlessWebContents::Builder::MojoService::~MojoService() {}
316 315
317 } // namespace headless 316 } // namespace headless
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698