OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "content/public/browser/web_contents_binding_set.h" |
| 6 |
| 7 #include <utility> |
| 8 |
| 9 #include "base/logging.h" |
| 10 #include "content/browser/web_contents/web_contents_impl.h" |
| 11 |
| 12 namespace content { |
| 13 |
| 14 void WebContentsBindingSet::Binder::OnRequestForFrame( |
| 15 RenderFrameHost* render_frame_host, |
| 16 mojo::ScopedInterfaceEndpointHandle handle) { |
| 17 NOTREACHED(); |
| 18 } |
| 19 |
| 20 WebContentsBindingSet::WebContentsBindingSet(WebContents* web_contents, |
| 21 const std::string& interface_name, |
| 22 std::unique_ptr<Binder> binder) |
| 23 : remove_callback_( |
| 24 static_cast<WebContentsImpl*>(web_contents)->AddBindingSet( |
| 25 interface_name, this)), |
| 26 binder_(std::move(binder)) {} |
| 27 |
| 28 WebContentsBindingSet::~WebContentsBindingSet() { |
| 29 remove_callback_.Run(); |
| 30 } |
| 31 |
| 32 void WebContentsBindingSet::CloseAllBindings() { |
| 33 binder_.reset(); |
| 34 } |
| 35 |
| 36 void WebContentsBindingSet::OnRequestForFrame( |
| 37 RenderFrameHost* render_frame_host, |
| 38 mojo::ScopedInterfaceEndpointHandle handle) { |
| 39 DCHECK(binder_); |
| 40 binder_->OnRequestForFrame(render_frame_host, std::move(handle)); |
| 41 } |
| 42 |
| 43 } // namespace content |
OLD | NEW |