Home | History | Annotate | Download | only in file_manager
      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
      3 // found in the LICENSE file.
      4 
      5 #ifndef CHROME_BROWSER_CHROMEOS_FILE_MANAGER_PATH_UTIL_H_
      6 #define CHROME_BROWSER_CHROMEOS_FILE_MANAGER_PATH_UTIL_H_
      7 
      8 #include <string>
      9 
     10 class Profile;
     11 
     12 namespace base {
     13 class FilePath;
     14 }
     15 
     16 namespace file_manager {
     17 namespace util {
     18 
     19 // Gets the absolute path for the 'Downloads' folder for the |profile|.
     20 base::FilePath GetDownloadsFolderForProfile(Profile* profile);
     21 
     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").
     24 // The |profile| argument is used for determining the location of the
     25 // "Downloads" folder.
     26 //
     27 // Here's the list of relocations we have made so far.
     28 //
     29 // M27: crbug.com/229304, Migration code for this is removed in M34.
     30 //   The "Google Drive" folder is moved from /special/drive to
     31 //   /special/drive/root to stored shared files outside of "My Drive" in
     32 //   /special/drive/other.
     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,
     51                               const base::FilePath& old_path,
     52                               base::FilePath* new_path);
     53 
     54 // The canonical mount point name for "Downloads" folder.
     55 std::string GetDownloadsMountPointName(Profile* profile);
     56 
     57 }  // namespace util
     58 }  // namespace file_manager
     59 
     60 #endif  // CHROME_BROWSER_CHROMEOS_FILE_MANAGER_PATH_UTIL_H_
     61