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 3 // found in the LICENSE file. 4 5 #ifndef CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_FILE_BROWSER_PRIVATE_API_FACTORY_H_ 6 #define CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_FILE_BROWSER_PRIVATE_API_FACTORY_H_ 7 8 #include "base/memory/singleton.h" 9 #include "components/browser_context_keyed_service/browser_context_keyed_service_factory.h" 10 11 class Profile; 12 13 namespace file_manager { 14 15 class FileBrowserPrivateAPI; 16 17 class FileBrowserPrivateAPIFactory : public BrowserContextKeyedServiceFactory { 18 public: 19 // Returns the FileBrowserPrivateAPI for |profile|, creating it if 20 // it is not yet created. 21 static FileBrowserPrivateAPI* GetForProfile(Profile* profile); 22 23 // Returns the FileBrowserPrivateAPIFactory instance. 24 static FileBrowserPrivateAPIFactory* GetInstance(); 25 26 protected: 27 // BrowserContextKeyedBaseFactory overrides: 28 virtual content::BrowserContext* GetBrowserContextToUse( 29 content::BrowserContext* context) const OVERRIDE; 30 virtual bool ServiceIsCreatedWithBrowserContext() const OVERRIDE; 31 virtual bool ServiceIsNULLWhileTesting() const OVERRIDE; 32 33 private: 34 friend struct DefaultSingletonTraits<FileBrowserPrivateAPIFactory>; 35 36 FileBrowserPrivateAPIFactory(); 37 virtual ~FileBrowserPrivateAPIFactory(); 38 39 // BrowserContextKeyedServiceFactory: 40 virtual BrowserContextKeyedService* BuildServiceInstanceFor( 41 content::BrowserContext* profile) const OVERRIDE; 42 }; 43 44 } // namespace file_manager 45 46 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_FILE_BROWSER_PRIVATE_API_FACTORY_H_ 47