| 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/common/extensions/extension_resource.h" | 5 #include "chrome/common/extensions/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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 // path before resolving the symlink must still be within it. | 60 // path before resolving the symlink must still be within it. |
| 61 if (symlink_policy == FOLLOW_SYMLINKS_ANYWHERE) { | 61 if (symlink_policy == FOLLOW_SYMLINKS_ANYWHERE) { |
| 62 std::vector<FilePath::StringType> components; | 62 std::vector<FilePath::StringType> components; |
| 63 relative_path.GetComponents(&components); | 63 relative_path.GetComponents(&components); |
| 64 int depth = 0; | 64 int depth = 0; |
| 65 | 65 |
| 66 for (std::vector<FilePath::StringType>::const_iterator | 66 for (std::vector<FilePath::StringType>::const_iterator |
| 67 i = components.begin(); i != components.end(); i++) { | 67 i = components.begin(); i != components.end(); i++) { |
| 68 if (*i == FilePath::kParentDirectory) { | 68 if (*i == FilePath::kParentDirectory) { |
| 69 depth--; | 69 depth--; |
| 70 } else { | 70 } else if (*i != FilePath::kCurrentDirectory) { |
| 71 depth++; | 71 depth++; |
| 72 } | 72 } |
| 73 if (depth < 0) { | 73 if (depth < 0) { |
| 74 return FilePath(); | 74 return FilePath(); |
| 75 } | 75 } |
| 76 } | 76 } |
| 77 } | 77 } |
| 78 | 78 |
| 79 // We must resolve the absolute path of the combined path when | 79 // We must resolve the absolute path of the combined path when |
| 80 // the relative path contains references to a parent folder (i.e., '..'). | 80 // the relative path contains references to a parent folder (i.e., '..'). |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 // Make sure we have a cached value to test against... | 112 // Make sure we have a cached value to test against... |
| 113 if (full_resource_path_.empty()) | 113 if (full_resource_path_.empty()) |
| 114 GetFilePath(); | 114 GetFilePath(); |
| 115 if (NormalizeSeperators(path.value()) == | 115 if (NormalizeSeperators(path.value()) == |
| 116 NormalizeSeperators(full_resource_path_.value())) { | 116 NormalizeSeperators(full_resource_path_.value())) { |
| 117 return true; | 117 return true; |
| 118 } else { | 118 } else { |
| 119 return false; | 119 return false; |
| 120 } | 120 } |
| 121 } | 121 } |
| OLD | NEW |