| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2016 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_DOWNGRADE_USER_DATA_DOWNGRADE_H_ |
| 6 #define CHROME_BROWSER_DOWNGRADE_USER_DATA_DOWNGRADE_H_ |
| 7 |
| 8 #include "base/files/file_path.h" |
| 9 #include "base/version.h" |
| 10 |
| 11 namespace downgrade { |
| 12 |
| 13 // The suffix of pending deleted directory. |
| 14 extern const base::FilePath::CharType kDowngradeDeleteSuffix[]; |
| 15 // The name of "Last Version" file. |
| 16 extern const base::FilePath::CharType kDowngradeLastVersionFile[]; |
| 17 |
| 18 // Moves aside all directories containing user data to prevent the browser from |
| 19 // reading them when Chrome is downgraded from a higher version. When called |
| 20 // early in startup, this will result in the browser performing first-run for |
| 21 // the user. To avoid long-running I/O operations, this function merely moves |
| 22 // directories aside. A subsequent call to DeleteMovedUserDataSoon (below) must |
| 23 // be made later in startup to free up disk space. |
| 24 void MoveUserDataForFirstRunAfterDowngrade(); |
| 25 |
| 26 // Update the content of "Last Version" file with current version number |
| 27 // in |user_data_dir|. |
| 28 void UpdateLastVersion(const base::FilePath& user_data_dir); |
| 29 |
| 30 // Get the content of "Last Version" file in |user_data_dir|. |
| 31 base::Version GetLastVersion(const base::FilePath& user_data_dir); |
| 32 |
| 33 // Schedules a search for the removal of any directories moved aside by |
| 34 // MoveUserDataForFirstRunAfterDowngrade. This operation is idempotent, |
| 35 // and may be safely called when no such directories exist. |
| 36 void DeleteMovedUserDataSoon(); |
| 37 |
| 38 // Returns true if Chrome is installed by MSI. |
| 39 bool IsMSIInstall(); |
| 40 |
| 41 // Changes the behavior of the above functions to simulate a downgrade for use |
| 42 // in tests. MoveUserDataForFirstRunAfterDowngrade will no longer rely on |
| 43 // registry and DeleteMovedUserDataSoon will always post task into blocking |
| 44 // pool for brower test. |
| 45 void SetSimulateDowngradeForTest(bool is_browser_test); |
| 46 |
| 47 } // namespace downgrade |
| 48 |
| 49 #endif // CHROME_BROWSER_DOWNGRADE_USER_DATA_DOWNGRADE_H_ |
| OLD | NEW |