| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_GARBAGE_COLLECTOR_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_GARBAGE_COLLECTOR_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_GARBAGE_COLLECTOR_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_GARBAGE_COLLECTOR_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 public: | 28 public: |
| 29 explicit ExtensionGarbageCollector(content::BrowserContext* context); | 29 explicit ExtensionGarbageCollector(content::BrowserContext* context); |
| 30 virtual ~ExtensionGarbageCollector(); | 30 virtual ~ExtensionGarbageCollector(); |
| 31 | 31 |
| 32 static ExtensionGarbageCollector* Get(content::BrowserContext* context); | 32 static ExtensionGarbageCollector* Get(content::BrowserContext* context); |
| 33 | 33 |
| 34 // Manually trigger GarbageCollectExtensions() for testing. | 34 // Manually trigger GarbageCollectExtensions() for testing. |
| 35 void GarbageCollectExtensionsForTest(); | 35 void GarbageCollectExtensionsForTest(); |
| 36 | 36 |
| 37 // Overriddes for KeyedService: | 37 // Overriddes for KeyedService: |
| 38 virtual void Shutdown() OVERRIDE; | 38 virtual void Shutdown() override; |
| 39 | 39 |
| 40 // Overriddes for InstallObserver | 40 // Overriddes for InstallObserver |
| 41 virtual void OnBeginCrxInstall(const std::string& extension_id) OVERRIDE; | 41 virtual void OnBeginCrxInstall(const std::string& extension_id) override; |
| 42 virtual void OnFinishCrxInstall(const std::string& extension_id, | 42 virtual void OnFinishCrxInstall(const std::string& extension_id, |
| 43 bool success) OVERRIDE; | 43 bool success) override; |
| 44 | 44 |
| 45 protected: | 45 protected: |
| 46 // Cleans up the extension install directory. It can end up with garbage in it | 46 // Cleans up the extension install directory. It can end up with garbage in it |
| 47 // if extensions can't initially be removed when they are uninstalled (eg if a | 47 // if extensions can't initially be removed when they are uninstalled (eg if a |
| 48 // file is in use). | 48 // file is in use). |
| 49 // Obsolete version directories are removed, as are directories that aren't | 49 // Obsolete version directories are removed, as are directories that aren't |
| 50 // found in the ExtensionPrefs. | 50 // found in the ExtensionPrefs. |
| 51 // The "Temp" directory that is used during extension installation will get | 51 // The "Temp" directory that is used during extension installation will get |
| 52 // removed iff there are no pending installations. | 52 // removed iff there are no pending installations. |
| 53 virtual void GarbageCollectExtensions(); | 53 virtual void GarbageCollectExtensions(); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 71 // Generate weak pointers for safely posting to the file thread for garbage | 71 // Generate weak pointers for safely posting to the file thread for garbage |
| 72 // collection. | 72 // collection. |
| 73 base::WeakPtrFactory<ExtensionGarbageCollector> weak_factory_; | 73 base::WeakPtrFactory<ExtensionGarbageCollector> weak_factory_; |
| 74 | 74 |
| 75 DISALLOW_COPY_AND_ASSIGN(ExtensionGarbageCollector); | 75 DISALLOW_COPY_AND_ASSIGN(ExtensionGarbageCollector); |
| 76 }; | 76 }; |
| 77 | 77 |
| 78 } // namespace extensions | 78 } // namespace extensions |
| 79 | 79 |
| 80 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_GARBAGE_COLLECTOR_H_ | 80 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_GARBAGE_COLLECTOR_H_ |
| OLD | NEW |