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 #include "chrome/browser/ui/toolbar/component_toolbar_actions_factory.h" | 5 #include "chrome/browser/ui/toolbar/component_toolbar_actions_factory.h" |
6 | 6 |
7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
8 #include "chrome/browser/ui/toolbar/media_router_action.h" | 8 #include "chrome/browser/ui/toolbar/media_router_action.h" |
9 #include "chrome/browser/ui/toolbar/toolbar_action_view_controller.h" | 9 #include "chrome/browser/ui/toolbar/toolbar_action_view_controller.h" |
10 #include "extensions/common/feature_switch.h" | 10 #include "extensions/common/feature_switch.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 // designed for the new toolbar. | 36 // designed for the new toolbar. |
37 if (!extensions::FeatureSwitch::extension_action_redesign()->IsEnabled()) | 37 if (!extensions::FeatureSwitch::extension_action_redesign()->IsEnabled()) |
38 return component_actions.Pass(); | 38 return component_actions.Pass(); |
39 | 39 |
40 // Add component toolbar actions here. | 40 // Add component toolbar actions here. |
41 // This current design means that the ComponentToolbarActionsFactory is aware | 41 // This current design means that the ComponentToolbarActionsFactory is aware |
42 // of all actions. Since we should *not* have an excessive amount of these | 42 // of all actions. Since we should *not* have an excessive amount of these |
43 // (since each will have an action in the toolbar or overflow menu), this | 43 // (since each will have an action in the toolbar or overflow menu), this |
44 // should be okay. If this changes, we should rethink this design to have, | 44 // should be okay. If this changes, we should rethink this design to have, |
45 // e.g., RegisterChromeAction(). | 45 // e.g., RegisterChromeAction(). |
| 46 #if defined(ENABLE_MEDIA_ROUTER) |
46 if (media_router_ui_enabled_) | 47 if (media_router_ui_enabled_) |
47 component_actions.push_back(new MediaRouterAction()); | 48 component_actions.push_back(new MediaRouterAction()); |
| 49 #endif // defined(ENABLE_MEDIA_ROUTER) |
48 | 50 |
49 return component_actions.Pass(); | 51 return component_actions.Pass(); |
50 } | 52 } |
51 | 53 |
52 int ComponentToolbarActionsFactory::GetNumComponentActions() { | 54 int ComponentToolbarActionsFactory::GetNumComponentActions() { |
53 if (num_component_actions_ == -1) | 55 if (num_component_actions_ == -1) |
54 num_component_actions_ = GetComponentToolbarActions().size(); | 56 num_component_actions_ = GetComponentToolbarActions().size(); |
55 | 57 |
56 return num_component_actions_; | 58 return num_component_actions_; |
57 } | 59 } |
58 | 60 |
59 // static | 61 // static |
60 void ComponentToolbarActionsFactory::SetTestingFactory( | 62 void ComponentToolbarActionsFactory::SetTestingFactory( |
61 ComponentToolbarActionsFactory* factory) { | 63 ComponentToolbarActionsFactory* factory) { |
62 testing_factory_ = factory; | 64 testing_factory_ = factory; |
63 } | 65 } |
OLD | NEW |