| 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 "apps/shell_window_geometry_cache.h" | 5 #include "apps/shell_window_geometry_cache.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
| 9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 10 #include "chrome/browser/extensions/extension_prefs.h" | 10 #include "chrome/browser/extensions/extension_prefs.h" |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 cache_.erase(extension_id); | 229 cache_.erase(extension_id); |
| 230 } | 230 } |
| 231 | 231 |
| 232 /////////////////////////////////////////////////////////////////////////////// | 232 /////////////////////////////////////////////////////////////////////////////// |
| 233 // Factory boilerplate | 233 // Factory boilerplate |
| 234 | 234 |
| 235 // static | 235 // static |
| 236 ShellWindowGeometryCache* ShellWindowGeometryCache::Factory::GetForContext( | 236 ShellWindowGeometryCache* ShellWindowGeometryCache::Factory::GetForContext( |
| 237 content::BrowserContext* context, bool create) { | 237 content::BrowserContext* context, bool create) { |
| 238 return static_cast<ShellWindowGeometryCache*>( | 238 return static_cast<ShellWindowGeometryCache*>( |
| 239 GetInstance()->GetServiceForProfile(context, create)); | 239 GetInstance()->GetServiceForBrowserContext(context, create)); |
| 240 } | 240 } |
| 241 | 241 |
| 242 ShellWindowGeometryCache::Factory* | 242 ShellWindowGeometryCache::Factory* |
| 243 ShellWindowGeometryCache::Factory::GetInstance() { | 243 ShellWindowGeometryCache::Factory::GetInstance() { |
| 244 return Singleton<ShellWindowGeometryCache::Factory>::get(); | 244 return Singleton<ShellWindowGeometryCache::Factory>::get(); |
| 245 } | 245 } |
| 246 | 246 |
| 247 ShellWindowGeometryCache::Factory::Factory() | 247 ShellWindowGeometryCache::Factory::Factory() |
| 248 : ProfileKeyedServiceFactory("ShellWindowGeometryCache", | 248 : BrowserContextKeyedServiceFactory("ShellWindowGeometryCache", |
| 249 ProfileDependencyManager::GetInstance()) { | 249 BrowserContextDependencyManager::GetInstance())
{ |
| 250 DependsOn(extensions::ExtensionPrefsFactory::GetInstance()); | 250 DependsOn(extensions::ExtensionPrefsFactory::GetInstance()); |
| 251 } | 251 } |
| 252 | 252 |
| 253 ShellWindowGeometryCache::Factory::~Factory() { | 253 ShellWindowGeometryCache::Factory::~Factory() { |
| 254 } | 254 } |
| 255 | 255 |
| 256 ProfileKeyedService* | 256 BrowserContextKeyedService* |
| 257 ShellWindowGeometryCache::Factory::BuildServiceInstanceFor( | 257 ShellWindowGeometryCache::Factory::BuildServiceInstanceFor( |
| 258 content::BrowserContext* context) const { | 258 content::BrowserContext* context) const { |
| 259 Profile* profile = Profile::FromBrowserContext(context); | 259 Profile* profile = Profile::FromBrowserContext(context); |
| 260 return new ShellWindowGeometryCache( | 260 return new ShellWindowGeometryCache( |
| 261 profile, | 261 profile, |
| 262 extensions::ExtensionPrefs::Get(profile)); | 262 extensions::ExtensionPrefs::Get(profile)); |
| 263 } | 263 } |
| 264 | 264 |
| 265 bool ShellWindowGeometryCache::Factory::ServiceIsNULLWhileTesting() const { | 265 bool ShellWindowGeometryCache::Factory::ServiceIsNULLWhileTesting() const { |
| 266 return false; | 266 return false; |
| 267 } | 267 } |
| 268 | 268 |
| 269 content::BrowserContext* | 269 content::BrowserContext* |
| 270 ShellWindowGeometryCache::Factory::GetBrowserContextToUse( | 270 ShellWindowGeometryCache::Factory::GetBrowserContextToUse( |
| 271 content::BrowserContext* context) const { | 271 content::BrowserContext* context) const { |
| 272 return chrome::GetBrowserContextRedirectedInIncognito(context); | 272 return chrome::GetBrowserContextRedirectedInIncognito(context); |
| 273 } | 273 } |
| 274 | 274 |
| 275 } // namespace apps | 275 } // namespace apps |
| OLD | NEW |