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 #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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/file_path.h" | 11 #include "base/file_path.h" |
12 | 12 |
13 // Represents a resource inside an extension. For example, an image, or a | 13 // Represents a resource inside an extension. For example, an image, or a |
14 // JavaScript file. This is more complicated than just a simple FilePath | 14 // JavaScript file. This is more complicated than just a simple FilePath |
15 // because extension resources can come from multiple physical file locations | 15 // because extension resources can come from multiple physical file locations |
16 // depending on locale. | 16 // depending on locale. |
17 class ExtensionResource { | 17 class ExtensionResource { |
18 public: | 18 public: |
19 ExtensionResource(); | 19 ExtensionResource(); |
20 | 20 |
21 ExtensionResource(const std::string& extension_id, | 21 ExtensionResource(const std::string& extension_id, |
22 const FilePath& extension_root, | 22 const FilePath& extension_root, |
23 const FilePath& relative_path); | 23 const FilePath& relative_path); |
24 | 24 |
| 25 ~ExtensionResource(); |
| 26 |
25 // Returns actual path to the resource (default or locale specific). In the | 27 // Returns actual path to the resource (default or locale specific). In the |
26 // browser process, this will DCHECK if not called on the file thread. To | 28 // browser process, this will DCHECK if not called on the file thread. To |
27 // easily load extension images on the UI thread, see ImageLoadingTracker. | 29 // easily load extension images on the UI thread, see ImageLoadingTracker. |
28 const FilePath& GetFilePath() const; | 30 const FilePath& GetFilePath() const; |
29 | 31 |
30 // Gets the physical file path for the extension resource, taking into account | 32 // Gets the physical file path for the extension resource, taking into account |
31 // localization. In the browser process, this will DCHECK if not called on the | 33 // localization. In the browser process, this will DCHECK if not called on the |
32 // file thread. To easily load extension images on the UI thread, see | 34 // file thread. To easily load extension images on the UI thread, see |
33 // ImageLoadingTracker. | 35 // ImageLoadingTracker. |
34 static FilePath GetFilePath(const FilePath& extension_root, | 36 static FilePath GetFilePath(const FilePath& extension_root, |
(...skipping 18 matching lines...) Expand all Loading... |
53 FilePath extension_root_; | 55 FilePath extension_root_; |
54 | 56 |
55 // Relative path to resource. | 57 // Relative path to resource. |
56 FilePath relative_path_; | 58 FilePath relative_path_; |
57 | 59 |
58 // Full path to extension resource. Starts empty. | 60 // Full path to extension resource. Starts empty. |
59 mutable FilePath full_resource_path_; | 61 mutable FilePath full_resource_path_; |
60 }; | 62 }; |
61 | 63 |
62 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_RESOURCE_H_ | 64 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_RESOURCE_H_ |
OLD | NEW |