| 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 6b2d58bb69178021c6e81f5ce0cbcd1b8ea57362..b9024817a6f7253f560222c25e4a12a020e1bc85 100644
|
| --- a/chrome/browser/ui/toolbar/component_toolbar_actions_factory.h
|
| +++ b/chrome/browser/ui/toolbar/component_toolbar_actions_factory.h
|
| @@ -10,11 +10,11 @@
|
| #include <string>
|
|
|
| #include "base/macros.h"
|
| -#include "chrome/browser/ui/toolbar/toolbar_actions_bar.h"
|
|
|
| class Browser;
|
| class ExtensionService;
|
| class Profile;
|
| +class ToolbarActionsBar;
|
| class ToolbarActionViewController;
|
|
|
| namespace extensions {
|
| @@ -22,8 +22,8 @@ class ExtensionRegistry;
|
| }
|
|
|
| // The registry for all component toolbar actions. Component toolbar actions
|
| -// are actions that live in the toolbar (like extension actions), but are
|
| -// components of chrome, such as ChromeCast.
|
| +// are actions that live in the toolbar (like extension actions), but are for
|
| +// components of Chrome, such as Media Router.
|
| class ComponentToolbarActionsFactory {
|
| public:
|
| // Extension and component action IDs.
|
| @@ -31,18 +31,23 @@ class ComponentToolbarActionsFactory {
|
| static const char kCastExtensionId[];
|
| static const char kMediaRouterActionId[];
|
|
|
| - ComponentToolbarActionsFactory();
|
| + explicit ComponentToolbarActionsFactory(Profile* profile);
|
| virtual ~ComponentToolbarActionsFactory();
|
|
|
| - static ComponentToolbarActionsFactory* GetInstance();
|
| + // Returns a set of IDs of the component actions that should be present when
|
| + // the toolbar model is initialized.
|
| + virtual std::set<std::string> GetInitialComponentIds();
|
|
|
| - // Returns a vector of IDs of the component actions.
|
| - virtual std::set<std::string> GetInitialComponentIds(Profile* profile);
|
| + // Called when component actions are added or removed before the toolbar model
|
| + // is initialized. Adds or removes |action_id| to/from |initial_ids_| as
|
| + // necessary.
|
| + void OnAddComponentActionBeforeInit(const std::string& action_id);
|
| + void OnRemoveComponentActionBeforeInit(const std::string& action_id);
|
|
|
| - // Returns a collection of controllers for component actions. Declared
|
| - // virtual for testing.
|
| + // Returns the controller responsible for the component action associated with
|
| + // |action_id| in |bar|. Declared virtual for testing.
|
| virtual std::unique_ptr<ToolbarActionViewController>
|
| - GetComponentToolbarActionForId(const std::string& id,
|
| + GetComponentToolbarActionForId(const std::string& action_id,
|
| Browser* browser,
|
| ToolbarActionsBar* bar);
|
|
|
| @@ -51,16 +56,18 @@ class ComponentToolbarActionsFactory {
|
| void UnloadMigratedExtensions(ExtensionService* service,
|
| extensions::ExtensionRegistry* registry);
|
|
|
| - // Sets the factory to use for testing purposes.
|
| - // Ownership remains with the caller.
|
| - static void SetTestingFactory(ComponentToolbarActionsFactory* factory);
|
| -
|
| private:
|
| // Unloads an extension if it is active.
|
| void UnloadExtension(ExtensionService* service,
|
| extensions::ExtensionRegistry* registry,
|
| const std::string& extension_id);
|
|
|
| + Profile* profile_;
|
| +
|
| + // IDs of component actions that should be added to the toolbar model when it
|
| + // gets initialized.
|
| + std::set<std::string> initial_ids_;
|
| +
|
| DISALLOW_COPY_AND_ASSIGN(ComponentToolbarActionsFactory);
|
| };
|
|
|
|
|