OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef COMPONENTS_FRAMELET_BROWSER_FRAMELET_FACTORY_IMPL_H_ |
| 6 #define COMPONENTS_FRAMELET_BROWSER_FRAMELET_FACTORY_IMPL_H_ |
| 7 |
| 8 #include "base/callback.h" |
| 9 #include "base/memory/weak_ptr.h" |
| 10 #include "components/framelet/common/framelet.mojom.h" |
| 11 #include "components/guest_view/browser/guest_view_manager_delegate.h" |
| 12 #include "mojo/public/cpp/bindings/strong_binding.h" |
| 13 |
| 14 namespace content { |
| 15 class RenderFrameHost; |
| 16 class WebContents; |
| 17 } |
| 18 |
| 19 namespace guest_view { |
| 20 class GuestViewManager; |
| 21 } |
| 22 |
| 23 namespace framelet { |
| 24 |
| 25 class FrameletFactoryImpl : public mojom::FrameletFactory { |
| 26 public: |
| 27 using CreateGuestViewManagerDelegate = |
| 28 base::Callback<guest_view::GuestViewManagerDelegate*()>; |
| 29 |
| 30 FrameletFactoryImpl(content::WebContents* owner_web_contents, |
| 31 const CreateGuestViewManagerDelegate& create_delegate, |
| 32 mojo::InterfaceRequest<FrameletFactory> factory_request); |
| 33 ~FrameletFactoryImpl() override; |
| 34 |
| 35 static void CreateService( |
| 36 content::RenderFrameHost* render_frame_host, |
| 37 const CreateGuestViewManagerDelegate& create_delegate, |
| 38 mojo::InterfaceRequest<FrameletFactory> factory_request); |
| 39 |
| 40 private: |
| 41 guest_view::GuestViewManager* GetOrCreateGuestViewManager(); |
| 42 |
| 43 static void FrameletCreatedCallback( |
| 44 mojo::InterfaceRequest<mojom::Framelet> framelet, |
| 45 content::WebContents* guest_web_contents); |
| 46 |
| 47 // FrameletFactory |
| 48 void Create(mojo::InterfaceRequest<mojom::Framelet> request, |
| 49 mojo::Map<mojo::String, mojom::ValuePtr> params) override; |
| 50 |
| 51 content::WebContents* const owner_web_contents_; |
| 52 CreateGuestViewManagerDelegate create_delegate_; |
| 53 mojo::StrongBinding<mojom::FrameletFactory> binding_; |
| 54 base::WeakPtrFactory<FrameletFactoryImpl> weak_ptr_factory_; |
| 55 |
| 56 DISALLOW_COPY_AND_ASSIGN(FrameletFactoryImpl); |
| 57 }; |
| 58 |
| 59 } // namespace framelet |
| 60 |
| 61 #endif // COMPONENTS_FRAMELET_BROWSER_FRAMELET_FACTORY_IMPL_H_ |
OLD | NEW |