1 // Copyright 2014 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_EXTENSIONS_EXTENSION_GARBAGE_COLLECTOR_CHROMEOS_H_ 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_GARBAGE_COLLECTOR_CHROMEOS_H_ 7 8 #include "chrome/browser/extensions/extension_garbage_collector.h" 9 10 namespace extensions { 11 12 // Chrome OS specific extensions garbage collector. In addition to base class 13 // it also cleans up extensions install directory in shared location, see 14 // ExtensionAssetsManagerChromeOS. 15 class ExtensionGarbageCollectorChromeOS : public ExtensionGarbageCollector { 16 public: 17 explicit ExtensionGarbageCollectorChromeOS(content::BrowserContext* context); 18 virtual ~ExtensionGarbageCollectorChromeOS(); 19 20 static ExtensionGarbageCollectorChromeOS* Get( 21 content::BrowserContext* context); 22 23 // Enable or disable garbage collection. See |disable_garbage_collection_|. 24 void disable_garbage_collection() { disable_garbage_collection_ = true; } 25 void enable_garbage_collection() { disable_garbage_collection_ = false; } 26 27 // Clear shared_extensions_garbage_collected_ to initiate more than one 28 // GC in the same process for testing. 29 static void ClearGarbageCollectedForTesting(); 30 31 private: 32 // Overriddes for ExtensionGarbageCollector: 33 virtual void GarbageCollectExtensions() OVERRIDE; 34 35 // Return true if there is no extension installation for all active profiles. 36 bool CanGarbageCollectSharedExtensions(); 37 38 // Do GC for shared extensions dir. 39 void GarbageCollectSharedExtensions(); 40 41 // TODO(rkc): HACK alert - this is only in place to allow the 42 // kiosk_mode_screensaver to prevent its extension from getting garbage 43 // collected. Remove this once KioskModeScreensaver is removed. 44 // See crbug.com/280363 45 bool disable_garbage_collection_; 46 47 // Shared extensions need to be processed only once but instances of this 48 // class are created per-profile so this static variable prevents multiple 49 // processing. 50 static bool shared_extensions_garbage_collected_; 51 52 DISALLOW_COPY_AND_ASSIGN(ExtensionGarbageCollectorChromeOS); 53 }; 54 55 } // namespace extensions 56 57 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_GARBAGE_COLLECTOR_CHROMEOS_H_ 58