blob: 54f44dc8dbb02a2139af81e4dd0e9bcb473c54f7 [file] [log] [blame]
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <memory>
#include <set>
#include <string>
#include "base/macros.h"
class Browser;
class Profile;
class ToolbarActionsBar;
class ToolbarActionViewController;
// The registry for all component toolbar actions. Component toolbar actions
// are actions that live in the toolbar (like extension actions), but are for
// components of Chrome, such as Media Router.
class ComponentToolbarActionsFactory {
// Extension and component action IDs.
static const char kMediaRouterActionId[];
explicit ComponentToolbarActionsFactory(Profile* profile);
virtual ~ComponentToolbarActionsFactory();
// 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();
// 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 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& action_id,
Browser* browser,
ToolbarActionsBar* bar);
// IDs of component actions that should be added to the toolbar model when it
// gets initialized.
std::set<std::string> initial_ids_;