Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(88)

Side by Side Diff: content/child/dwrite_font_proxy/dwrite_localized_strings_win.h

Issue 1438603002: Create direct write font proxy classes and unit tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge to origin/master Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698