Index: components/framelet/browser/framelet_factory_impl.h |
diff --git a/components/framelet/browser/framelet_factory_impl.h b/components/framelet/browser/framelet_factory_impl.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..418c25805ad5db8b7c4bdf63f3bc5e6db4920f77 |
--- /dev/null |
+++ b/components/framelet/browser/framelet_factory_impl.h |
@@ -0,0 +1,61 @@ |
+// Copyright 2015 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef COMPONENTS_FRAMELET_BROWSER_FRAMELET_FACTORY_IMPL_H_ |
+#define COMPONENTS_FRAMELET_BROWSER_FRAMELET_FACTORY_IMPL_H_ |
+ |
+#include "base/callback.h" |
+#include "base/memory/weak_ptr.h" |
+#include "components/framelet/common/framelet.mojom.h" |
+#include "components/guest_view/browser/guest_view_manager_delegate.h" |
+#include "mojo/public/cpp/bindings/strong_binding.h" |
+ |
+namespace content { |
+class RenderFrameHost; |
+class WebContents; |
+} |
+ |
+namespace guest_view { |
+class GuestViewManager; |
+} |
+ |
+namespace framelet { |
+ |
+class FrameletFactoryImpl : public mojom::FrameletFactory { |
+ public: |
+ using CreateGuestViewManagerDelegate = |
+ base::Callback<guest_view::GuestViewManagerDelegate*()>; |
+ |
+ FrameletFactoryImpl(content::WebContents* owner_web_contents, |
+ const CreateGuestViewManagerDelegate& create_delegate, |
+ mojo::InterfaceRequest<FrameletFactory> factory_request); |
+ ~FrameletFactoryImpl() override; |
+ |
+ static void CreateService( |
+ content::RenderFrameHost* render_frame_host, |
+ const CreateGuestViewManagerDelegate& create_delegate, |
+ mojo::InterfaceRequest<FrameletFactory> factory_request); |
+ |
+ private: |
+ guest_view::GuestViewManager* GetOrCreateGuestViewManager(); |
+ |
+ static void FrameletCreatedCallback( |
+ mojo::InterfaceRequest<mojom::Framelet> framelet, |
+ content::WebContents* guest_web_contents); |
+ |
+ // FrameletFactory |
+ void Create(mojo::InterfaceRequest<mojom::Framelet> request, |
+ mojo::Map<mojo::String, mojom::ValuePtr> params) override; |
+ |
+ content::WebContents* const owner_web_contents_; |
+ CreateGuestViewManagerDelegate create_delegate_; |
+ mojo::StrongBinding<mojom::FrameletFactory> binding_; |
+ base::WeakPtrFactory<FrameletFactoryImpl> weak_ptr_factory_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(FrameletFactoryImpl); |
+}; |
+ |
+} // namespace framelet |
+ |
+#endif // COMPONENTS_FRAMELET_BROWSER_FRAMELET_FACTORY_IMPL_H_ |