| 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 "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/scoped_vector.h" | 9 #include "base/memory/scoped_vector.h" |
| 10 | 10 |
| 11 class Browser; | 11 class Browser; |
| 12 class Profile; | 12 class Profile; |
| 13 class ToolbarActionViewController; | 13 class ToolbarActionViewController; |
| 14 | 14 |
| 15 // The registry for all component toolbar actions. Component toolbar actions | 15 // The registry for all component toolbar actions. Component toolbar actions |
| 16 // are actions that live in the toolbar (like extension actions), but are | 16 // are actions that live in the toolbar (like extension actions), but are |
| 17 // components of chrome, such as ChromeCast. | 17 // components of chrome, such as ChromeCast. |
| 18 class ComponentToolbarActionsFactory { | 18 class ComponentToolbarActionsFactory { |
| 19 public: | 19 public: |
| 20 // Component Action IDs. |
| 21 static const char kMediaRouterActionId[]; |
| 22 static const char kActionIdForTest[]; // Only used for testing. |
| 23 |
| 20 ComponentToolbarActionsFactory(); | 24 ComponentToolbarActionsFactory(); |
| 21 ~ComponentToolbarActionsFactory(); | 25 ~ComponentToolbarActionsFactory(); |
| 22 | 26 |
| 23 static ComponentToolbarActionsFactory* GetInstance(); | 27 static ComponentToolbarActionsFactory* GetInstance(); |
| 24 | 28 |
| 25 // Returns a collection of controllers for Chrome Actions. Declared virtual | 29 // Returns a list of ids of the Component Actions. |
| 26 // for testing. | 30 static std::vector<std::string> GetComponentIds(); |
| 31 |
| 32 // Returns a collection of controllers for Component Actions. Declared |
| 33 // virtual for testing. |
| 27 virtual ScopedVector<ToolbarActionViewController> | 34 virtual ScopedVector<ToolbarActionViewController> |
| 28 GetComponentToolbarActions(Browser* browser); | 35 GetComponentToolbarActions(Browser* browser); |
| 29 | 36 |
| 30 // Returns the number of component actions. | 37 // Returns the number of component actions. |
| 31 int GetNumComponentActions(Browser* browser); | 38 int GetNumComponentActions(Browser* browser); |
| 32 | 39 |
| 33 // Sets the factory to use for testing purposes. | 40 // Sets the factory to use for testing purposes. |
| 34 // Ownership remains with the caller. | 41 // Ownership remains with the caller. |
| 35 static void SetTestingFactory(ComponentToolbarActionsFactory* factory); | 42 static void SetTestingFactory(ComponentToolbarActionsFactory* factory); |
| 36 | 43 |
| 37 private: | 44 private: |
| 38 // The number of component actions. Initially set to -1 to denote that the | 45 // The number of component actions. Initially set to -1 to denote that the |
| 39 // count has not been checked yet. | 46 // count has not been checked yet. |
| 40 int num_component_actions_; | 47 int num_component_actions_; |
| 41 | 48 |
| 42 DISALLOW_COPY_AND_ASSIGN(ComponentToolbarActionsFactory); | 49 DISALLOW_COPY_AND_ASSIGN(ComponentToolbarActionsFactory); |
| 43 }; | 50 }; |
| 44 | 51 |
| 45 #endif // CHROME_BROWSER_UI_TOOLBAR_COMPONENT_TOOLBAR_ACTIONS_FACTORY_H_ | 52 #endif // CHROME_BROWSER_UI_TOOLBAR_COMPONENT_TOOLBAR_ACTIONS_FACTORY_H_ |
| OLD | NEW |