Index: content/common/fontmgr_messages.h |
=================================================================== |
--- content/common/fontmgr_messages.h (revision 0) |
+++ content/common/fontmgr_messages.h (working copy) |
@@ -0,0 +1,115 @@ |
+// Copyright (c) 2014 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. |
+ |
+// IPC messages for font discovery. |
+// Multiply-included message file, hence no include guard. |
+ |
+#include "content/common/content_export.h" |
+#include "content/common/content_param_traits.h" |
+#include "content/public/common/common_param_traits.h" |
+#include "ipc/ipc_message_macros.h" |
+#include "skia/ext/refptr.h" |
+#include "third_party/skia/include/core/SkDataTable.h" |
+#include "third_party/skia/include/core/SkStream.h" |
+#include "third_party/skia/include/core/SkString.h" |
+#include "third_party/skia/include/ports/SkFontMgr_indirect.h" |
+#include "third_party/skia/include/ports/SkFontStyle.h" |
+ |
+#undef IPC_MESSAGE_EXPORT |
+#define IPC_MESSAGE_EXPORT CONTENT_EXPORT |
+ |
+#ifdef IPC_MESSAGE_START |
+#error IPC_MESSAGE_START |
+#endif |
+ |
+#define IPC_MESSAGE_START FontMsgStart |
+ |
+#ifndef CONTENT_COMMON_FONTMGR_MESSAGES_H_ |
+#define CONTENT_COMMON_FONTMGR_MESSAGES_H_ |
+ |
+namespace IPC { |
+template<> |
+struct ParamTraits<SkString> { |
+ typedef SkString param_type; |
+ static void Write(Message* m, const param_type& p); |
+ static bool Read(const Message* m, PickleIterator* iter, param_type* r); |
+ static void Log(const param_type& p, std::string* l); |
+}; |
+ |
+// SkStream is not default constructable, no ParamTraits<T>. |
+template<> |
+struct ParamTraits<skia::RefPtr<SkStream> > { |
+ typedef skia::RefPtr<SkStream> param_type; |
+ static void Write(Message* m, const param_type& p); |
+ static bool Read(const Message* m, PickleIterator* iter, param_type* r); |
+ static void Log(const param_type& p, std::string* l); |
+}; |
+ |
+// SkDataTable is not default constructable, no ParamTraits<T>. |
+template<> |
+struct ParamTraits<skia::RefPtr<SkDataTable> > { |
+ typedef skia::RefPtr<SkDataTable> param_type; |
+ static void Write(Message* m, const param_type& p); |
+ static bool Read(const Message* m, PickleIterator* iter, param_type* r); |
+ static void Log(const param_type& p, std::string* l); |
+}; |
+ |
+// SkRemotableFontIdentitySet not default constructable, no ParamTraits<T>. |
+template<> |
+struct ParamTraits<skia::RefPtr<SkRemotableFontIdentitySet> > { |
+ typedef skia::RefPtr<SkRemotableFontIdentitySet> param_type; |
+ static void Write(Message* m, const param_type& p); |
+ static bool Read(const Message* m, PickleIterator* iter, param_type* r); |
+ static void Log(const param_type& p, std::string* l); |
+}; |
+ |
+template<> |
+struct ParamTraits<SkFontStyle> { |
+ typedef SkFontStyle param_type; |
+ static void Write(Message* m, const param_type& p); |
+ static bool Read(const Message* m, PickleIterator* iter, param_type* r); |
+ static void Log(const param_type& p, std::string* l); |
+}; |
+ |
+} // namespace IPC |
+ |
+#endif // CONTENT_COMMON_FONTMGR_MESSAGES_H_ |
+ |
+IPC_STRUCT_TRAITS_BEGIN(SkFontIdentity) |
+ IPC_STRUCT_TRAITS_MEMBER(fDataId) |
+ IPC_STRUCT_TRAITS_MEMBER(fTtcIndex) |
+ IPC_STRUCT_TRAITS_MEMBER(fFontStyle) |
+IPC_STRUCT_TRAITS_END() |
+ |
+IPC_SYNC_MESSAGE_ROUTED0_1(FontMsg_GetFamilyNames, |
+ skia::RefPtr<SkDataTable> /* familyNames */) |
+ |
+IPC_SYNC_MESSAGE_ROUTED1_1(FontMsg_GetIndexIdentities, |
+ int /*familyIndex*/, |
+ skia::RefPtr<SkRemotableFontIdentitySet> /*styles*/) |
+ |
+IPC_SYNC_MESSAGE_ROUTED2_1(FontMsg_MatchIndexStyle, |
+ int /*familyIndex*/, |
+ SkFontStyle, |
+ SkFontIdentity) |
+ |
+IPC_SYNC_MESSAGE_ROUTED1_1(FontMsg_MatchName, |
+ SkString /*familyName*/, |
+ skia::RefPtr<SkRemotableFontIdentitySet> /*styles*/) |
+ |
+IPC_SYNC_MESSAGE_ROUTED2_1(FontMsg_MatchNameStyle, |
+ SkString /*familyName*/, |
+ SkFontStyle, |
+ SkFontIdentity) |
+ |
+IPC_SYNC_MESSAGE_ROUTED4_1(FontMsg_MatchNameStyleCharacter, |
+ SkString /*familyName*/, |
+ SkFontStyle, |
+ SkString /*bpc47*/, |
+ uint32_t /*character*/, |
+ SkFontIdentity) |
+ |
+IPC_SYNC_MESSAGE_ROUTED1_1(FontMsg_GetData, |
+ int /*fontId*/, |
+ skia::RefPtr<SkStream> /* fontData */) |