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 #ifndef CHROME_COMMON_EXTENSIONS_EXTENSION_RESOURCE_H_ | 5 #ifndef CHROME_COMMON_EXTENSIONS_EXTENSION_RESOURCE_H_ |
6 #define CHROME_COMMON_EXTENSIONS_EXTENSION_RESOURCE_H_ | 6 #define CHROME_COMMON_EXTENSIONS_EXTENSION_RESOURCE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 // file can be a symlink that links outside of |extension_root|. | 50 // file can be a symlink that links outside of |extension_root|. |
51 static FilePath GetFilePath(const FilePath& extension_root, | 51 static FilePath GetFilePath(const FilePath& extension_root, |
52 const FilePath& relative_path, | 52 const FilePath& relative_path, |
53 SymlinkPolicy symlink_policy); | 53 SymlinkPolicy symlink_policy); |
54 | 54 |
55 // Getters | 55 // Getters |
56 const std::string& extension_id() const { return extension_id_; } | 56 const std::string& extension_id() const { return extension_id_; } |
57 const FilePath& extension_root() const { return extension_root_; } | 57 const FilePath& extension_root() const { return extension_root_; } |
58 const FilePath& relative_path() const { return relative_path_; } | 58 const FilePath& relative_path() const { return relative_path_; } |
59 | 59 |
60 bool empty() { return extension_root().empty(); } | 60 bool empty() const { return extension_root().empty(); } |
61 | 61 |
62 // Unit test helpers. | 62 // Unit test helpers. |
63 FilePath::StringType NormalizeSeperators( | 63 FilePath::StringType NormalizeSeperators( |
64 const FilePath::StringType& path) const; | 64 const FilePath::StringType& path) const; |
65 bool ComparePathWithDefault(const FilePath& path) const; | 65 bool ComparePathWithDefault(const FilePath& path) const; |
66 | 66 |
67 private: | 67 private: |
68 // The id of the extension that this resource is associated with. | 68 // The id of the extension that this resource is associated with. |
69 std::string extension_id_; | 69 std::string extension_id_; |
70 | 70 |
71 // Extension root. | 71 // Extension root. |
72 FilePath extension_root_; | 72 FilePath extension_root_; |
73 | 73 |
74 // Relative path to resource. | 74 // Relative path to resource. |
75 FilePath relative_path_; | 75 FilePath relative_path_; |
76 | 76 |
77 // If |follow_symlinks_anywhere_| is true then the resource itself must be | 77 // If |follow_symlinks_anywhere_| is true then the resource itself must be |
78 // within |extension_root|, but it can be a symlink to a file that is not. | 78 // within |extension_root|, but it can be a symlink to a file that is not. |
79 bool follow_symlinks_anywhere_; | 79 bool follow_symlinks_anywhere_; |
80 | 80 |
81 // Full path to extension resource. Starts empty. | 81 // Full path to extension resource. Starts empty. |
82 mutable FilePath full_resource_path_; | 82 mutable FilePath full_resource_path_; |
83 }; | 83 }; |
84 | 84 |
85 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_RESOURCE_H_ | 85 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_RESOURCE_H_ |
OLD | NEW |