11e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)// Copyright 2013 The Chromium Authors. All rights reserved. 21e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be 31e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)// found in the LICENSE file. 41e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) 51e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)#ifndef CHROME_BROWSER_UI_APP_LIST_SEARCH_COMMON_WEBSERVICE_CACHE_FACTORY_H_ 61e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)#define CHROME_BROWSER_UI_APP_LIST_SEARCH_COMMON_WEBSERVICE_CACHE_FACTORY_H_ 71e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) 8a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#include "components/keyed_service/content/browser_context_keyed_service_factory.h" 91e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) 101e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)template<typename T> struct DefaultSingletonTraits; 111e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) 121e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)namespace content { 131e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)class BrowserContext; 141e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)} 151e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) 161e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)namespace app_list { 171e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) 181e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)class WebserviceCache; 191e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) 201e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)// Singleton that owns the WebserviceCaches and associates them with profiles; 211e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)class WebserviceCacheFactory : public BrowserContextKeyedServiceFactory { 221e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) public: 231e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) // Returns singleton instance of WebserviceCacheFactory. 241e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) static WebserviceCacheFactory* GetInstance(); 251e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) 261e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) // Returns the Webservice cache associated with |context|. 271e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) static WebserviceCache* GetForBrowserContext( 281e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) content::BrowserContext* context); 291e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) 301e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) private: 311e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) friend struct DefaultSingletonTraits<WebserviceCacheFactory>; 321e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) 331e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) WebserviceCacheFactory(); 341e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) virtual ~WebserviceCacheFactory(); 351e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) 361e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) // BrowserContextKeyedServiceFactory overrides: 37a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) virtual KeyedService* BuildServiceInstanceFor( 381e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) content::BrowserContext* context) const OVERRIDE; 391e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) 401e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) DISALLOW_COPY_AND_ASSIGN(WebserviceCacheFactory); 411e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)}; 421e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) 431e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)} // namespace app_list 441e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) 451e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)#endif // CHROME_BROWSER_UI_APP_LIST_SEARCH_COMMON_WEBSERVICE_CACHE_FACTORY_H_ 46