| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/sandbox_isolated_origin_database.h" | 5 #include "storage/browser/fileapi/sandbox_isolated_origin_database.h" |
| 6 | 6 |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "webkit/browser/fileapi/sandbox_origin_database.h" | 9 #include "storage/browser/fileapi/sandbox_origin_database.h" |
| 10 | 10 |
| 11 namespace fileapi { | 11 namespace storage { |
| 12 | 12 |
| 13 // Special directory name for isolated origin. | 13 // Special directory name for isolated origin. |
| 14 const base::FilePath::CharType | 14 const base::FilePath::CharType |
| 15 SandboxIsolatedOriginDatabase::kObsoleteOriginDirectory[] = | 15 SandboxIsolatedOriginDatabase::kObsoleteOriginDirectory[] = |
| 16 FILE_PATH_LITERAL("iso"); | 16 FILE_PATH_LITERAL("iso"); |
| 17 | 17 |
| 18 SandboxIsolatedOriginDatabase::SandboxIsolatedOriginDatabase( | 18 SandboxIsolatedOriginDatabase::SandboxIsolatedOriginDatabase( |
| 19 const std::string& origin, | 19 const std::string& origin, |
| 20 const base::FilePath& file_system_directory, | 20 const base::FilePath& file_system_directory, |
| 21 const base::FilePath& origin_directory) | 21 const base::FilePath& origin_directory) |
| 22 : migration_checked_(false), | 22 : migration_checked_(false), |
| 23 origin_(origin), | 23 origin_(origin), |
| 24 file_system_directory_(file_system_directory), | 24 file_system_directory_(file_system_directory), |
| 25 origin_directory_(origin_directory) { | 25 origin_directory_(origin_directory) { |
| 26 } | 26 } |
| 27 | 27 |
| 28 SandboxIsolatedOriginDatabase::~SandboxIsolatedOriginDatabase() { | 28 SandboxIsolatedOriginDatabase::~SandboxIsolatedOriginDatabase() { |
| 29 } | 29 } |
| 30 | 30 |
| 31 bool SandboxIsolatedOriginDatabase::HasOriginPath( | 31 bool SandboxIsolatedOriginDatabase::HasOriginPath(const std::string& origin) { |
| 32 const std::string& origin) { | |
| 33 return (origin_ == origin); | 32 return (origin_ == origin); |
| 34 } | 33 } |
| 35 | 34 |
| 36 bool SandboxIsolatedOriginDatabase::GetPathForOrigin( | 35 bool SandboxIsolatedOriginDatabase::GetPathForOrigin( |
| 37 const std::string& origin, base::FilePath* directory) { | 36 const std::string& origin, |
| 37 base::FilePath* directory) { |
| 38 if (origin != origin_) | 38 if (origin != origin_) |
| 39 return false; | 39 return false; |
| 40 *directory = origin_directory_; | 40 *directory = origin_directory_; |
| 41 return true; | 41 return true; |
| 42 } | 42 } |
| 43 | 43 |
| 44 bool SandboxIsolatedOriginDatabase::RemovePathForOrigin( | 44 bool SandboxIsolatedOriginDatabase::RemovePathForOrigin( |
| 45 const std::string& origin) { | 45 const std::string& origin) { |
| 46 return true; | 46 return true; |
| 47 } | 47 } |
| (...skipping 22 matching lines...) Expand all Loading... |
| 70 | 70 |
| 71 base::FilePath directory_name; | 71 base::FilePath directory_name; |
| 72 if (database->GetPathForOrigin(origin, &directory_name)) { | 72 if (database->GetPathForOrigin(origin, &directory_name)) { |
| 73 base::FilePath origin_directory = | 73 base::FilePath origin_directory = |
| 74 file_system_directory.Append(directory_name); | 74 file_system_directory.Append(directory_name); |
| 75 base::DeleteFile(origin_directory, true /* recursive */); | 75 base::DeleteFile(origin_directory, true /* recursive */); |
| 76 base::Move(isolated_directory, origin_directory); | 76 base::Move(isolated_directory, origin_directory); |
| 77 } | 77 } |
| 78 } | 78 } |
| 79 | 79 |
| 80 } // namespace fileapi | 80 } // namespace storage |
| OLD | NEW |