| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "app/resource_bundle.h" | 5 #include "app/resource_bundle.h" |
| 6 | 6 |
| 7 #include <atlbase.h> | 7 #include <atlbase.h> |
| 8 | 8 |
| 9 #include "app/app_paths.h" | 9 #include "app/app_paths.h" |
| 10 #include "app/gfx/font.h" | 10 #include "app/gfx/font.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 return; | 51 return; |
| 52 } | 52 } |
| 53 | 53 |
| 54 // The dll should only have resources, not executable code. | 54 // The dll should only have resources, not executable code. |
| 55 locale_resources_data_ = LoadLibraryEx(locale_path.value().c_str(), NULL, | 55 locale_resources_data_ = LoadLibraryEx(locale_path.value().c_str(), NULL, |
| 56 GetDataDllLoadFlags()); | 56 GetDataDllLoadFlags()); |
| 57 DCHECK(locale_resources_data_ != NULL) << | 57 DCHECK(locale_resources_data_ != NULL) << |
| 58 "unable to load generated resources"; | 58 "unable to load generated resources"; |
| 59 } | 59 } |
| 60 | 60 |
| 61 // static |
| 61 FilePath ResourceBundle::GetLocaleFilePath(const std::wstring& pref_locale) { | 62 FilePath ResourceBundle::GetLocaleFilePath(const std::wstring& pref_locale) { |
| 62 FilePath locale_path; | 63 FilePath locale_path; |
| 63 PathService::Get(app::DIR_LOCALES, &locale_path); | 64 PathService::Get(app::DIR_LOCALES, &locale_path); |
| 64 | 65 |
| 65 const std::string app_locale = l10n_util::GetApplicationLocale(pref_locale); | 66 const std::string app_locale = l10n_util::GetApplicationLocale(pref_locale); |
| 66 if (app_locale.empty()) | 67 if (app_locale.empty()) |
| 67 return FilePath(); | 68 return FilePath(); |
| 68 | 69 |
| 69 return locale_path.AppendASCII(app_locale + ".dll"); | 70 return locale_path.AppendASCII(app_locale + ".dll"); |
| 70 } | 71 } |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 message_id); | 134 message_id); |
| 134 if (!image) { | 135 if (!image) { |
| 135 StackTrace().PrintBacktrace(); // See http://crbug.com/21925. | 136 StackTrace().PrintBacktrace(); // See http://crbug.com/21925. |
| 136 NOTREACHED() << "unable to find resource: " << message_id; | 137 NOTREACHED() << "unable to find resource: " << message_id; |
| 137 return std::wstring(); | 138 return std::wstring(); |
| 138 } | 139 } |
| 139 } | 140 } |
| 140 // Copy into a string16 and return. | 141 // Copy into a string16 and return. |
| 141 return string16(image->achString, image->nLength); | 142 return string16(image->achString, image->nLength); |
| 142 } | 143 } |
| OLD | NEW |