| 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 "base/run_loop.h" | 8 #include "base/run_loop.h" |
| 8 #include "chrome/browser/extensions/extension_action.h" | 9 #include "chrome/browser/extensions/extension_action.h" |
| 9 #include "chrome/browser/extensions/extension_action_manager.h" | 10 #include "chrome/browser/extensions/extension_action_manager.h" |
| 10 #include "chrome/browser/extensions/extension_toolbar_model.h" | 11 #include "chrome/browser/extensions/extension_toolbar_model.h" |
| 11 #include "chrome/browser/extensions/extension_toolbar_model_factory.h" | 12 #include "chrome/browser/extensions/extension_toolbar_model_factory.h" |
| 12 #include "chrome/browser/extensions/location_bar_controller.h" | 13 #include "chrome/browser/extensions/location_bar_controller.h" |
| 13 #include "chrome/browser/extensions/tab_helper.h" | 14 #include "chrome/browser/extensions/tab_helper.h" |
| 14 #include "chrome/browser/extensions/test_extension_system.h" | 15 #include "chrome/browser/extensions/test_extension_system.h" |
| 15 #include "chrome/browser/profiles/profile.h" | 16 #include "chrome/browser/profiles/profile.h" |
| 16 #include "chrome/browser/sessions/session_tab_helper.h" | 17 #include "chrome/browser/sessions/session_tab_helper.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 if (extension_action && | 63 if (extension_action && |
| 63 (!only_count_visible || extension_action->GetIsVisible(tab_id))) | 64 (!only_count_visible || extension_action->GetIsVisible(tab_id))) |
| 64 ++count; | 65 ++count; |
| 65 } | 66 } |
| 66 } | 67 } |
| 67 | 68 |
| 68 return count; | 69 return count; |
| 69 } | 70 } |
| 70 | 71 |
| 71 // Creates a new ExtensionToolbarModel for the given |context|. | 72 // Creates a new ExtensionToolbarModel for the given |context|. |
| 72 KeyedService* BuildToolbarModel(content::BrowserContext* context) { | 73 scoped_ptr<KeyedService> BuildToolbarModel(content::BrowserContext* context) { |
| 73 return new extensions::ExtensionToolbarModel( | 74 return make_scoped_ptr(new extensions::ExtensionToolbarModel( |
| 74 Profile::FromBrowserContext(context), | 75 Profile::FromBrowserContext(context), |
| 75 extensions::ExtensionPrefs::Get(context)); | 76 extensions::ExtensionPrefs::Get(context))); |
| 76 } | 77 } |
| 77 | 78 |
| 78 // Creates a new ExtensionToolbarModel for the given profile, optionally | 79 // Creates a new ExtensionToolbarModel for the given profile, optionally |
| 79 // triggering the extension system's ready signal. | 80 // triggering the extension system's ready signal. |
| 80 ExtensionToolbarModel* CreateToolbarModelImpl(Profile* profile, | 81 ExtensionToolbarModel* CreateToolbarModelImpl(Profile* profile, |
| 81 bool wait_for_ready) { | 82 bool wait_for_ready) { |
| 82 ExtensionToolbarModel* model = ExtensionToolbarModel::Get(profile); | 83 ExtensionToolbarModel* model = ExtensionToolbarModel::Get(profile); |
| 83 if (model) | 84 if (model) |
| 84 return model; | 85 return model; |
| 85 | 86 |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 return CreateToolbarModelImpl(profile, true); | 155 return CreateToolbarModelImpl(profile, true); |
| 155 } | 156 } |
| 156 | 157 |
| 157 ExtensionToolbarModel* CreateToolbarModelForProfileWithoutWaitingForReady( | 158 ExtensionToolbarModel* CreateToolbarModelForProfileWithoutWaitingForReady( |
| 158 Profile* profile) { | 159 Profile* profile) { |
| 159 return CreateToolbarModelImpl(profile, false); | 160 return CreateToolbarModelImpl(profile, false); |
| 160 } | 161 } |
| 161 | 162 |
| 162 } // namespace extension_action_test_util | 163 } // namespace extension_action_test_util |
| 163 } // namespace extensions | 164 } // namespace extensions |
| OLD | NEW |