| 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 #include "chrome/browser/chromeos/file_manager/path_util.h" | 5 #include "chrome/browser/chromeos/file_manager/path_util.h" |
| 6 | 6 |
| 7 #include "base/files/file_path.h" | |
| 8 #include "base/logging.h" | 7 #include "base/logging.h" |
| 9 #include "base/sys_info.h" | 8 #include "base/sys_info.h" |
| 10 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 9 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| 11 #include "chrome/browser/download/download_prefs.h" | 10 #include "chrome/browser/download/download_prefs.h" |
| 12 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
| 13 #include "components/drive/file_system_core_util.h" | 12 #include "components/drive/file_system_core_util.h" |
| 14 #include "components/user_manager/user.h" | 13 #include "components/user_manager/user.h" |
| 15 #include "components/user_manager/user_manager.h" | 14 #include "components/user_manager/user_manager.h" |
| 16 #include "content/public/browser/browser_thread.h" | 15 #include "content/public/browser/browser_thread.h" |
| 17 #include "net/base/escape.h" | 16 #include "net/base/escape.h" |
| 18 #include "net/base/filename_util.h" | 17 #include "net/base/filename_util.h" |
| 19 #include "url/gurl.h" | 18 #include "url/gurl.h" |
| 20 | 19 |
| 21 namespace file_manager { | 20 namespace file_manager { |
| 22 namespace util { | 21 namespace util { |
| 23 | 22 |
| 24 namespace { | 23 namespace { |
| 25 | 24 |
| 26 const char kDownloadsFolderName[] = "Downloads"; | 25 const char kDownloadsFolderName[] = "Downloads"; |
| 27 | 26 |
| 28 constexpr base::FilePath::CharType kArcDownloadPath[] = | 27 constexpr base::FilePath::CharType kArcDownloadPath[] = |
| 29 FILE_PATH_LITERAL("/sdcard/Download"); | 28 FILE_PATH_LITERAL("/sdcard/Download"); |
| 30 constexpr base::FilePath::CharType kRemovableMediaPath[] = | |
| 31 FILE_PATH_LITERAL("/media/removable"); | |
| 32 constexpr char kArcRemovableMediaProviderUrl[] = | 29 constexpr char kArcRemovableMediaProviderUrl[] = |
| 33 "content://org.chromium.arc.removablemediaprovider/"; | 30 "content://org.chromium.arc.removablemediaprovider/"; |
| 34 | 31 |
| 35 } // namespace | 32 } // namespace |
| 36 | 33 |
| 34 const base::FilePath::CharType kRemovableMediaPath[] = |
| 35 FILE_PATH_LITERAL("/media/removable"); |
| 36 |
| 37 base::FilePath GetDownloadsFolderForProfile(Profile* profile) { | 37 base::FilePath GetDownloadsFolderForProfile(Profile* profile) { |
| 38 // On non-ChromeOS system (test+development), the primary profile uses | 38 // On non-ChromeOS system (test+development), the primary profile uses |
| 39 // $HOME/Downloads for ease for accessing local files for debugging. | 39 // $HOME/Downloads for ease for accessing local files for debugging. |
| 40 if (!base::SysInfo::IsRunningOnChromeOS() && | 40 if (!base::SysInfo::IsRunningOnChromeOS() && |
| 41 user_manager::UserManager::IsInitialized()) { | 41 user_manager::UserManager::IsInitialized()) { |
| 42 const user_manager::User* const user = | 42 const user_manager::User* const user = |
| 43 chromeos::ProfileHelper::Get()->GetUserByProfile( | 43 chromeos::ProfileHelper::Get()->GetUserByProfile( |
| 44 profile->GetOriginalProfile()); | 44 profile->GetOriginalProfile()); |
| 45 const user_manager::User* const primary_user = | 45 const user_manager::User* const primary_user = |
| 46 user_manager::UserManager::Get()->GetPrimaryUser(); | 46 user_manager::UserManager::Get()->GetPrimaryUser(); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 .Resolve(net::EscapePath(relative_path.AsUTF8Unsafe())); | 113 .Resolve(net::EscapePath(relative_path.AsUTF8Unsafe())); |
| 114 return true; | 114 return true; |
| 115 } | 115 } |
| 116 | 116 |
| 117 // TODO(kinaba): Add conversion logic once other file systems are supported. | 117 // TODO(kinaba): Add conversion logic once other file systems are supported. |
| 118 return false; | 118 return false; |
| 119 } | 119 } |
| 120 | 120 |
| 121 } // namespace util | 121 } // namespace util |
| 122 } // namespace file_manager | 122 } // namespace file_manager |
| OLD | NEW |