| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 |
| 11 ExtensionResource::ExtensionResource() { | 11 ExtensionResource::ExtensionResource() { |
| 12 } | 12 } |
| 13 | 13 |
| 14 ExtensionResource::ExtensionResource(const std::string& extension_id, | 14 ExtensionResource::ExtensionResource(const std::string& extension_id, |
| 15 const FilePath& extension_root, | 15 const FilePath& extension_root, |
| 16 const FilePath& relative_path) | 16 const FilePath& relative_path) |
| 17 : extension_id_(extension_id), | 17 : extension_id_(extension_id), |
| 18 extension_root_(extension_root), | 18 extension_root_(extension_root), |
| 19 relative_path_(relative_path) { | 19 relative_path_(relative_path) { |
| 20 } | 20 } |
| 21 | 21 |
| 22 ExtensionResource::~ExtensionResource() {} |
| 23 |
| 22 const FilePath& ExtensionResource::GetFilePath() const { | 24 const FilePath& ExtensionResource::GetFilePath() const { |
| 23 if (extension_root_.empty() || relative_path_.empty()) { | 25 if (extension_root_.empty() || relative_path_.empty()) { |
| 24 DCHECK(full_resource_path_.empty()); | 26 DCHECK(full_resource_path_.empty()); |
| 25 return full_resource_path_; | 27 return full_resource_path_; |
| 26 } | 28 } |
| 27 | 29 |
| 28 // We've already checked, just return last value. | 30 // We've already checked, just return last value. |
| 29 if (!full_resource_path_.empty()) | 31 if (!full_resource_path_.empty()) |
| 30 return full_resource_path_; | 32 return full_resource_path_; |
| 31 | 33 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 // Make sure we have a cached value to test against... | 80 // Make sure we have a cached value to test against... |
| 79 if (full_resource_path_.empty()) | 81 if (full_resource_path_.empty()) |
| 80 GetFilePath(); | 82 GetFilePath(); |
| 81 if (NormalizeSeperators(path.value()) == | 83 if (NormalizeSeperators(path.value()) == |
| 82 NormalizeSeperators(full_resource_path_.value())) { | 84 NormalizeSeperators(full_resource_path_.value())) { |
| 83 return true; | 85 return true; |
| 84 } else { | 86 } else { |
| 85 return false; | 87 return false; |
| 86 } | 88 } |
| 87 } | 89 } |
| OLD | NEW |