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

Side by Side Diff: chrome/browser/ui/views/toolbar/chrome_actions_registry.cc

Issue 661493004: Add infrastructure for Chrome Actions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/ui/views/toolbar/chrome_actions_registry.h"
6
7 #include "chrome/browser/ui/views/toolbar/toolbar_action_view_controller.h"
8 #include "extensions/common/feature_switch.h"
9
10 namespace {
11 ChromeActionsRegistry::FactoryFunction testing_factory_function = nullptr;
12 }
13
14 // static
15 ScopedVector<ToolbarActionViewController>
16 ChromeActionsRegistry::GetChromeActions() {
17 if (testing_factory_function != nullptr)
18 return testing_factory_function();
19
20 ScopedVector<ToolbarActionViewController> chrome_actions;
21
22 // This is currently behind the extension-action-redesign flag, as it is
23 // designed for the new toolbar.
24 if (!extensions::FeatureSwitch::extension_action_redesign()->IsEnabled())
25 return chrome_actions.Pass();
26
27 // Add chrome actions here.
28 // This current design means that the ChromeActionsRegistry is aware of all
29 // chrome actions (as opposed to an interface that had, e.g.,
30 // RegisterChromeAction()). This is because the latter requires a persistent
31 // object, and because we should *not* have an excessive amount of these, as
32 // each will have an action in the toolbar (or overflow menu).
33
34 return chrome_actions.Pass();
35 }
36
37 // static
38 void ChromeActionsRegistry::SetTestingChromeActionsFunction(
39 FactoryFunction function) {
40 testing_factory_function = function;
41 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698