| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/api/commands/command_service.h" | 5 #include "chrome/browser/extensions/api/commands/command_service.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 extension_registry_observer_(this) { | 134 extension_registry_observer_(this) { |
| 135 ExtensionFunctionRegistry::GetInstance()-> | 135 ExtensionFunctionRegistry::GetInstance()-> |
| 136 RegisterFunction<GetAllCommandsFunction>(); | 136 RegisterFunction<GetAllCommandsFunction>(); |
| 137 | 137 |
| 138 extension_registry_observer_.Add(ExtensionRegistry::Get(profile_)); | 138 extension_registry_observer_.Add(ExtensionRegistry::Get(profile_)); |
| 139 } | 139 } |
| 140 | 140 |
| 141 CommandService::~CommandService() { | 141 CommandService::~CommandService() { |
| 142 } | 142 } |
| 143 | 143 |
| 144 static base::LazyInstance<BrowserContextKeyedAPIFactory<CommandService> > | 144 static base::LazyInstance< |
| 145 g_factory = LAZY_INSTANCE_INITIALIZER; | 145 BrowserContextKeyedAPIFactory<CommandService>>::DestructorAtExit g_factory = |
| 146 LAZY_INSTANCE_INITIALIZER; |
| 146 | 147 |
| 147 // static | 148 // static |
| 148 BrowserContextKeyedAPIFactory<CommandService>* | 149 BrowserContextKeyedAPIFactory<CommandService>* |
| 149 CommandService::GetFactoryInstance() { | 150 CommandService::GetFactoryInstance() { |
| 150 return g_factory.Pointer(); | 151 return g_factory.Pointer(); |
| 151 } | 152 } |
| 152 | 153 |
| 153 // static | 154 // static |
| 154 CommandService* CommandService::Get(content::BrowserContext* context) { | 155 CommandService* CommandService::Get(content::BrowserContext* context) { |
| 155 return BrowserContextKeyedAPIFactory<CommandService>::Get(context); | 156 return BrowserContextKeyedAPIFactory<CommandService>::Get(context); |
| (...skipping 752 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 908 return true; | 909 return true; |
| 909 } | 910 } |
| 910 | 911 |
| 911 template <> | 912 template <> |
| 912 void | 913 void |
| 913 BrowserContextKeyedAPIFactory<CommandService>::DeclareFactoryDependencies() { | 914 BrowserContextKeyedAPIFactory<CommandService>::DeclareFactoryDependencies() { |
| 914 DependsOn(ExtensionCommandsGlobalRegistry::GetFactoryInstance()); | 915 DependsOn(ExtensionCommandsGlobalRegistry::GetFactoryInstance()); |
| 915 } | 916 } |
| 916 | 917 |
| 917 } // namespace extensions | 918 } // namespace extensions |
| OLD | NEW |