| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 EXTENSIONS_COMMON_FILE_UTIL_H_ | 5 #ifndef EXTENSIONS_COMMON_FILE_UTIL_H_ |
| 6 #define EXTENSIONS_COMMON_FILE_UTIL_H_ | 6 #define EXTENSIONS_COMMON_FILE_UTIL_H_ |
| 7 | 7 |
| 8 #include <string> |
| 9 |
| 10 #include "extensions/common/message_bundle.h" |
| 11 |
| 8 class GURL; | 12 class GURL; |
| 9 | 13 |
| 10 namespace base { | 14 namespace base { |
| 11 class FilePath; | 15 class FilePath; |
| 12 } | 16 } |
| 13 | 17 |
| 14 namespace extensions { | 18 namespace extensions { |
| 15 namespace file_util { | 19 namespace file_util { |
| 16 | 20 |
| 17 // Get a relative file path from a chrome-extension:// URL. | 21 // Get a relative file path from a chrome-extension:// URL. |
| 18 base::FilePath ExtensionURLToRelativeFilePath(const GURL& url); | 22 base::FilePath ExtensionURLToRelativeFilePath(const GURL& url); |
| 19 | 23 |
| 20 // Get a full file path from a chrome-extension-resource:// URL, If the URL | 24 // Get a full file path from a chrome-extension-resource:// URL, If the URL |
| 21 // points a file outside of root, this function will return empty FilePath. | 25 // points a file outside of root, this function will return empty FilePath. |
| 22 base::FilePath ExtensionResourceURLToFilePath(const GURL& url, | 26 base::FilePath ExtensionResourceURLToFilePath(const GURL& url, |
| 23 const base::FilePath& root); | 27 const base::FilePath& root); |
| 24 | 28 |
| 29 // Loads extension message catalogs and returns message bundle. |
| 30 // Returns NULL on error or if the extension is not localized. |
| 31 MessageBundle* LoadMessageBundle(const base::FilePath& extension_path, |
| 32 const std::string& default_locale, |
| 33 std::string* error); |
| 34 |
| 35 // Loads the extension message bundle substitution map. Contains at least |
| 36 // the extension_id item. |
| 37 MessageBundle::SubstitutionMap* LoadMessageBundleSubstitutionMap( |
| 38 const base::FilePath& extension_path, |
| 39 const std::string& extension_id, |
| 40 const std::string& default_locale); |
| 41 |
| 25 } // namespace file_util | 42 } // namespace file_util |
| 26 } // namespace extensions | 43 } // namespace extensions |
| 27 | 44 |
| 28 #endif // EXTENSIONS_COMMON_FILE_UTIL_H_ | 45 #endif // EXTENSIONS_COMMON_FILE_UTIL_H_ |
| OLD | NEW |