| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_UI_TOOLBAR_COMPONENT_TOOLBAR_ACTIONS_FACTORY_H_ | 5 #ifndef CHROME_BROWSER_UI_TOOLBAR_COMPONENT_TOOLBAR_ACTIONS_FACTORY_H_ |
| 6 #define CHROME_BROWSER_UI_TOOLBAR_COMPONENT_TOOLBAR_ACTIONS_FACTORY_H_ | 6 #define CHROME_BROWSER_UI_TOOLBAR_COMPONENT_TOOLBAR_ACTIONS_FACTORY_H_ |
| 7 | 7 |
| 8 #include <memory> |
| 8 #include <set> | 9 #include <set> |
| 9 #include <string> | 10 #include <string> |
| 10 | 11 |
| 11 #include "base/macros.h" | 12 #include "base/macros.h" |
| 12 #include "base/memory/scoped_ptr.h" | |
| 13 #include "chrome/browser/ui/toolbar/toolbar_actions_bar.h" | 13 #include "chrome/browser/ui/toolbar/toolbar_actions_bar.h" |
| 14 | 14 |
| 15 class Browser; | 15 class Browser; |
| 16 class Profile; | 16 class Profile; |
| 17 class ToolbarActionViewController; | 17 class ToolbarActionViewController; |
| 18 | 18 |
| 19 namespace extensions { | 19 namespace extensions { |
| 20 class ComponentMigrationHelper; | 20 class ComponentMigrationHelper; |
| 21 } // extensions | 21 } // extensions |
| 22 | 22 |
| 23 // The registry for all component toolbar actions. Component toolbar actions | 23 // The registry for all component toolbar actions. Component toolbar actions |
| 24 // are actions that live in the toolbar (like extension actions), but are | 24 // are actions that live in the toolbar (like extension actions), but are |
| 25 // components of chrome, such as ChromeCast. | 25 // components of chrome, such as ChromeCast. |
| 26 class ComponentToolbarActionsFactory { | 26 class ComponentToolbarActionsFactory { |
| 27 public: | 27 public: |
| 28 // Component action IDs. | 28 // Component action IDs. |
| 29 static const char kMediaRouterActionId[]; | 29 static const char kMediaRouterActionId[]; |
| 30 | 30 |
| 31 ComponentToolbarActionsFactory(); | 31 ComponentToolbarActionsFactory(); |
| 32 virtual ~ComponentToolbarActionsFactory(); | 32 virtual ~ComponentToolbarActionsFactory(); |
| 33 | 33 |
| 34 static ComponentToolbarActionsFactory* GetInstance(); | 34 static ComponentToolbarActionsFactory* GetInstance(); |
| 35 | 35 |
| 36 // Returns a vector of IDs of the component actions. | 36 // Returns a vector of IDs of the component actions. |
| 37 virtual std::set<std::string> GetInitialComponentIds(Profile* profile); | 37 virtual std::set<std::string> GetInitialComponentIds(Profile* profile); |
| 38 | 38 |
| 39 // Returns a collection of controllers for component actions. Declared | 39 // Returns a collection of controllers for component actions. Declared |
| 40 // virtual for testing. | 40 // virtual for testing. |
| 41 virtual scoped_ptr<ToolbarActionViewController> | 41 virtual std::unique_ptr<ToolbarActionViewController> |
| 42 GetComponentToolbarActionForId(const std::string& id, Browser* browser, | 42 GetComponentToolbarActionForId(const std::string& id, |
| 43 Browser* browser, |
| 43 ToolbarActionsBar* bar); | 44 ToolbarActionsBar* bar); |
| 44 | 45 |
| 45 // Registers component actions that are migrating from extensions. | 46 // Registers component actions that are migrating from extensions. |
| 46 virtual void RegisterComponentMigrations( | 47 virtual void RegisterComponentMigrations( |
| 47 extensions::ComponentMigrationHelper* helper) const; | 48 extensions::ComponentMigrationHelper* helper) const; |
| 48 | 49 |
| 49 // Synchronizes component action visibility and extension install status. | 50 // Synchronizes component action visibility and extension install status. |
| 50 virtual void HandleComponentMigrations( | 51 virtual void HandleComponentMigrations( |
| 51 extensions::ComponentMigrationHelper* helper, | 52 extensions::ComponentMigrationHelper* helper, |
| 52 Profile* profile) const; | 53 Profile* profile) const; |
| 53 | 54 |
| 54 // Sets the factory to use for testing purposes. | 55 // Sets the factory to use for testing purposes. |
| 55 // Ownership remains with the caller. | 56 // Ownership remains with the caller. |
| 56 static void SetTestingFactory(ComponentToolbarActionsFactory* factory); | 57 static void SetTestingFactory(ComponentToolbarActionsFactory* factory); |
| 57 | 58 |
| 58 private: | 59 private: |
| 59 DISALLOW_COPY_AND_ASSIGN(ComponentToolbarActionsFactory); | 60 DISALLOW_COPY_AND_ASSIGN(ComponentToolbarActionsFactory); |
| 60 }; | 61 }; |
| 61 | 62 |
| 62 #endif // CHROME_BROWSER_UI_TOOLBAR_COMPONENT_TOOLBAR_ACTIONS_FACTORY_H_ | 63 #endif // CHROME_BROWSER_UI_TOOLBAR_COMPONENT_TOOLBAR_ACTIONS_FACTORY_H_ |
| OLD | NEW |