| 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 | 9 |
| 10 PlatformThreadId ExtensionResource::file_thread_id_ = 0; | 10 PlatformThreadId ExtensionResource::file_thread_id_ = 0; |
| 11 | 11 |
| 12 bool ExtensionResource::check_for_file_thread_ = false; | 12 bool ExtensionResource::check_for_file_thread_ = false; |
| 13 | 13 |
| 14 ExtensionResource::ExtensionResource() { | 14 ExtensionResource::ExtensionResource() { |
| 15 } | 15 } |
| 16 | 16 |
| 17 ExtensionResource::ExtensionResource(const FilePath& extension_root, | 17 ExtensionResource::ExtensionResource(const std::string& extension_id, |
| 18 const FilePath& extension_root, |
| 18 const FilePath& relative_path) | 19 const FilePath& relative_path) |
| 19 : extension_root_(extension_root), | 20 : extension_id_(extension_id), |
| 21 extension_root_(extension_root), |
| 20 relative_path_(relative_path) { | 22 relative_path_(relative_path) { |
| 21 } | 23 } |
| 22 | 24 |
| 23 const FilePath& ExtensionResource::GetFilePathOnAnyThreadHack() const { | 25 const FilePath& ExtensionResource::GetFilePathOnAnyThreadHack() const { |
| 24 if (extension_root_.empty() || relative_path_.empty()) { | 26 if (extension_root_.empty() || relative_path_.empty()) { |
| 25 DCHECK(full_resource_path_.empty()); | 27 DCHECK(full_resource_path_.empty()); |
| 26 return full_resource_path_; | 28 return full_resource_path_; |
| 27 } | 29 } |
| 28 | 30 |
| 29 // We've already checked, just return last value. | 31 // We've already checked, just return last value. |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 // Make sure we have a cached value to test against... | 99 // Make sure we have a cached value to test against... |
| 98 if (full_resource_path_.empty()) | 100 if (full_resource_path_.empty()) |
| 99 GetFilePath(); | 101 GetFilePath(); |
| 100 if (NormalizeSeperators(path.value()) == | 102 if (NormalizeSeperators(path.value()) == |
| 101 NormalizeSeperators(full_resource_path_.value())) { | 103 NormalizeSeperators(full_resource_path_.value())) { |
| 102 return true; | 104 return true; |
| 103 } else { | 105 } else { |
| 104 return false; | 106 return false; |
| 105 } | 107 } |
| 106 } | 108 } |
| OLD | NEW |