1 // Copyright 2013 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_FILE_MANAGER_VOLUME_MANAGER_FACTORY_H_ 6 #define CHROME_BROWSER_CHROMEOS_FILE_MANAGER_VOLUME_MANAGER_FACTORY_H_ 7 8 #include "base/macros.h" 9 #include "components/keyed_service/content/browser_context_keyed_service_factory.h" 10 11 namespace base { 12 template <typename T> 13 struct DefaultSingletonTraits; 14 } // namespace base 15 16 namespace content { 17 class BrowserContext; 18 } // namespace content 19 20 namespace file_manager { 21 22 class VolumeManager; 23 24 // Factory to create VolumeManager. 25 class VolumeManagerFactory : public BrowserContextKeyedServiceFactory { 26 public: 27 // Returns VolumeManager instance. 28 static VolumeManager* Get(content::BrowserContext* context); 29 30 static VolumeManagerFactory* GetInstance(); 31 32 protected: 33 // BrowserContextKeyedServiceFactory overrides: 34 content::BrowserContext* GetBrowserContextToUse( 35 content::BrowserContext* context) const override; 36 bool ServiceIsCreatedWithBrowserContext() const override; 37 bool ServiceIsNULLWhileTesting() const override; 38 KeyedService* BuildServiceInstanceFor( 39 content::BrowserContext* context) const override; 40 41 private: 42 // For Singleton. 43 friend struct base::DefaultSingletonTraits<VolumeManagerFactory>; 44 45 VolumeManagerFactory(); 46 ~VolumeManagerFactory() override; 47 48 DISALLOW_COPY_AND_ASSIGN(VolumeManagerFactory); 49 }; 50 51 } // namespace file_manager 52 53 #endif // CHROME_BROWSER_CHROMEOS_FILE_MANAGER_VOLUME_MANAGER_FACTORY_H_ 54