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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 | 67 |
68 const std::string app_locale = l10n_util::GetApplicationLocale(pref_locale); | 68 const std::string app_locale = l10n_util::GetApplicationLocale(pref_locale); |
69 if (app_locale.empty()) | 69 if (app_locale.empty()) |
70 return FilePath(); | 70 return FilePath(); |
71 | 71 |
72 return locale_path.AppendASCII(app_locale + ".dll"); | 72 return locale_path.AppendASCII(app_locale + ".dll"); |
73 } | 73 } |
74 | 74 |
75 void ResourceBundle::LoadThemeResources() { | 75 void ResourceBundle::LoadThemeResources() { |
76 DCHECK(NULL == theme_data_) << "theme dll already loaded"; | 76 DCHECK(NULL == theme_data_) << "theme dll already loaded"; |
77 std::wstring theme_data_path; | 77 FilePath theme_data_path; |
78 PathService::Get(app::DIR_THEMES, &theme_data_path); | 78 PathService::Get(app::DIR_THEMES, &theme_data_path); |
79 file_util::AppendToPath(&theme_data_path, L"default.dll"); | 79 theme_data_path = theme_data_path.AppendASCII("default.dll"); |
80 | 80 |
81 // The dll should only have resources, not executable code. | 81 // The dll should only have resources, not executable code. |
82 theme_data_ = LoadLibraryEx(theme_data_path.c_str(), NULL, | 82 theme_data_ = LoadLibraryEx(theme_data_path.value().c_str(), NULL, |
83 GetDataDllLoadFlags()); | 83 GetDataDllLoadFlags()); |
84 DCHECK(theme_data_ != NULL) << "unable to load " << theme_data_path; | 84 DCHECK(theme_data_ != NULL) << "unable to load " << theme_data_path.value(); |
85 } | 85 } |
86 | 86 |
87 /* static */ | 87 /* static */ |
88 bool ResourceBundle::LoadResourceBytes( | 88 bool ResourceBundle::LoadResourceBytes( |
89 DataHandle module, | 89 DataHandle module, |
90 int resource_id, | 90 int resource_id, |
91 std::vector<unsigned char>* bytes) { | 91 std::vector<unsigned char>* bytes) { |
92 void* data_ptr; | 92 void* data_ptr; |
93 size_t data_size; | 93 size_t data_size; |
94 if (base::GetDataResourceFromModule(module, resource_id, &data_ptr, | 94 if (base::GetDataResourceFromModule(module, resource_id, &data_ptr, |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 image = AtlGetStringResourceImage(_AtlBaseModule.GetModuleInstance(), | 149 image = AtlGetStringResourceImage(_AtlBaseModule.GetModuleInstance(), |
150 message_id); | 150 message_id); |
151 if (!image) { | 151 if (!image) { |
152 NOTREACHED() << "unable to find resource: " << message_id; | 152 NOTREACHED() << "unable to find resource: " << message_id; |
153 return std::wstring(); | 153 return std::wstring(); |
154 } | 154 } |
155 } | 155 } |
156 // Copy into a string16 and return. | 156 // Copy into a string16 and return. |
157 return string16(image->achString, image->nLength); | 157 return string16(image->achString, image->nLength); |
158 } | 158 } |
OLD | NEW |