ryanackley | 48bedbd | 2015-01-27 23:12:14 | [diff] [blame] | 1 | // Copyright 2015 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_APP_DATA_MIGRATOR_H_ |
| 6 | #define CHROME_BROWSER_EXTENSIONS_APP_DATA_MIGRATOR_H_ |
| 7 | |
| 8 | #include "base/callback_forward.h" |
| 9 | #include "base/macros.h" |
| 10 | #include "base/memory/weak_ptr.h" |
| 11 | |
| 12 | class Profile; |
| 13 | |
| 14 | namespace extensions { |
| 15 | class Extension; |
| 16 | class ExtensionRegistry; |
| 17 | |
| 18 | // This class migrates legacy packaged app data in the general storage |
| 19 | // partition to an isolated storage partition. This happens when a legacy |
| 20 | // packaged app is upgraded to a platform app. See http://crbug.com/302577 |
| 21 | class AppDataMigrator { |
| 22 | public: |
| 23 | AppDataMigrator(Profile* profile, ExtensionRegistry* registry); |
| 24 | ~AppDataMigrator(); |
| 25 | |
| 26 | static bool NeedsMigration(const Extension* old, const Extension* extension); |
| 27 | |
| 28 | void DoMigrationAndReply(const Extension* old, |
| 29 | const Extension* extension, |
| 30 | const base::Closure& reply); |
| 31 | |
| 32 | private: |
| 33 | Profile* profile_; |
| 34 | ExtensionRegistry* registry_; |
Jeremy Roman | 495db68 | 2019-07-12 16:03:24 | [diff] [blame] | 35 | base::WeakPtrFactory<AppDataMigrator> weak_factory_{this}; |
ryanackley | 48bedbd | 2015-01-27 23:12:14 | [diff] [blame] | 36 | |
| 37 | DISALLOW_COPY_AND_ASSIGN(AppDataMigrator); |
| 38 | }; |
| 39 | |
| 40 | } // namespace extensions |
| 41 | |
| 42 | #endif // CHROME_BROWSER_EXTENSIONS_APP_DATA_MIGRATOR_H_ |