OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/drive/drive_file_system_util.h" | 5 #include "chrome/browser/chromeos/drive/drive_file_system_util.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
225 *url = GURL(); | 225 *url = GURL(); |
226 } | 226 } |
227 } | 227 } |
228 | 228 |
229 bool IsUnderDriveMountPoint(const base::FilePath& path) { | 229 bool IsUnderDriveMountPoint(const base::FilePath& path) { |
230 return GetDriveMountPointPath() == path || | 230 return GetDriveMountPointPath() == path || |
231 GetDriveMountPointPath().IsParent(path); | 231 GetDriveMountPointPath().IsParent(path); |
232 } | 232 } |
233 | 233 |
234 bool NeedsNamespaceMigration(const base::FilePath& path) { | 234 bool NeedsNamespaceMigration(const base::FilePath& path) { |
235 return false; | 235 return IsUnderDriveMountPoint(path) && |
kinaba
2013/04/05 01:57:58
Could you add a short comment that what it means i
Haruki Sato
2013/04/05 04:43:06
Done.
| |
236 // TODO(haruki): Update this along with http://crbug.com/174233. | 236 !(GetDriveMyDriveMountPointPath() == path || |
237 // return IsUnderDriveMountPoint(path) && | 237 GetDriveMyDriveMountPointPath().IsParent(path)); |
238 // !(GetDriveMyDriveMountPointPath() == path || | |
239 // GetDriveMyDriveMountPointPath().IsParent(path)); | |
240 } | 238 } |
241 | 239 |
242 base::FilePath ConvertToMyDriveNamespace(const base::FilePath& path) { | 240 base::FilePath ConvertToMyDriveNamespace(const base::FilePath& path) { |
243 // Double check the path. | 241 DCHECK(NeedsNamespaceMigration(path)); |
244 // TODO(haruki): Update this with DCHECK(NeedsNamespaceMigration(path)). | |
245 DCHECK(IsUnderDriveMountPoint(path) && | |
246 !(GetDriveMyDriveMountPointPath() == path || | |
247 GetDriveMyDriveMountPointPath().IsParent(path))); | |
248 | 242 |
249 // Need to migrate "/special/drive(.*)" to "/special/drive/root(.*)". | 243 // Need to migrate "/special/drive(.*)" to "/special/drive/root(.*)". |
250 // Append the relative path from "/special/drive". | 244 // Append the relative path from "/special/drive". |
251 base::FilePath new_path(GetDriveMyDriveMountPointPath()); | 245 base::FilePath new_path(GetDriveMyDriveMountPointPath()); |
252 GetDriveMountPointPath().AppendRelativePath(path, &new_path); | 246 GetDriveMountPointPath().AppendRelativePath(path, &new_path); |
253 DVLOG(1) << "Migrate download.default_directory setting from " | 247 DVLOG(1) << "Migrate download.default_directory setting from " |
254 << path.AsUTF8Unsafe() << " to " << new_path.AsUTF8Unsafe(); | 248 << path.AsUTF8Unsafe() << " to " << new_path.AsUTF8Unsafe(); |
255 DCHECK(!NeedsNamespaceMigration(new_path)); | 249 DCHECK(!NeedsNamespaceMigration(new_path)); |
256 return new_path; | 250 return new_path; |
257 } | 251 } |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
430 proto->set_last_modified(file_info.last_modified.ToInternalValue()); | 424 proto->set_last_modified(file_info.last_modified.ToInternalValue()); |
431 proto->set_last_accessed(file_info.last_accessed.ToInternalValue()); | 425 proto->set_last_accessed(file_info.last_accessed.ToInternalValue()); |
432 proto->set_creation_time(file_info.creation_time.ToInternalValue()); | 426 proto->set_creation_time(file_info.creation_time.ToInternalValue()); |
433 } | 427 } |
434 | 428 |
435 void EmptyFileOperationCallback(DriveFileError error) { | 429 void EmptyFileOperationCallback(DriveFileError error) { |
436 } | 430 } |
437 | 431 |
438 } // namespace util | 432 } // namespace util |
439 } // namespace drive | 433 } // namespace drive |
OLD | NEW |