| 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 // This class implements a simplified and much stripped down version of | 5 // This class implements a simplified and much stripped down version of |
| 6 // Chrome's app/resource_bundle machinery. It notably avoids unwanted | 6 // Chrome's app/resource_bundle machinery. It notably avoids unwanted |
| 7 // dependencies on things like Skia. | 7 // dependencies on things like Skia. |
| 8 // | 8 // |
| 9 | 9 |
| 10 #ifndef CHROME_FRAME_SIMPLE_RESOURCE_LOADER_H_ | 10 #ifndef CHROME_FRAME_SIMPLE_RESOURCE_LOADER_H_ |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 static std::wstring Get(int message_id); | 33 static std::wstring Get(int message_id); |
| 34 | 34 |
| 35 // Retrieves the HINSTANCE of the loaded module handle. May be NULL if a | 35 // Retrieves the HINSTANCE of the loaded module handle. May be NULL if a |
| 36 // resource DLL could not be loaded. | 36 // resource DLL could not be loaded. |
| 37 HMODULE GetResourceModuleHandle(); | 37 HMODULE GetResourceModuleHandle(); |
| 38 | 38 |
| 39 // Retrieves the preferred languages for the current thread, adding them to | 39 // Retrieves the preferred languages for the current thread, adding them to |
| 40 // |language_tags|. | 40 // |language_tags|. |
| 41 static void GetPreferredLanguages(std::vector<std::wstring>* language_tags); | 41 static void GetPreferredLanguages(std::vector<std::wstring>* language_tags); |
| 42 | 42 |
| 43 // Retrieves the thread/process/user/system preferred languages on Vista+, | |
| 44 // adding them and their fallbacks to |language_tags|. Returns |false| if the | |
| 45 // platform does not support such (i.e., XP). | |
| 46 static bool GetThreadPreferredUILanguages( | |
| 47 std::vector<std::wstring>* language_tags); | |
| 48 | |
| 49 // Retrieves the system language and the region using ICU (used on XP). | |
| 50 static void GetICUSystemLanguage(std::wstring* language, | |
| 51 std::wstring* region); | |
| 52 | |
| 53 // Populates |locales_path| with the path to the "Locales" directory. | 43 // Populates |locales_path| with the path to the "Locales" directory. |
| 54 static void DetermineLocalesDirectory(FilePath* locales_path); | 44 static void DetermineLocalesDirectory(FilePath* locales_path); |
| 55 | 45 |
| 56 // Returns false if |language_tag| is malformed. | 46 // Returns false if |language_tag| is malformed. |
| 57 static bool IsValidLanguageTag(const std::wstring& language_tag); | 47 static bool IsValidLanguageTag(const std::wstring& language_tag); |
| 58 | 48 |
| 59 private: | 49 private: |
| 60 SimpleResourceLoader(); | 50 SimpleResourceLoader(); |
| 61 ~SimpleResourceLoader(); | 51 ~SimpleResourceLoader(); |
| 62 | 52 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 76 | 66 |
| 77 friend struct DefaultSingletonTraits<SimpleResourceLoader>; | 67 friend struct DefaultSingletonTraits<SimpleResourceLoader>; |
| 78 | 68 |
| 79 FRIEND_TEST_ALL_PREFIXES(SimpleResourceLoaderTest, LoadLocaleDll); | 69 FRIEND_TEST_ALL_PREFIXES(SimpleResourceLoaderTest, LoadLocaleDll); |
| 80 | 70 |
| 81 std::wstring language_; | 71 std::wstring language_; |
| 82 HINSTANCE locale_dll_handle_; | 72 HINSTANCE locale_dll_handle_; |
| 83 }; | 73 }; |
| 84 | 74 |
| 85 #endif // CHROME_FRAME_SIMPLE_RESOURCE_LOADER_H_ | 75 #endif // CHROME_FRAME_SIMPLE_RESOURCE_LOADER_H_ |
| OLD | NEW |