Roll src/third_party/WebKit f298044:aa8346d (svn 202628:202629)
[chromium-blink-merge.git] / chrome / browser / extensions / extension_garbage_collector_chromeos.h
blob2da75162caaf57378b4fbc40cb5b6f783e8f9cfd
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.
5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_GARBAGE_COLLECTOR_CHROMEOS_H_
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_GARBAGE_COLLECTOR_CHROMEOS_H_
8 #include "chrome/browser/extensions/extension_garbage_collector.h"
10 namespace extensions {
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 ~ExtensionGarbageCollectorChromeOS() override;
20 static ExtensionGarbageCollectorChromeOS* Get(
21 content::BrowserContext* context);
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; }
27 // Clear shared_extensions_garbage_collected_ to initiate more than one
28 // GC in the same process for testing.
29 static void ClearGarbageCollectedForTesting();
31 private:
32 // Overriddes for ExtensionGarbageCollector:
33 void GarbageCollectExtensions() override;
35 // Return true if there is no extension installation for all active profiles.
36 bool CanGarbageCollectSharedExtensions();
38 // Do GC for shared extensions dir.
39 void GarbageCollectSharedExtensions();
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_;
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_;
52 DISALLOW_COPY_AND_ASSIGN(ExtensionGarbageCollectorChromeOS);
55 } // namespace extensions
57 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_GARBAGE_COLLECTOR_CHROMEOS_H_