Chromium Code Reviews| Index: chrome/browser/ui/toolbar/component_toolbar_actions_factory.cc |
| diff --git a/chrome/browser/ui/toolbar/component_toolbar_actions_factory.cc b/chrome/browser/ui/toolbar/component_toolbar_actions_factory.cc |
| index 8f64c079393ae0495e3344bb9b04ca3610bcdd75..bb21fbac52d57fb76535e5fdc596f8547d0349de 100644 |
| --- a/chrome/browser/ui/toolbar/component_toolbar_actions_factory.cc |
| +++ b/chrome/browser/ui/toolbar/component_toolbar_actions_factory.cc |
| @@ -20,6 +20,11 @@ base::LazyInstance<ComponentToolbarActionsFactory> lazy_factory = |
| } // namespace |
| +// static |
| +const char ComponentToolbarActionsFactory::kMediaRouterActionId[] = |
| + "media_router_action"; |
| +const char ComponentToolbarActionsFactory::kActionIdForTest[] = "mock_action"; |
| + |
| ComponentToolbarActionsFactory::ComponentToolbarActionsFactory() |
| : num_component_actions_(-1) {} |
| ComponentToolbarActionsFactory::~ComponentToolbarActionsFactory() {} |
| @@ -29,6 +34,25 @@ ComponentToolbarActionsFactory* ComponentToolbarActionsFactory::GetInstance() { |
| return testing_factory_ ? testing_factory_ : &lazy_factory.Get(); |
| } |
| +// static |
| +std::vector<std::string>* ComponentToolbarActionsFactory::GetComponentIds() { |
|
mark a. foltz
2015/08/05 20:21:53
IMO it would be better to return a scoped_ptr<> he
apacible
2015/08/05 23:21:43
Switched to just returning std::vector<std::string
|
| + std::vector<std::string>* component_ids = new std::vector<std::string>; |
| + |
| + if (testing_factory_) { |
| + component_ids->push_back(ComponentToolbarActionsFactory::kActionIdForTest); |
| + } else { |
| +#if defined(ENABLE_MEDIA_ROUTER) |
| + if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| + ::switches::kEnableMediaRouter)) { |
| + component_ids->push_back( |
| + ComponentToolbarActionsFactory::kMediaRouterActionId); |
| + } |
| +#endif // ENABLE_MEDIA_ROUTER |
| + } |
| + |
| + return component_ids; |
| +} |
| + |
| ScopedVector<ToolbarActionViewController> |
| ComponentToolbarActionsFactory::GetComponentToolbarActions(Browser* browser) { |
| ScopedVector<ToolbarActionViewController> component_actions; |