Chromium Code Reviews| 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/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
| 9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
| 11 #include "chrome/browser/ui/toolbar/media_router_action.h" | 11 #include "chrome/browser/ui/toolbar/media_router_action.h" |
| 12 #include "chrome/browser/ui/toolbar/toolbar_action_view_controller.h" | 12 #include "chrome/browser/ui/toolbar/toolbar_action_view_controller.h" |
| 13 #include "chrome/common/chrome_switches.h" | 13 #include "chrome/common/chrome_switches.h" |
| 14 #include "extensions/common/feature_switch.h" | 14 #include "extensions/common/feature_switch.h" |
| 15 | 15 |
| 16 #if defined(ENABLE_MEDIA_ROUTER) | |
| 17 #include "chrome/browser/media/router/media_router_feature.h" | |
| 18 #endif | |
|
msw
2015/10/23 20:18:43
nit: blank line after
imcheng
2015/10/23 21:39:26
Done.
| |
| 16 namespace { | 19 namespace { |
| 17 | 20 |
| 18 ComponentToolbarActionsFactory* testing_factory_ = nullptr; | 21 ComponentToolbarActionsFactory* testing_factory_ = nullptr; |
| 19 | 22 |
| 20 base::LazyInstance<ComponentToolbarActionsFactory> lazy_factory = | 23 base::LazyInstance<ComponentToolbarActionsFactory> lazy_factory = |
| 21 LAZY_INSTANCE_INITIALIZER; | 24 LAZY_INSTANCE_INITIALIZER; |
| 22 | 25 |
| 23 } // namespace | 26 } // namespace |
| 24 | 27 |
| 25 // static | 28 // static |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 36 | 39 |
| 37 std::set<std::string> ComponentToolbarActionsFactory::GetComponentIds( | 40 std::set<std::string> ComponentToolbarActionsFactory::GetComponentIds( |
| 38 Profile* profile) { | 41 Profile* profile) { |
| 39 std::set<std::string> component_ids; | 42 std::set<std::string> component_ids; |
| 40 | 43 |
| 41 // This is currently behind the extension-action-redesign flag, as it is | 44 // This is currently behind the extension-action-redesign flag, as it is |
| 42 // designed for the new toolbar. | 45 // designed for the new toolbar. |
| 43 if (!extensions::FeatureSwitch::extension_action_redesign()->IsEnabled()) | 46 if (!extensions::FeatureSwitch::extension_action_redesign()->IsEnabled()) |
| 44 return component_ids; | 47 return component_ids; |
| 45 | 48 |
| 46 if (switches::MediaRouterEnabled() && !profile->IsOffTheRecord()) | 49 #if defined(ENABLE_MEDIA_ROUTER) |
| 50 if (media_router::MediaRouterEnabled() && !profile->IsOffTheRecord()) | |
| 47 component_ids.insert(kMediaRouterActionId); | 51 component_ids.insert(kMediaRouterActionId); |
| 52 #endif // defined(ENABLE_MEDIA_ROUTER) | |
| 48 | 53 |
| 49 return component_ids; | 54 return component_ids; |
| 50 } | 55 } |
| 51 | 56 |
| 52 scoped_ptr<ToolbarActionViewController> | 57 scoped_ptr<ToolbarActionViewController> |
| 53 ComponentToolbarActionsFactory::GetComponentToolbarActionForId( | 58 ComponentToolbarActionsFactory::GetComponentToolbarActionForId( |
| 54 const std::string& id, | 59 const std::string& id, |
| 55 Browser* browser) { | 60 Browser* browser) { |
| 56 // This is currently behind the extension-action-redesign flag, as it is | 61 // This is currently behind the extension-action-redesign flag, as it is |
| 57 // designed for the new toolbar. | 62 // designed for the new toolbar. |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 70 | 75 |
| 71 NOTREACHED(); | 76 NOTREACHED(); |
| 72 return scoped_ptr<ToolbarActionViewController>(); | 77 return scoped_ptr<ToolbarActionViewController>(); |
| 73 } | 78 } |
| 74 | 79 |
| 75 // static | 80 // static |
| 76 void ComponentToolbarActionsFactory::SetTestingFactory( | 81 void ComponentToolbarActionsFactory::SetTestingFactory( |
| 77 ComponentToolbarActionsFactory* factory) { | 82 ComponentToolbarActionsFactory* factory) { |
| 78 testing_factory_ = factory; | 83 testing_factory_ = factory; |
| 79 } | 84 } |
| OLD | NEW |