| 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 "webkit/browser/fileapi/isolated_context.h" | 5 #include "webkit/browser/fileapi/isolated_context.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/rand_util.h" | 10 #include "base/rand_util.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 } | 34 } |
| 35 name.append(1, path.value()[i]); | 35 name.append(1, path.value()[i]); |
| 36 } | 36 } |
| 37 return name; | 37 return name; |
| 38 #else | 38 #else |
| 39 return FILE_PATH_LITERAL("<root>"); | 39 return FILE_PATH_LITERAL("<root>"); |
| 40 #endif | 40 #endif |
| 41 } | 41 } |
| 42 | 42 |
| 43 bool IsSinglePathIsolatedFileSystem(FileSystemType type) { | 43 bool IsSinglePathIsolatedFileSystem(FileSystemType type) { |
| 44 switch (type) { | 44 DCHECK_NE(kFileSystemTypeUnknown, type); |
| 45 // As of writing dragged file system is the only filesystem | 45 // As of writing dragged file system is the only filesystem which could have |
| 46 // which could have multiple top-level paths. | 46 // multiple top-level paths. |
| 47 case kFileSystemTypeDragged: | 47 return type != kFileSystemTypeDragged; |
| 48 return false; | |
| 49 | |
| 50 case kFileSystemTypeUnknown: | |
| 51 NOTREACHED(); | |
| 52 return true; | |
| 53 | |
| 54 default: | |
| 55 return true; | |
| 56 } | |
| 57 NOTREACHED(); | |
| 58 return true; | |
| 59 } | 48 } |
| 60 | 49 |
| 61 static base::LazyInstance<IsolatedContext>::Leaky g_isolated_context = | 50 static base::LazyInstance<IsolatedContext>::Leaky g_isolated_context = |
| 62 LAZY_INSTANCE_INITIALIZER; | 51 LAZY_INSTANCE_INITIALIZER; |
| 63 | 52 |
| 64 } // namespace | 53 } // namespace |
| 65 | 54 |
| 66 IsolatedContext::FileInfoSet::FileInfoSet() {} | 55 IsolatedContext::FileInfoSet::FileInfoSet() {} |
| 67 IsolatedContext::FileInfoSet::~FileInfoSet() {} | 56 IsolatedContext::FileInfoSet::~FileInfoSet() {} |
| 68 | 57 |
| (...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 470 uint32 random_data[4]; | 459 uint32 random_data[4]; |
| 471 std::string id; | 460 std::string id; |
| 472 do { | 461 do { |
| 473 base::RandBytes(random_data, sizeof(random_data)); | 462 base::RandBytes(random_data, sizeof(random_data)); |
| 474 id = base::HexEncode(random_data, sizeof(random_data)); | 463 id = base::HexEncode(random_data, sizeof(random_data)); |
| 475 } while (instance_map_.find(id) != instance_map_.end()); | 464 } while (instance_map_.find(id) != instance_map_.end()); |
| 476 return id; | 465 return id; |
| 477 } | 466 } |
| 478 | 467 |
| 479 } // namespace fileapi | 468 } // namespace fileapi |
| OLD | NEW |