OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_CHROMEOS_FILE_MANAGER_PATH_UTIL_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_FILE_MANAGER_PATH_UTIL_H_ |
6 #define CHROME_BROWSER_CHROMEOS_FILE_MANAGER_PATH_UTIL_H_ | 6 #define CHROME_BROWSER_CHROMEOS_FILE_MANAGER_PATH_UTIL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 class Profile; | 10 class Profile; |
11 | 11 |
12 namespace base { | 12 namespace base { |
13 class FilePath; | 13 class FilePath; |
14 } | 14 } |
15 | 15 |
16 namespace file_manager { | 16 namespace file_manager { |
17 namespace util { | 17 namespace util { |
18 | 18 |
19 // Gets the absolute path for the 'Downloads' folder for the |profile|. | 19 // Gets the absolute path for the 'Downloads' folder for the |profile|. |
20 base::FilePath GetDownloadsFolderForProfile(Profile* profile); | 20 base::FilePath GetDownloadsFolderForProfile(Profile* profile); |
21 | 21 |
22 // Converts |old_path| to |new_path| and returns true, if the old path points | 22 // Converts |old_path| to |new_path| and returns true, if the old path points |
23 // to an old location of user folders (in "Downloads" or "Google Drive"). | 23 // to an old location of user folders (in "Downloads" or "Google Drive"). |
24 // The |profile| argument is used for determining the location of the | 24 // The |profile| argument is used for determining the location of the |
25 // "Downloads" folder. | 25 // "Downloads" folder. |
26 // | 26 // |
27 // Here's the list of relocations we have made so far. | 27 // As of now (M40), the conversion is used only during initialization of |
| 28 // download_prefs, where profile unaware initialization precedes profile |
| 29 // aware stage. Below are the list of relocations we have made in the past. |
28 // | 30 // |
29 // M27: crbug.com/229304, Migration code for this is removed in M34. | 31 // M27: crbug.com/229304, for supporting {offline, recent, shared} folders |
30 // The "Google Drive" folder is moved from /special/drive to | 32 // in Drive. Migration code for this is removed in M34. |
31 // /special/drive/root to stored shared files outside of "My Drive" in | 33 // M34-35: crbug.com/313539, 356322, for supporting multi profiles. |
32 // /special/drive/other. | 34 // Migration code is removed in M40. |
33 // | |
34 // M34: crbug.com/313539 | |
35 // The "Downloads" folder is changed from /home/chronos/user/Downloads to | |
36 // /home/chronos/u-<hash>/Downloads when multi-profile is enabled. | |
37 // | |
38 // The path "/home/chronos/user" is a hard link to the u-<hash> directory of | |
39 // the primary profile of the current session. The two paths always meant the | |
40 // same directory before multi-profiles. However, for secondary profiles in | |
41 // a multi-profile session, the "user" path cannot be used to mean "its own" | |
42 // Download folder anymore. Thus we are switching to always use "u-<hash>" | |
43 // that consistently works whether or not it is primary. | |
44 // | |
45 // M35: crbug.com/356322 | |
46 // It turned out even if multi-profile is disabled, u-<hash> style profile | |
47 // can be used in some situations. To address the cases, we add a migration | |
48 // from /home/chronos/u-<hash>/Downloads to current Download path. | |
49 // This just results in no-op when multi-profile is enabled. | |
50 bool MigratePathFromOldFormat(Profile* profile, | 35 bool MigratePathFromOldFormat(Profile* profile, |
51 const base::FilePath& old_path, | 36 const base::FilePath& old_path, |
52 base::FilePath* new_path); | 37 base::FilePath* new_path); |
53 | 38 |
54 // The canonical mount point name for "Downloads" folder. | 39 // The canonical mount point name for "Downloads" folder. |
55 std::string GetDownloadsMountPointName(Profile* profile); | 40 std::string GetDownloadsMountPointName(Profile* profile); |
56 | 41 |
57 } // namespace util | 42 } // namespace util |
58 } // namespace file_manager | 43 } // namespace file_manager |
59 | 44 |
60 #endif // CHROME_BROWSER_CHROMEOS_FILE_MANAGER_PATH_UTIL_H_ | 45 #endif // CHROME_BROWSER_CHROMEOS_FILE_MANAGER_PATH_UTIL_H_ |
OLD | NEW |