| OLD | NEW |
| (Empty) |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CONTENT_CHILD_DWRITE_FONT_PROXY_DWRITE_LOCALIZED_STRINGS_WIN_H_ | |
| 6 #define CONTENT_CHILD_DWRITE_FONT_PROXY_DWRITE_LOCALIZED_STRINGS_WIN_H_ | |
| 7 | |
| 8 #include <dwrite.h> | |
| 9 #include <wrl.h> | |
| 10 #include <utility> | |
| 11 #include <vector> | |
| 12 | |
| 13 #include "base/macros.h" | |
| 14 #include "base/strings/string16.h" | |
| 15 | |
| 16 namespace content { | |
| 17 | |
| 18 // Impements IDWriteLocalizedStrings, backed by a vector of string pairs. | |
| 19 class DWriteLocalizedStrings | |
| 20 : public Microsoft::WRL::RuntimeClass< | |
| 21 Microsoft::WRL::RuntimeClassFlags<Microsoft::WRL::ClassicCom>, | |
| 22 IDWriteLocalizedStrings> { | |
| 23 public: | |
| 24 DWriteLocalizedStrings() = default; | |
| 25 ~DWriteLocalizedStrings() override; | |
| 26 | |
| 27 // IDWriteLocalizedStrings: | |
| 28 HRESULT STDMETHODCALLTYPE FindLocaleName(const WCHAR* locale_name, | |
| 29 UINT32* index, | |
| 30 BOOL* exists) override; | |
| 31 UINT32 STDMETHODCALLTYPE GetCount() override; | |
| 32 HRESULT STDMETHODCALLTYPE GetLocaleName(UINT32 index, | |
| 33 WCHAR* locale_name, | |
| 34 UINT32 size) override; | |
| 35 HRESULT STDMETHODCALLTYPE GetLocaleNameLength(UINT32 index, | |
| 36 UINT32* length) override; | |
| 37 HRESULT STDMETHODCALLTYPE GetString(UINT32 index, | |
| 38 WCHAR* string_buffer, | |
| 39 UINT32 size) override; | |
| 40 HRESULT STDMETHODCALLTYPE GetStringLength(UINT32 index, | |
| 41 UINT32* length) override; | |
| 42 | |
| 43 HRESULT STDMETHODCALLTYPE RuntimeClassInitialize( | |
| 44 std::vector<std::pair<base::string16, base::string16>>* strings); | |
| 45 | |
| 46 private: | |
| 47 // List of strings. First element of each pair is the locale, and the second | |
| 48 // element is the associated value. Use a vector because the expected number | |
| 49 // of pairs is small (typically 1-2, rarely up to a few dozen?) and we need | |
| 50 // index-based access. | |
| 51 std::vector<std::pair<base::string16, base::string16>> strings_; | |
| 52 | |
| 53 DISALLOW_ASSIGN(DWriteLocalizedStrings); | |
| 54 }; | |
| 55 | |
| 56 } // namespace content | |
| 57 #endif // CONTENT_CHILD_DWRITE_FONT_PROXY_DWRITE_LOCALIZED_STRINGS_WIN_H_ | |
| OLD | NEW |