GuestView: Move GuestViewManager extension dependencies to ExtensionsGuestViewManagerDelegate
The CL does the following:
1. Replace GuestViewManager::FromBrowserContext with GuestViewManager::CreateWithDelegate.
2. Rename GuestViewManager::FromBrowserContextIfAvailable to GuestViewManager::FromBrowserContxt.
3. Creates a GuestViewManagerDelegate interface and ExtensionsGuestViewManagerDelegate.
4. GuestViewManager is created with a particular delegate implementation.
5. GuestView permission checks and registration is moved to the ExtensionsGuestViewDelegate.
6. owner_extension_id() is renamed to owner_host().
After this patch the following classes can be moved to Components (once GuestViewEvent is decoupled from EventRouter):
1. GuestViewManager
2. GuestViewManagerDelegate
3. GuestViewBase
4. GuestViewMessageFilter
5. GuestView
BUG=444869
[email protected] for chrome/browser/profiles, [email protected] chrome/browser/chromeos/login, [email protected] for chrome/browser/printing.
Review URL: https://codereview.chromium.org/1066563006
Cr-Commit-Position: refs/heads/master@{#326774}
diff --git a/extensions/browser/guest_view/guest_view_base.h b/extensions/browser/guest_view/guest_view_base.h
index 7969cb9..6252e6c 100644
--- a/extensions/browser/guest_view/guest_view_base.h
+++ b/extensions/browser/guest_view/guest_view_base.h
@@ -241,14 +241,6 @@
// Returns the instance ID of the GuestViewBase's element.
int element_instance_id() const { return element_instance_id_; }
- // Returns the extension ID of the embedder.
- const std::string& owner_extension_id() const {
- return owner_extension_id_;
- }
-
- // Returns whether this GuestView is embedded in an extension/app.
- bool in_extension() const { return !owner_extension_id_.empty(); }
-
bool can_owner_receive_events() const { return !!view_instance_id_; }
// Returns the user browser context of the embedder.
@@ -261,6 +253,10 @@
// Returns the URL of the owner WebContents.
const GURL& GetOwnerSiteURL() const;
+ // Returns the host of the owner WebContents. For extensions, this is the
+ // extension ID.
+ std::string owner_host() const { return owner_host_; }
+
// Whether the guest view is inside a plugin document.
bool is_full_page_plugin() const { return is_full_page_plugin_; }
@@ -381,7 +377,7 @@
// |owner_web_contents_|. If |owner_web_contents_| is destroyed then this
// guest will also self-destruct.
content::WebContents* owner_web_contents_;
- std::string owner_extension_id_;
+ std::string owner_host_;
content::BrowserContext* const browser_context_;
// |guest_instance_id_| is a profile-wide unique identifier for a guest