OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "ui/base/resource/resource_bundle.h" |
6 | 6 |
7 #include <atlbase.h> | 7 #include <atlbase.h> |
8 | 8 |
9 #include "app/app_paths.h" | |
10 #include "app/data_pack.h" | |
11 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
12 #include "base/debug/stack_trace.h" | 10 #include "base/debug/stack_trace.h" |
13 #include "base/file_util.h" | 11 #include "base/file_util.h" |
14 #include "base/lock.h" | 12 #include "base/lock.h" |
15 #include "base/logging.h" | 13 #include "base/logging.h" |
16 #include "base/path_service.h" | 14 #include "base/path_service.h" |
17 #include "base/resource_util.h" | 15 #include "base/resource_util.h" |
18 #include "base/stl_util-inl.h" | 16 #include "base/stl_util-inl.h" |
19 #include "base/string_piece.h" | 17 #include "base/string_piece.h" |
20 #include "base/win/windows_version.h" | 18 #include "base/win/windows_version.h" |
| 19 #include "gfx/font.h" |
| 20 #include "ui/base/ui_base_paths.h" |
| 21 #include "ui/base/resource/data_pack.h" |
21 | 22 |
22 #include "gfx/font.h" | 23 namespace ui { |
23 | 24 |
24 namespace { | 25 namespace { |
25 | 26 |
26 // Returns the flags that should be passed to LoadLibraryEx. | 27 // Returns the flags that should be passed to LoadLibraryEx. |
27 DWORD GetDataDllLoadFlags() { | 28 DWORD GetDataDllLoadFlags() { |
28 if (base::win::GetVersion() >= base::win::VERSION_VISTA) | 29 if (base::win::GetVersion() >= base::win::VERSION_VISTA) |
29 return LOAD_LIBRARY_AS_DATAFILE_EXCLUSIVE | LOAD_LIBRARY_AS_IMAGE_RESOURCE; | 30 return LOAD_LIBRARY_AS_DATAFILE_EXCLUSIVE | LOAD_LIBRARY_AS_IMAGE_RESOURCE; |
30 | 31 |
31 return DONT_RESOLVE_DLL_REFERENCES; | 32 return DONT_RESOLVE_DLL_REFERENCES; |
32 } | 33 } |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 if (locale_resources_data_) { | 72 if (locale_resources_data_) { |
72 BOOL rv = FreeLibrary(locale_resources_data_); | 73 BOOL rv = FreeLibrary(locale_resources_data_); |
73 DCHECK(rv); | 74 DCHECK(rv); |
74 locale_resources_data_ = NULL; | 75 locale_resources_data_ = NULL; |
75 } | 76 } |
76 } | 77 } |
77 | 78 |
78 // static | 79 // static |
79 FilePath ResourceBundle::GetLocaleFilePath(const std::string& app_locale) { | 80 FilePath ResourceBundle::GetLocaleFilePath(const std::string& app_locale) { |
80 FilePath locale_path; | 81 FilePath locale_path; |
81 PathService::Get(app::DIR_LOCALES, &locale_path); | 82 PathService::Get(ui::DIR_LOCALES, &locale_path); |
82 | 83 |
83 if (app_locale.empty()) | 84 if (app_locale.empty()) |
84 return FilePath(); | 85 return FilePath(); |
85 | 86 |
86 return locale_path.AppendASCII(app_locale + ".dll"); | 87 return locale_path.AppendASCII(app_locale + ".dll"); |
87 } | 88 } |
88 | 89 |
89 // static | 90 // static |
90 RefCountedStaticMemory* ResourceBundle::LoadResourceBytes( | 91 RefCountedStaticMemory* ResourceBundle::LoadResourceBytes( |
91 DataHandle module, int resource_id) { | 92 DataHandle module, int resource_id) { |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 if (!image) { | 159 if (!image) { |
159 // See http://crbug.com/21925. | 160 // See http://crbug.com/21925. |
160 base::debug::StackTrace().PrintBacktrace(); | 161 base::debug::StackTrace().PrintBacktrace(); |
161 NOTREACHED() << "unable to find resource: " << message_id; | 162 NOTREACHED() << "unable to find resource: " << message_id; |
162 return string16(); | 163 return string16(); |
163 } | 164 } |
164 } | 165 } |
165 // Copy into a string16 and return. | 166 // Copy into a string16 and return. |
166 return string16(image->achString, image->nLength); | 167 return string16(image->achString, image->nLength); |
167 } | 168 } |
| 169 |
| 170 } // namespace ui; |
OLD | NEW |