| 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" |
| 11 #include "base/stl_util.h" | 11 #include "base/stl_util.h" |
| 12 #include "base/strings/string_number_conversions.h" | 12 #include "base/strings/string_number_conversions.h" |
| 13 #include "base/strings/string_util.h" | 13 #include "base/strings/string_util.h" |
| 14 #include "base/strings/stringprintf.h" | 14 #include "base/strings/stringprintf.h" |
| 15 #include "webkit/browser/fileapi/file_system_url.h" | 15 #include "webkit/browser/fileapi/file_system_url.h" |
| 16 | 16 |
| 17 namespace fileapi { | 17 namespace storage { |
| 18 | 18 |
| 19 namespace { | 19 namespace { |
| 20 | 20 |
| 21 base::FilePath::StringType GetRegisterNameForPath(const base::FilePath& path) { | 21 base::FilePath::StringType GetRegisterNameForPath(const base::FilePath& path) { |
| 22 // If it's not a root path simply return a base name. | 22 // If it's not a root path simply return a base name. |
| 23 if (path.DirName() != path) | 23 if (path.DirName() != path) |
| 24 return path.BaseName().value(); | 24 return path.BaseName().value(); |
| 25 | 25 |
| 26 #if defined(FILE_PATH_USES_DRIVE_LETTERS) | 26 #if defined(FILE_PATH_USES_DRIVE_LETTERS) |
| 27 base::FilePath::StringType name; | 27 base::FilePath::StringType name; |
| (...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 474 lock_.AssertAcquired(); | 474 lock_.AssertAcquired(); |
| 475 uint32 random_data[4]; | 475 uint32 random_data[4]; |
| 476 std::string id; | 476 std::string id; |
| 477 do { | 477 do { |
| 478 base::RandBytes(random_data, sizeof(random_data)); | 478 base::RandBytes(random_data, sizeof(random_data)); |
| 479 id = base::HexEncode(random_data, sizeof(random_data)); | 479 id = base::HexEncode(random_data, sizeof(random_data)); |
| 480 } while (instance_map_.find(id) != instance_map_.end()); | 480 } while (instance_map_.find(id) != instance_map_.end()); |
| 481 return id; | 481 return id; |
| 482 } | 482 } |
| 483 | 483 |
| 484 } // namespace fileapi | 484 } // namespace storage |
| OLD | NEW |