OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 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 #include "chrome/browser/chromeos/file_system_provider/mount_path_util.h" |
| 6 |
| 7 #include "base/files/file_path.h" |
| 8 #include "base/stl_util.h" |
| 9 #include "base/strings/string_number_conversions.h" |
| 10 #include "chrome/browser/chromeos/login/user.h" |
| 11 #include "chrome/browser/chromeos/login/user_manager.h" |
| 12 |
| 13 namespace chromeos { |
| 14 namespace file_system_provider { |
| 15 namespace util { |
| 16 |
| 17 namespace { |
| 18 |
| 19 // Root mount path for all of the provided file systems. |
| 20 const base::FilePath::CharType kProvidedMountPointRoot[] = |
| 21 FILE_PATH_LITERAL("/provided"); |
| 22 |
| 23 } // namespace |
| 24 |
| 25 base::FilePath GetMountPointPath(Profile* profile, |
| 26 std::string extension_id, |
| 27 int file_system_id) { |
| 28 chromeos::User* const user = |
| 29 chromeos::UserManager::IsInitialized() |
| 30 ? chromeos::UserManager::Get()->GetUserByProfile( |
| 31 profile->GetOriginalProfile()) |
| 32 : NULL; |
| 33 const std::string user_suffix = user ? "-" + user->username_hash() : ""; |
| 34 return base::FilePath(kProvidedMountPointRoot).AppendASCII( |
| 35 extension_id + "-" + base::IntToString(file_system_id) + user_suffix); |
| 36 } |
| 37 |
| 38 } // namespace util |
| 39 } // namespace file_system_provider |
| 40 } // namespace chromeos |
OLD | NEW |