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

Side by Side Diff: chrome/browser/ui/toolbar/mock_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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/mock_component_toolbar_actions_factory.h" 5 #include "chrome/browser/ui/toolbar/mock_component_toolbar_actions_factory.h"
6 6
7 #include "chrome/browser/ui/browser.h" 7 #include "chrome/browser/ui/browser.h"
8 #include "chrome/browser/ui/toolbar/test_toolbar_action_view_controller.h" 8 #include "chrome/browser/ui/toolbar/test_toolbar_action_view_controller.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 17 matching lines...) Expand all
28 std::set<std::string> ids; 28 std::set<std::string> ids;
29 // kActionIdForTesting is installed by default if we are not testing 29 // kActionIdForTesting is installed by default if we are not testing
30 // a migration scenario. 30 // a migration scenario.
31 if (extensions::FeatureSwitch::extension_action_redesign()->IsEnabled() && 31 if (extensions::FeatureSwitch::extension_action_redesign()->IsEnabled() &&
32 migrated_extension_id_.empty()) { 32 migrated_extension_id_.empty()) {
33 ids.insert(kActionIdForTesting); 33 ids.insert(kActionIdForTesting);
34 } 34 }
35 return ids; 35 return ids;
36 } 36 }
37 37
38 scoped_ptr<ToolbarActionViewController> 38 std::unique_ptr<ToolbarActionViewController>
39 MockComponentToolbarActionsFactory::GetComponentToolbarActionForId( 39 MockComponentToolbarActionsFactory::GetComponentToolbarActionForId(
40 const std::string& id, 40 const std::string& id,
41 Browser* browser, 41 Browser* browser,
42 ToolbarActionsBar* bar) { 42 ToolbarActionsBar* bar) {
43 DCHECK_EQ(kActionIdForTesting, id); 43 DCHECK_EQ(kActionIdForTesting, id);
44 return scoped_ptr<ToolbarActionViewController>( 44 return std::unique_ptr<ToolbarActionViewController>(
45 new TestToolbarActionViewController( 45 new TestToolbarActionViewController(
46 MockComponentToolbarActionsFactory::kActionIdForTesting)); 46 MockComponentToolbarActionsFactory::kActionIdForTesting));
47 } 47 }
48 48
49 void MockComponentToolbarActionsFactory::RegisterComponentMigrations( 49 void MockComponentToolbarActionsFactory::RegisterComponentMigrations(
50 extensions::ComponentMigrationHelper* helper) const { 50 extensions::ComponentMigrationHelper* helper) const {
51 if (!migrated_extension_id_.empty()) { 51 if (!migrated_extension_id_.empty()) {
52 helper->Register(kActionIdForTesting, migrated_extension_id_); 52 helper->Register(kActionIdForTesting, migrated_extension_id_);
53 } 53 }
54 } 54 }
55 55
56 void MockComponentToolbarActionsFactory::HandleComponentMigrations( 56 void MockComponentToolbarActionsFactory::HandleComponentMigrations(
57 extensions::ComponentMigrationHelper* helper, 57 extensions::ComponentMigrationHelper* helper,
58 Profile* profile) const { 58 Profile* profile) const {
59 if (migrated_extension_id_.empty()) 59 if (migrated_extension_id_.empty())
60 return; 60 return;
61 61
62 if (migrated_feature_enabled_) { 62 if (migrated_feature_enabled_) {
63 helper->OnFeatureEnabled(kActionIdForTesting); 63 helper->OnFeatureEnabled(kActionIdForTesting);
64 } else { 64 } else {
65 helper->OnFeatureDisabled(kActionIdForTesting); 65 helper->OnFeatureDisabled(kActionIdForTesting);
66 } 66 }
67 } 67 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698