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

Unified Diff: content/browser/renderer_host/dwrite_font_proxy_message_filter_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, 2 months 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/dwrite_font_proxy_message_filter_win.h
diff --git a/content/browser/renderer_host/dwrite_font_proxy_message_filter_win.h b/content/browser/renderer_host/dwrite_font_proxy_message_filter_win.h
new file mode 100644
index 0000000000000000000000000000000000000000..6334d304d78f1c7ac52bae63eb6a5648755623fb
--- /dev/null
+++ b/content/browser/renderer_host/dwrite_font_proxy_message_filter_win.h
@@ -0,0 +1,58 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_BROWSER_RENDERER_HOST_DWRITE_FONT_PROXY_MESSAGE_FILTER_WIN_H_
+#define CONTENT_BROWSER_RENDERER_HOST_DWRITE_FONT_PROXY_MESSAGE_FILTER_WIN_H_
+
+#include <dwrite.h>
+#include <wrl.h>
+#include <vector>
+
+#include "base/location.h"
+#include "base/strings/string16.h"
+#include "content/common/content_export.h"
+#include "content/public/browser/browser_message_filter.h"
+#include "content/public/browser/browser_thread.h"
+
+namespace content {
+
+// Implements a message filter that handles the dwrite font proxy messages.
+// If DWrite is enabled, calls into the system font collection to obtain
+// results. Otherwise, acts as if the system collection contains no fonts.
+class CONTENT_EXPORT DWriteFontProxyMessageFilter
+ : public BrowserMessageFilter {
+ public:
+ typedef bool (*PostTaskAndReplyFn)(BrowserThread::ID,
+ const tracked_objects::Location&,
+ const base::Closure&,
+ const base::Closure&);
+
+ DWriteFontProxyMessageFilter();
+ explicit DWriteFontProxyMessageFilter(PostTaskAndReplyFn postTaskFunction);
+
+ bool OnMessageReceived(const IPC::Message& message) override;
+
+ protected:
+ void OnFindFamily(const base::string16& familyName,
+ IPC::Message* reply_message);
+ void OnGetFamilyCount(uint32* count);
+ void OnGetFamilyNames(uint32 familyIndex, IPC::Message* reply_message);
+ void OnGetFontFiles(uint32 familyIndex, IPC::Message* reply_message);
+
+ void DoFindFamily(const base::string16& familyName,
+ IPC::Message* reply_message);
+ void DoGetFamilyNames(uint32 familyIndex, IPC::Message* reply_message);
+ void DoGetFontFiles(uint32 familyIndex, IPC::Message* reply_message);
+
+ void Init();
+
+ private:
+ Microsoft::WRL::ComPtr<IDWriteFontCollection> collection_;
+ PostTaskAndReplyFn postTaskAndReply_;
+ base::string16 windowsFontsPath_;
+};
+
+} // namespace content
+
+#endif // CONTENT_BROWSER_RENDERER_HOST_DWRITE_FONT_PROXY_MESSAGE_FILTER_WIN_H_

Powered by Google App Engine
This is Rietveld 408576698