| 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 "extensions/common/extension_resource.h" | 5 #include "extensions/common/extension_resource.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 "base/threading/thread_restrictions.h" | 9 #include "base/threading/thread_restrictions.h" |
| 10 | 10 |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 | 81 |
| 82 // We must resolve the absolute path of the combined path when | 82 // We must resolve the absolute path of the combined path when |
| 83 // the relative path contains references to a parent folder (i.e., '..'). | 83 // the relative path contains references to a parent folder (i.e., '..'). |
| 84 // We also check if the path exists because the posix version of | 84 // We also check if the path exists because the posix version of |
| 85 // MakeAbsoluteFilePath will fail if the path doesn't exist, and we want the | 85 // MakeAbsoluteFilePath will fail if the path doesn't exist, and we want the |
| 86 // same behavior on Windows... So until the posix and Windows version of | 86 // same behavior on Windows... So until the posix and Windows version of |
| 87 // MakeAbsoluteFilePath are unified, we need an extra call to PathExists, | 87 // MakeAbsoluteFilePath are unified, we need an extra call to PathExists, |
| 88 // unfortunately. | 88 // unfortunately. |
| 89 // TODO(mad): Fix this once MakeAbsoluteFilePath is unified. | 89 // TODO(mad): Fix this once MakeAbsoluteFilePath is unified. |
| 90 full_path = base::MakeAbsoluteFilePath(full_path); | 90 full_path = base::MakeAbsoluteFilePath(full_path); |
| 91 if (file_util::PathExists(full_path) && | 91 if (base::PathExists(full_path) && |
| 92 (symlink_policy == FOLLOW_SYMLINKS_ANYWHERE || | 92 (symlink_policy == FOLLOW_SYMLINKS_ANYWHERE || |
| 93 clean_extension_root.IsParent(full_path))) { | 93 clean_extension_root.IsParent(full_path))) { |
| 94 return full_path; | 94 return full_path; |
| 95 } | 95 } |
| 96 | 96 |
| 97 return base::FilePath(); | 97 return base::FilePath(); |
| 98 } | 98 } |
| 99 | 99 |
| 100 // Unit-testing helpers. | 100 // Unit-testing helpers. |
| 101 base::FilePath::StringType ExtensionResource::NormalizeSeperators( | 101 base::FilePath::StringType ExtensionResource::NormalizeSeperators( |
| (...skipping 17 matching lines...) Expand all Loading... |
| 119 GetFilePath(); | 119 GetFilePath(); |
| 120 if (NormalizeSeperators(path.value()) == | 120 if (NormalizeSeperators(path.value()) == |
| 121 NormalizeSeperators(full_resource_path_.value())) { | 121 NormalizeSeperators(full_resource_path_.value())) { |
| 122 return true; | 122 return true; |
| 123 } else { | 123 } else { |
| 124 return false; | 124 return false; |
| 125 } | 125 } |
| 126 } | 126 } |
| 127 | 127 |
| 128 } // namespace extensions | 128 } // namespace extensions |
| OLD | NEW |