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

Side by Side Diff: content/common/dwrite_localized_strings_win.h

Issue 1378353006: Implementation of dwrite font proxy and removal of dwrite font cache (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge to head Created 5 years, 1 month 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_COMMON_DWRITE_LOCALIZED_STRINGS_WIN_H_
6 #define CONTENT_COMMON_DWRITE_LOCALIZED_STRINGS_WIN_H_
7
8 #include <dwrite.h>
9 #include <wrl.h>
10 #include <utility>
11 #include <vector>
12
13 #include "base/strings/string16.h"
14
15 namespace mswr = Microsoft::WRL;
16
17 namespace content {
18
19 // Impements IDWriteLocalizedStrings, backed by a vector of string pairs.
20 class DWriteLocalizedStrings
21 : public mswr::RuntimeClass<mswr::RuntimeClassFlags<mswr::ClassicCom>,
22 IDWriteLocalizedStrings> {
23 public:
24 HRESULT STDMETHODCALLTYPE FindLocaleName(const WCHAR* localeName,
25 UINT32* index,
26 BOOL* exists) override;
27
28 UINT32 STDMETHODCALLTYPE GetCount() override;
29
30 HRESULT STDMETHODCALLTYPE GetLocaleName(UINT32 index,
31 WCHAR* localeName,
32 UINT32 size) override;
33
34 HRESULT STDMETHODCALLTYPE GetLocaleNameLength(UINT32 index,
35 UINT32* length) override;
36
37 HRESULT STDMETHODCALLTYPE GetString(UINT32 index,
38 WCHAR* stringBuffer,
39 UINT32 size) override;
40
41 HRESULT STDMETHODCALLTYPE GetStringLength(UINT32 index,
42 UINT32* length) override;
43
44 HRESULT STDMETHODCALLTYPE RuntimeClassInitialize(
45 std::vector<std::pair<base::string16, base::string16>>* strings);
46
47 protected:
48 HRESULT ReturnString(base::string16 string, WCHAR* buffer, UINT32 size);
49
50 private:
51 // List of strings. First element of each pair is the locale, and the second
52 // element is the associated value. Use a vector because the expected number
53 // of pairs is small (typically 1-2, rarely up to a few dozen?) and we need
54 // index-based access.
55 std::vector<std::pair<base::string16, base::string16>> strings_;
56 };
57
58 } // namespace content
59 #endif // CONTENT_COMMON_DWRITE_LOCALIZED_STRINGS_WIN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698