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/extensions/extension_action_test_util.h" | 5 #include "chrome/browser/extensions/extension_action_test_util.h" |
6 | 6 |
7 #include "base/memory/scoped_ptr.h" | 7 #include <memory> |
| 8 |
| 9 #include "base/memory/ptr_util.h" |
8 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
9 #include "chrome/browser/extensions/extension_action.h" | 11 #include "chrome/browser/extensions/extension_action.h" |
10 #include "chrome/browser/extensions/extension_action_manager.h" | 12 #include "chrome/browser/extensions/extension_action_manager.h" |
11 #include "chrome/browser/extensions/location_bar_controller.h" | 13 #include "chrome/browser/extensions/location_bar_controller.h" |
12 #include "chrome/browser/extensions/tab_helper.h" | 14 #include "chrome/browser/extensions/tab_helper.h" |
13 #include "chrome/browser/extensions/test_extension_system.h" | 15 #include "chrome/browser/extensions/test_extension_system.h" |
14 #include "chrome/browser/profiles/profile.h" | 16 #include "chrome/browser/profiles/profile.h" |
15 #include "chrome/browser/sessions/session_tab_helper.h" | 17 #include "chrome/browser/sessions/session_tab_helper.h" |
16 #include "chrome/browser/ui/toolbar/toolbar_actions_model.h" | 18 #include "chrome/browser/ui/toolbar/toolbar_actions_model.h" |
17 #include "chrome/browser/ui/toolbar/toolbar_actions_model_factory.h" | 19 #include "chrome/browser/ui/toolbar/toolbar_actions_model_factory.h" |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 (!only_count_visible || extension_action->GetIsVisible(tab_id))) | 72 (!only_count_visible || extension_action->GetIsVisible(tab_id))) |
71 ++count; | 73 ++count; |
72 } | 74 } |
73 } | 75 } |
74 } | 76 } |
75 | 77 |
76 return count; | 78 return count; |
77 } | 79 } |
78 | 80 |
79 // Creates a new ToolbarActionsModel for the given |context|. | 81 // Creates a new ToolbarActionsModel for the given |context|. |
80 scoped_ptr<KeyedService> BuildToolbarModel(content::BrowserContext* context) { | 82 std::unique_ptr<KeyedService> BuildToolbarModel( |
81 return make_scoped_ptr( | 83 content::BrowserContext* context) { |
| 84 return base::WrapUnique( |
82 new ToolbarActionsModel(Profile::FromBrowserContext(context), | 85 new ToolbarActionsModel(Profile::FromBrowserContext(context), |
83 extensions::ExtensionPrefs::Get(context))); | 86 extensions::ExtensionPrefs::Get(context))); |
84 } | 87 } |
85 | 88 |
86 // Creates a new ToolbarActionsModel for the given profile, optionally | 89 // Creates a new ToolbarActionsModel for the given profile, optionally |
87 // triggering the extension system's ready signal. | 90 // triggering the extension system's ready signal. |
88 ToolbarActionsModel* CreateToolbarModelImpl(Profile* profile, | 91 ToolbarActionsModel* CreateToolbarModelImpl(Profile* profile, |
89 bool wait_for_ready) { | 92 bool wait_for_ready) { |
90 ToolbarActionsModel* model = ToolbarActionsModel::Get(profile); | 93 ToolbarActionsModel* model = ToolbarActionsModel::Get(profile); |
91 if (model) | 94 if (model) |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 return CreateToolbarModelImpl(profile, true); | 166 return CreateToolbarModelImpl(profile, true); |
164 } | 167 } |
165 | 168 |
166 ToolbarActionsModel* CreateToolbarModelForProfileWithoutWaitingForReady( | 169 ToolbarActionsModel* CreateToolbarModelForProfileWithoutWaitingForReady( |
167 Profile* profile) { | 170 Profile* profile) { |
168 return CreateToolbarModelImpl(profile, false); | 171 return CreateToolbarModelImpl(profile, false); |
169 } | 172 } |
170 | 173 |
171 } // namespace extension_action_test_util | 174 } // namespace extension_action_test_util |
172 } // namespace extensions | 175 } // namespace extensions |
OLD | NEW |