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

Side by Side Diff: chrome/browser/ui/toolbar/component_toolbar_actions_factory.cc

Issue 1865213004: Convert //chrome/browser/ui from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 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
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/extensions/component_migration_helper.h" 9 #include "chrome/browser/extensions/component_migration_helper.h"
10 #include "chrome/browser/media/router/media_router_feature.h" 10 #include "chrome/browser/media/router/media_router_feature.h"
(...skipping 29 matching lines...) Expand all
40 ComponentToolbarActionsFactory* ComponentToolbarActionsFactory::GetInstance() { 40 ComponentToolbarActionsFactory* ComponentToolbarActionsFactory::GetInstance() {
41 return testing_factory_ ? testing_factory_ : &lazy_factory.Get(); 41 return testing_factory_ ? testing_factory_ : &lazy_factory.Get();
42 } 42 }
43 43
44 std::set<std::string> ComponentToolbarActionsFactory::GetInitialComponentIds( 44 std::set<std::string> ComponentToolbarActionsFactory::GetInitialComponentIds(
45 Profile* profile) { 45 Profile* profile) {
46 std::set<std::string> component_ids; 46 std::set<std::string> component_ids;
47 return component_ids; 47 return component_ids;
48 } 48 }
49 49
50 scoped_ptr<ToolbarActionViewController> 50 std::unique_ptr<ToolbarActionViewController>
51 ComponentToolbarActionsFactory::GetComponentToolbarActionForId( 51 ComponentToolbarActionsFactory::GetComponentToolbarActionForId(
52 const std::string& id, 52 const std::string& id,
53 Browser* browser, 53 Browser* browser,
54 ToolbarActionsBar* bar) { 54 ToolbarActionsBar* bar) {
55 // This is currently behind the extension-action-redesign flag, as it is 55 // This is currently behind the extension-action-redesign flag, as it is
56 // designed for the new toolbar. 56 // designed for the new toolbar.
57 DCHECK(extensions::FeatureSwitch::extension_action_redesign()->IsEnabled()); 57 DCHECK(extensions::FeatureSwitch::extension_action_redesign()->IsEnabled());
58 58
59 // Add component toolbar actions here. 59 // Add component toolbar actions here.
60 // This current design means that the ComponentToolbarActionsFactory is aware 60 // This current design means that the ComponentToolbarActionsFactory is aware
61 // of all actions. Since we should *not* have an excessive amount of these 61 // of all actions. Since we should *not* have an excessive amount of these
62 // (since each will have an action in the toolbar or overflow menu), this 62 // (since each will have an action in the toolbar or overflow menu), this
63 // should be okay. If this changes, we should rethink this design to have, 63 // should be okay. If this changes, we should rethink this design to have,
64 // e.g., RegisterChromeAction(). 64 // e.g., RegisterChromeAction().
65 #if defined(ENABLE_MEDIA_ROUTER) 65 #if defined(ENABLE_MEDIA_ROUTER)
66 if (id == kMediaRouterActionId) 66 if (id == kMediaRouterActionId)
67 return scoped_ptr<ToolbarActionViewController>( 67 return std::unique_ptr<ToolbarActionViewController>(
68 new MediaRouterAction(browser, bar)); 68 new MediaRouterAction(browser, bar));
69 #endif // defined(ENABLE_MEDIA_ROUTER) 69 #endif // defined(ENABLE_MEDIA_ROUTER)
70 70
71 NOTREACHED(); 71 NOTREACHED();
72 return scoped_ptr<ToolbarActionViewController>(); 72 return std::unique_ptr<ToolbarActionViewController>();
73 } 73 }
74 74
75 // static 75 // static
76 void ComponentToolbarActionsFactory::SetTestingFactory( 76 void ComponentToolbarActionsFactory::SetTestingFactory(
77 ComponentToolbarActionsFactory* factory) { 77 ComponentToolbarActionsFactory* factory) {
78 testing_factory_ = factory; 78 testing_factory_ = factory;
79 } 79 }
80 80
81 void ComponentToolbarActionsFactory::RegisterComponentMigrations( 81 void ComponentToolbarActionsFactory::RegisterComponentMigrations(
82 extensions::ComponentMigrationHelper* helper) const { 82 extensions::ComponentMigrationHelper* helper) const {
83 helper->Register(kMediaRouterActionId, kCastExtensionId); 83 helper->Register(kMediaRouterActionId, kCastExtensionId);
84 helper->Register(kMediaRouterActionId, kCastBetaExtensionId); 84 helper->Register(kMediaRouterActionId, kCastBetaExtensionId);
85 } 85 }
86 86
87 void ComponentToolbarActionsFactory::HandleComponentMigrations( 87 void ComponentToolbarActionsFactory::HandleComponentMigrations(
88 extensions::ComponentMigrationHelper* helper, 88 extensions::ComponentMigrationHelper* helper,
89 Profile* profile) const { 89 Profile* profile) const {
90 if (media_router::MediaRouterEnabled(profile)) { 90 if (media_router::MediaRouterEnabled(profile)) {
91 helper->OnFeatureEnabled(kMediaRouterActionId); 91 helper->OnFeatureEnabled(kMediaRouterActionId);
92 } else { 92 } else {
93 helper->OnFeatureDisabled(kMediaRouterActionId); 93 helper->OnFeatureDisabled(kMediaRouterActionId);
94 } 94 }
95 } 95 }
96 96
OLDNEW
« no previous file with comments | « chrome/browser/ui/toolbar/component_toolbar_actions_factory.h ('k') | chrome/browser/ui/toolbar/media_router_action.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698