| Index: extensions/browser/guest_view/guest_view_manager.h
|
| diff --git a/extensions/browser/guest_view/guest_view_manager.h b/extensions/browser/guest_view/guest_view_manager.h
|
| index ae3fc7e99442a68509222eebb1f234627689cfc7..626b583860baabf452b1839ffd78d510ecebf66c 100644
|
| --- a/extensions/browser/guest_view/guest_view_manager.h
|
| +++ b/extensions/browser/guest_view/guest_view_manager.h
|
| @@ -7,6 +7,7 @@
|
|
|
| #include <map>
|
|
|
| +#include "base/bind.h"
|
| #include "base/gtest_prod_util.h"
|
| #include "base/lazy_instance.h"
|
| #include "base/macros.h"
|
| @@ -71,6 +72,13 @@ class GuestViewManager : public content::BrowserPluginGuestManager,
|
| int owner_process_id,
|
| int element_instance_id);
|
|
|
| + template <typename T>
|
| + void RegisterGuestViewType() {
|
| + auto it = guest_view_registry_.find(T::Type);
|
| + DCHECK(it == guest_view_registry_.end());
|
| + guest_view_registry_[T::Type] = base::Bind(&T::Create);
|
| + }
|
| +
|
| using WebContentsCreatedCallback =
|
| base::Callback<void(content::WebContents*)>;
|
| void CreateGuest(const std::string& view_type,
|
| @@ -106,6 +114,13 @@ class GuestViewManager : public content::BrowserPluginGuestManager,
|
| // Can be overriden in tests.
|
| virtual void RemoveGuest(int guest_instance_id);
|
|
|
| + // Creates a guest of the provided |view_type|.
|
| + GuestViewBase* CreateGuestInternal(content::WebContents* owner_web_contents,
|
| + const std::string& view_type);
|
| +
|
| + // Adds GuestView types to the GuestView registry.
|
| + void RegisterGuestViewTypes();
|
| +
|
| // Indicates whether the provided |guest| can be used in the context it has
|
| // been created.
|
| bool IsGuestAvailableToContext(GuestViewBase* guest,
|
| @@ -155,6 +170,12 @@ class GuestViewManager : public content::BrowserPluginGuestManager,
|
| using GuestInstanceIDReverseMap = std::map<int, ElementInstanceKey>;
|
| GuestInstanceIDReverseMap reverse_instance_id_map_;
|
|
|
| + using GuestCreationCallback =
|
| + base::Callback<GuestViewBase*(content::WebContents*)>;
|
| + using GuestViewCreationMap =
|
| + std::map<std::string, GuestViewManager::GuestCreationCallback>;
|
| + GuestViewCreationMap guest_view_registry_;
|
| +
|
| int current_instance_id_;
|
|
|
| // Any instance ID whose number not greater than this was removed via
|
|
|