OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 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 "mojo/public/cpp/bindings/associated_interface_request.h" |
| 8 |
| 9 namespace content { |
| 10 |
| 11 // Helper class which test code can use with |
| 12 // WebContentsImpl::OverrideBinderForTesting() in order to override |
| 13 // WebContentsBindingSet interface binding behavior in tests. |
| 14 template <typename Interface> |
| 15 class WebContentsBindingSetTestBinder : public WebContentsBindingSet::Binder { |
| 16 public: |
| 17 ~WebContentsBindingSetTestBinder() override {} |
| 18 |
| 19 // Call for every new incoming interface request for a frame. |
| 20 virtual void BindRequest( |
| 21 RenderFrameHost* render_frame_host, |
| 22 mojo::AssociatedInterfaceRequest<Interface> request) = 0; |
| 23 |
| 24 private: |
| 25 // Binder: |
| 26 void OnRequestForFrame(RenderFrameHost* render_frame_host, |
| 27 mojo::ScopedInterfaceEndpointHandle handle) override { |
| 28 mojo::AssociatedInterfaceRequest<Interface> request; |
| 29 request.Bind(std::move(handle)); |
| 30 BindRequest(render_frame_host, std::move(request)); |
| 31 } |
| 32 }; |
| 33 |
| 34 } // namespace content |
OLD | NEW |