| 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_ |
| 11 #define CHROME_FRAME_SIMPLE_RESOURCE_LOADER_H_ | 11 #define CHROME_FRAME_SIMPLE_RESOURCE_LOADER_H_ |
| 12 | 12 |
| 13 #include <windows.h> | 13 #include <windows.h> |
| 14 #include <string> | 14 #include <string> |
| 15 #include <vector> | 15 #include <vector> |
| 16 | 16 |
| 17 #include "base/file_path.h" | 17 #include "base/file_path.h" |
| 18 #include "base/gtest_prod_util.h" | 18 #include "base/gtest_prod_util.h" |
| 19 #include "base/singleton.h" | 19 #include "base/singleton.h" |
| 20 | 20 |
| 21 class SimpleResourceLoader { | 21 class SimpleResourceLoader { |
| 22 public: | 22 public: |
| 23 | 23 |
| 24 static SimpleResourceLoader* instance() { | 24 static SimpleResourceLoader* instance(); |
| 25 return Singleton<SimpleResourceLoader>::get(); | |
| 26 } | |
| 27 | 25 |
| 28 // Returns the language tag for the active language. | 26 // Returns the language tag for the active language. |
| 29 static std::wstring GetLanguage(); | 27 static std::wstring GetLanguage(); |
| 30 | 28 |
| 31 // Helper method to return the string resource identified by message_id | 29 // Helper method to return the string resource identified by message_id |
| 32 // from the currently loaded locale dll. | 30 // from the currently loaded locale dll. |
| 33 static std::wstring Get(int message_id); | 31 static std::wstring Get(int message_id); |
| 34 | 32 |
| 35 // Retrieves the HINSTANCE of the loaded module handle. May be NULL if a | 33 // Retrieves the HINSTANCE of the loaded module handle. May be NULL if a |
| 36 // resource DLL could not be loaded. | 34 // resource DLL could not be loaded. |
| (...skipping 29 matching lines...) Expand all Loading... |
| 66 | 64 |
| 67 friend struct DefaultSingletonTraits<SimpleResourceLoader>; | 65 friend struct DefaultSingletonTraits<SimpleResourceLoader>; |
| 68 | 66 |
| 69 FRIEND_TEST_ALL_PREFIXES(SimpleResourceLoaderTest, LoadLocaleDll); | 67 FRIEND_TEST_ALL_PREFIXES(SimpleResourceLoaderTest, LoadLocaleDll); |
| 70 | 68 |
| 71 std::wstring language_; | 69 std::wstring language_; |
| 72 HINSTANCE locale_dll_handle_; | 70 HINSTANCE locale_dll_handle_; |
| 73 }; | 71 }; |
| 74 | 72 |
| 75 #endif // CHROME_FRAME_SIMPLE_RESOURCE_LOADER_H_ | 73 #endif // CHROME_FRAME_SIMPLE_RESOURCE_LOADER_H_ |
| OLD | NEW |