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 mswr = Microsoft::WRL; | |
17 | |
18 namespace content { | |
19 | |
20 // Impements IDWriteLocalizedStrings, backed by a vector of string pairs. | |
21 class DWriteLocalizedStrings | |
22 : public mswr::RuntimeClass<mswr::RuntimeClassFlags<mswr::ClassicCom>, | |
23 IDWriteLocalizedStrings> { | |
24 public: | |
25 // IDWriteLocalizedStrings: | |
26 HRESULT STDMETHODCALLTYPE FindLocaleName(const WCHAR* locale_name, | |
27 UINT32* index, | |
28 BOOL* exists) override; | |
29 UINT32 STDMETHODCALLTYPE GetCount() override; | |
30 HRESULT STDMETHODCALLTYPE GetLocaleName(UINT32 index, | |
31 WCHAR* locale_name, | |
32 UINT32 size) override; | |
33 HRESULT STDMETHODCALLTYPE GetLocaleNameLength(UINT32 index, | |
34 UINT32* length) override; | |
35 HRESULT STDMETHODCALLTYPE GetString(UINT32 index, | |
36 WCHAR* string_buffer, | |
37 UINT32 size) override; | |
38 HRESULT STDMETHODCALLTYPE GetStringLength(UINT32 index, | |
39 UINT32* length) override; | |
40 | |
41 HRESULT STDMETHODCALLTYPE RuntimeClassInitialize( | |
42 std::vector<std::pair<base::string16, base::string16>>* strings); | |
43 | |
44 private: | |
45 // List of strings. First element of each pair is the locale, and the second | |
46 // element is the associated value. Use a vector because the expected number | |
47 // of pairs is small (typically 1-2, rarely up to a few dozen?) and we need | |
48 // index-based access. | |
49 std::vector<std::pair<base::string16, base::string16>> strings_; | |
50 DISALLOW_ASSIGN(DWriteLocalizedStrings); | |
Alexei Svitkine (slow)
2015/11/23 16:25:40
Nit: Empty line above this.
Ilya Kulshin
2015/11/24 01:45:27
Done.
| |
51 }; | |
52 | |
53 } // namespace content | |
54 #endif // CONTENT_CHILD_DWRITE_FONT_PROXY_DWRITE_LOCALIZED_STRINGS_WIN_H_ | |
OLD | NEW |