Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5101)

Unified Diff: chrome/browser/downgrade/user_data_downgrade.h

Issue 1986823002: Reset user data directory and disk cache directory after downgrade. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/downgrade/OWNER ('k') | chrome/browser/downgrade/user_data_downgrade.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/downgrade/user_data_downgrade.h
diff --git a/chrome/browser/downgrade/user_data_downgrade.h b/chrome/browser/downgrade/user_data_downgrade.h
new file mode 100644
index 0000000000000000000000000000000000000000..3ccd9290c87ead3964beb1852bc39bda972ae973
--- /dev/null
+++ b/chrome/browser/downgrade/user_data_downgrade.h
@@ -0,0 +1,49 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_DOWNGRADE_USER_DATA_DOWNGRADE_H_
+#define CHROME_BROWSER_DOWNGRADE_USER_DATA_DOWNGRADE_H_
+
+#include "base/files/file_path.h"
+#include "base/version.h"
+
+namespace downgrade {
+
+// The suffix of pending deleted directory.
+extern const base::FilePath::CharType kDowngradeDeleteSuffix[];
+// The name of "Last Version" file.
+extern const base::FilePath::CharType kDowngradeLastVersionFile[];
+
+// Moves aside all directories containing user data to prevent the browser from
+// reading them when Chrome is downgraded from a higher version. When called
+// early in startup, this will result in the browser performing first-run for
+// the user. To avoid long-running I/O operations, this function merely moves
+// directories aside. A subsequent call to DeleteMovedUserDataSoon (below) must
+// be made later in startup to free up disk space.
+void MoveUserDataForFirstRunAfterDowngrade();
+
+// Update the content of "Last Version" file with current version number
+// in |user_data_dir|.
+void UpdateLastVersion(const base::FilePath& user_data_dir);
+
+// Get the content of "Last Version" file in |user_data_dir|.
+base::Version GetLastVersion(const base::FilePath& user_data_dir);
+
+// Schedules a search for the removal of any directories moved aside by
+// MoveUserDataForFirstRunAfterDowngrade. This operation is idempotent,
+// and may be safely called when no such directories exist.
+void DeleteMovedUserDataSoon();
+
+// Returns true if Chrome is installed by MSI.
+bool IsMSIInstall();
+
+// Changes the behavior of the above functions to simulate a downgrade for use
+// in tests. MoveUserDataForFirstRunAfterDowngrade will no longer rely on
+// registry and DeleteMovedUserDataSoon will always post task into blocking
+// pool for brower test.
+void SetSimulateDowngradeForTest(bool is_browser_test);
+
+} // namespace downgrade
+
+#endif // CHROME_BROWSER_DOWNGRADE_USER_DATA_DOWNGRADE_H_
« no previous file with comments | « chrome/browser/downgrade/OWNER ('k') | chrome/browser/downgrade/user_data_downgrade.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698