Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4765)

Unified Diff: chrome/browser/extensions/tab_helper.h

Issue 2791533002: Convert Web Store Inline Install IPCs to mojo (Closed)
Patch Set: Addressed Devlin's comments Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/extensions/BUILD.gn ('k') | chrome/browser/extensions/tab_helper.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/tab_helper.h
diff --git a/chrome/browser/extensions/tab_helper.h b/chrome/browser/extensions/tab_helper.h
index 09b09f624bd269a2d72796b2f860d94cb4d2ce77..c0df70eb3e5002f607eb385874f6986c613bdb64 100644
--- a/chrome/browser/extensions/tab_helper.h
+++ b/chrome/browser/extensions/tab_helper.h
@@ -16,10 +16,12 @@
#include "base/scoped_observer.h"
#include "chrome/browser/extensions/active_tab_permission_granter.h"
#include "chrome/browser/extensions/extension_reenabler.h"
+#include "chrome/common/extensions/mojom/inline_install.mojom.h"
#include "chrome/common/extensions/webstore_install_result.h"
#include "chrome/common/web_application_info.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
+#include "content/public/browser/web_contents_binding_set.h"
#include "content/public/browser/web_contents_observer.h"
#include "content/public/browser/web_contents_user_data.h"
#include "extensions/browser/extension_function_dispatcher.h"
@@ -45,7 +47,8 @@ class TabHelper : public content::WebContentsObserver,
public ExtensionFunctionDispatcher::Delegate,
public ExtensionRegistryObserver,
public content::NotificationObserver,
- public content::WebContentsUserData<TabHelper> {
+ public content::WebContentsUserData<TabHelper>,
+ public mojom::InlineInstaller {
public:
~TabHelper() override;
@@ -128,10 +131,11 @@ class TabHelper : public content::WebContentsObserver,
};
explicit TabHelper(content::WebContents* web_contents);
+
friend class content::WebContentsUserData<TabHelper>;
// Displays UI for completion of creating a bookmark hosted app.
- void FinishCreateBookmarkApp(const extensions::Extension* extension,
+ void FinishCreateBookmarkApp(const Extension* extension,
const WebApplicationInfo& web_app_info);
// content::WebContentsObserver overrides.
@@ -145,8 +149,8 @@ class TabHelper : public content::WebContentsObserver,
content::WebContents* old_web_contents,
content::WebContents* new_web_contents) override;
- // extensions::ExtensionFunctionDispatcher::Delegate overrides.
- extensions::WindowController* GetExtensionWindowController() const override;
+ // ExtensionFunctionDispatcher::Delegate overrides.
+ WindowController* GetExtensionWindowController() const override;
content::WebContents* GetAssociatedWebContents() const override;
// ExtensionRegistryObserver:
@@ -154,13 +158,15 @@ class TabHelper : public content::WebContentsObserver,
const Extension* extension,
UnloadedExtensionReason reason) override;
+ // mojom::InlineInstall:
+ void DoInlineInstall(
+ const std::string& webstore_item_id,
+ int listeners_mask,
+ mojom::InlineInstallProgressListenerPtr install_progress_listener,
+ DoInlineInstallCallback callback) override;
+
// Message handlers.
void OnDidGetWebApplicationInfo(const WebApplicationInfo& info);
- void OnInlineWebstoreInstall(content::RenderFrameHost* host,
- int install_id,
- int return_route_id,
- const std::string& webstore_item_id,
- int listeners_mask);
void OnGetAppInstallState(content::RenderFrameHost* host,
const GURL& requestor_url,
int return_route_id,
@@ -181,17 +187,13 @@ class TabHelper : public content::WebContentsObserver,
void OnImageLoaded(const gfx::Image& image);
// WebstoreStandaloneInstaller::Callback.
- void OnInlineInstallComplete(int install_id,
- int return_route_id,
- const ExtensionId& extension_id,
+ void OnInlineInstallComplete(const ExtensionId& extension_id,
bool success,
const std::string& error,
webstore_install::Result result);
// ExtensionReenabler::Callback.
- void OnReenableComplete(int install_id,
- int return_route_id,
- const ExtensionId& extension_id,
+ void OnReenableComplete(const ExtensionId& extension_id,
ExtensionReenabler::ReenableResult result);
// content::NotificationObserver.
@@ -260,8 +262,14 @@ class TabHelper : public content::WebContentsObserver,
std::map<ExtensionId, std::unique_ptr<InlineInstallObserver>>
install_observers_;
- // The set of extension ids that are currently being installed.
- std::set<ExtensionId> pending_inline_installations_;
+ // Map of function callbacks that are invoked when the inline installation for
+ // a particular extension (hence ExtensionId) completes.
+ std::map<ExtensionId, DoInlineInstallCallback> install_callbacks_;
+
+ content::WebContentsFrameBindingSet<mojom::InlineInstaller> bindings_;
+
+ std::map<ExtensionId, mojom::InlineInstallProgressListenerPtr>
+ inline_install_progress_listeners_;
// Vend weak pointers that can be invalidated to stop in-progress loads.
base::WeakPtrFactory<TabHelper> image_loader_ptr_factory_;
« no previous file with comments | « chrome/browser/extensions/BUILD.gn ('k') | chrome/browser/extensions/tab_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698