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

Unified Diff: chrome/browser/ui/toolbar/component_toolbar_actions_factory.h

Issue 2803923002: [Media Router] Unload the legacy Cast extension at install (Closed)
Patch Set: Unload instead of uninstall Created 3 years, 8 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 | « no previous file | chrome/browser/ui/toolbar/component_toolbar_actions_factory.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/toolbar/component_toolbar_actions_factory.h
diff --git a/chrome/browser/ui/toolbar/component_toolbar_actions_factory.h b/chrome/browser/ui/toolbar/component_toolbar_actions_factory.h
index b9024817a6f7253f560222c25e4a12a020e1bc85..5805dc87e3b04bcb200162ea57b75905e21bde18 100644
--- a/chrome/browser/ui/toolbar/component_toolbar_actions_factory.h
+++ b/chrome/browser/ui/toolbar/component_toolbar_actions_factory.h
@@ -10,21 +10,24 @@
#include <string>
#include "base/macros.h"
+#include "base/scoped_observer.h"
+#include "extensions/browser/extension_registry_observer.h"
class Browser;
-class ExtensionService;
class Profile;
class ToolbarActionsBar;
class ToolbarActionViewController;
namespace extensions {
class ExtensionRegistry;
-}
+class ExtensionSystem;
+} // namespace extensions
// The registry for all component toolbar actions. Component toolbar actions
// are actions that live in the toolbar (like extension actions), but are for
// components of Chrome, such as Media Router.
-class ComponentToolbarActionsFactory {
+class ComponentToolbarActionsFactory
+ : public extensions::ExtensionRegistryObserver {
public:
// Extension and component action IDs.
static const char kCastBetaExtensionId[];
@@ -32,7 +35,7 @@ class ComponentToolbarActionsFactory {
static const char kMediaRouterActionId[];
explicit ComponentToolbarActionsFactory(Profile* profile);
- virtual ~ComponentToolbarActionsFactory();
+ ~ComponentToolbarActionsFactory() override;
// Returns a set of IDs of the component actions that should be present when
// the toolbar model is initialized.
@@ -53,21 +56,31 @@ class ComponentToolbarActionsFactory {
// Unloads extensions that were migrated to component actions and therefore
// are no longer needed.
- void UnloadMigratedExtensions(ExtensionService* service,
- extensions::ExtensionRegistry* registry);
+ void UnloadMigratedExtensions();
+
+ // extensions::ExtensionRegistryObserver:
+ void OnExtensionInstalled(content::BrowserContext* browser_context,
+ const extensions::Extension* extension,
+ bool is_update) override;
private:
- // Unloads an extension if it is active.
- void UnloadExtension(ExtensionService* service,
- extensions::ExtensionRegistry* registry,
- const std::string& extension_id);
+ // Unloads an extension if it is installed.
+ void UnloadExtension(const std::string& extension_id);
- Profile* profile_;
+ Profile* const profile_;
// IDs of component actions that should be added to the toolbar model when it
// gets initialized.
std::set<std::string> initial_ids_;
+ // The ExtensionRegistry and ExtensionSystem for the profile, used for
+ // detecting and unloading migrated extensions.
+ extensions::ExtensionRegistry* const extension_registry_;
+ extensions::ExtensionSystem* const extension_system_;
+
+ ScopedObserver<extensions::ExtensionRegistry, ExtensionRegistryObserver>
+ extension_registry_observer_;
+
DISALLOW_COPY_AND_ASSIGN(ComponentToolbarActionsFactory);
};
« no previous file with comments | « no previous file | chrome/browser/ui/toolbar/component_toolbar_actions_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698