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

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

Issue 1241063003: Support Component Actions in the toolbar. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changes per mfoltz@'s comments. Created 5 years, 4 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
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;

Powered by Google App Engine
This is Rietveld 408576698