Chromium Code Reviews| 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; | |
|
Alexei Svitkine (slow)
2015/11/25 20:17:45
Header files shouldn't have using declarations.
Ilya Kulshin
2015/12/02 02:23:02
Done.
| |
| 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: | |
|
Alexei Svitkine (slow)
2015/11/25 20:17:45
Nit: Add an explicit default ctor.
Ilya Kulshin
2015/12/02 02:23:01
Done.
| |
| 25 ~DWriteLocalizedStrings(); | |
|
Alexei Svitkine (slow)
2015/11/25 20:17:45
Shouldn't this have override() since it's a subcla
Ilya Kulshin
2015/12/02 02:23:02
Done.
| |
| 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 |