| 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 19 matching lines...) Expand all Loading... |
| 30 | 30 |
| 31 ~ExtensionResource(); | 31 ~ExtensionResource(); |
| 32 | 32 |
| 33 // set_follow_symlinks_anywhere allows the resource to be a symlink to | 33 // set_follow_symlinks_anywhere allows the resource to be a symlink to |
| 34 // anywhere in the filesystem. By default, resources have to be within | 34 // anywhere in the filesystem. By default, resources have to be within |
| 35 // |extension_root| after resolving symlinks. | 35 // |extension_root| after resolving symlinks. |
| 36 void set_follow_symlinks_anywhere(); | 36 void set_follow_symlinks_anywhere(); |
| 37 | 37 |
| 38 // Returns actual path to the resource (default or locale specific). In the | 38 // Returns actual path to the resource (default or locale specific). In the |
| 39 // browser process, this will DCHECK if not called on the file thread. To | 39 // browser process, this will DCHECK if not called on the file thread. To |
| 40 // easily load extension images on the UI thread, see ImageLoadingTracker. | 40 // easily load extension images on the UI thread, see ImageLoader. |
| 41 const base::FilePath& GetFilePath() const; | 41 const base::FilePath& GetFilePath() const; |
| 42 | 42 |
| 43 // Gets the physical file path for the extension resource, taking into account | 43 // Gets the physical file path for the extension resource, taking into account |
| 44 // localization. In the browser process, this will DCHECK if not called on the | 44 // localization. In the browser process, this will DCHECK if not called on the |
| 45 // file thread. To easily load extension images on the UI thread, see | 45 // file thread. To easily load extension images on the UI thread, see |
| 46 // ImageLoadingTracker. | 46 // ImageLoader. |
| 47 // | 47 // |
| 48 // The relative path must not resolve to a location outside of | 48 // The relative path must not resolve to a location outside of |
| 49 // |extension_root|. Iff |file_can_symlink_outside_root| is true, then the | 49 // |extension_root|. Iff |file_can_symlink_outside_root| is true, then the |
| 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 base::FilePath GetFilePath(const base::FilePath& extension_root, | 51 static base::FilePath GetFilePath(const base::FilePath& extension_root, |
| 52 const base::FilePath& relative_path, | 52 const base::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_; } |
| (...skipping 19 matching lines...) Expand all Loading... |
| 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 base::FilePath full_resource_path_; | 82 mutable base::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 |