OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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_system_provider/mount_path_util.h" | 5 #include "chrome/browser/chromeos/file_system_provider/mount_path_util.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
11 #include "chrome/browser/browser_process.h" | 11 #include "chrome/browser/browser_process.h" |
12 #include "chrome/browser/chromeos/file_system_provider/provided_file_system.h" | 12 #include "chrome/browser/chromeos/file_system_provider/provided_file_system.h" |
13 #include "chrome/browser/chromeos/file_system_provider/service.h" | 13 #include "chrome/browser/chromeos/file_system_provider/service.h" |
14 #include "chrome/browser/chromeos/login/users/user_manager.h" | |
15 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 14 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
16 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
17 #include "chrome/browser/profiles/profile_manager.h" | 16 #include "chrome/browser/profiles/profile_manager.h" |
18 #include "components/user_manager/user.h" | 17 #include "components/user_manager/user.h" |
| 18 #include "components/user_manager/user_manager.h" |
19 #include "content/public/browser/browser_thread.h" | 19 #include "content/public/browser/browser_thread.h" |
20 | 20 |
21 using content::BrowserThread; | 21 using content::BrowserThread; |
22 | 22 |
23 namespace chromeos { | 23 namespace chromeos { |
24 namespace file_system_provider { | 24 namespace file_system_provider { |
25 namespace util { | 25 namespace util { |
26 | 26 |
27 namespace { | 27 namespace { |
28 | 28 |
(...skipping 15 matching lines...) Expand all Loading... |
44 escaped.push_back(c); | 44 escaped.push_back(c); |
45 } | 45 } |
46 } | 46 } |
47 return escaped; | 47 return escaped; |
48 } | 48 } |
49 | 49 |
50 base::FilePath GetMountPath(Profile* profile, | 50 base::FilePath GetMountPath(Profile* profile, |
51 const std::string& extension_id, | 51 const std::string& extension_id, |
52 const std::string& file_system_id) { | 52 const std::string& file_system_id) { |
53 user_manager::User* const user = | 53 user_manager::User* const user = |
54 chromeos::UserManager::IsInitialized() | 54 user_manager::UserManager::IsInitialized() |
55 ? chromeos::ProfileHelper::Get()->GetUserByProfile( | 55 ? chromeos::ProfileHelper::Get()->GetUserByProfile( |
56 profile->GetOriginalProfile()) | 56 profile->GetOriginalProfile()) |
57 : NULL; | 57 : NULL; |
58 const std::string safe_file_system_id = EscapeFileSystemId(file_system_id); | 58 const std::string safe_file_system_id = EscapeFileSystemId(file_system_id); |
59 const std::string username_suffix = user ? user->username_hash() : ""; | 59 const std::string username_suffix = user ? user->username_hash() : ""; |
60 return base::FilePath(kProvidedMountPointRoot).AppendASCII( | 60 return base::FilePath(kProvidedMountPointRoot).AppendASCII( |
61 extension_id + ":" + safe_file_system_id + ":" + username_suffix); | 61 extension_id + ":" + safe_file_system_id + ":" + username_suffix); |
62 } | 62 } |
63 | 63 |
64 bool IsFileSystemProviderLocalPath(const base::FilePath& local_path) { | 64 bool IsFileSystemProviderLocalPath(const base::FilePath& local_path) { |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 for (size_t i = 3; i < components.size(); ++i) { | 170 for (size_t i = 3; i < components.size(); ++i) { |
171 file_path_ = file_path_.Append(components[i]); | 171 file_path_ = file_path_.Append(components[i]); |
172 } | 172 } |
173 | 173 |
174 return true; | 174 return true; |
175 } | 175 } |
176 | 176 |
177 } // namespace util | 177 } // namespace util |
178 } // namespace file_system_provider | 178 } // namespace file_system_provider |
179 } // namespace chromeos | 179 } // namespace chromeos |
OLD | NEW |