WidgetMessageUtils.h 935 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /* This Source Code Form is subject to the terms of the Mozilla Public
  2. * License, v. 2.0. If a copy of the MPL was not distributed with this
  3. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  4. #ifndef mozilla_WidgetMessageUtils_h
  5. #define mozilla_WidgetMessageUtils_h
  6. #include "ipc/IPCMessageUtils.h"
  7. #include "mozilla/LookAndFeel.h"
  8. namespace IPC {
  9. template<>
  10. struct ParamTraits<LookAndFeelInt>
  11. {
  12. typedef LookAndFeelInt paramType;
  13. static void Write(Message* aMsg, const paramType& aParam)
  14. {
  15. WriteParam(aMsg, aParam.id);
  16. WriteParam(aMsg, aParam.value);
  17. }
  18. static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
  19. {
  20. int32_t id, value;
  21. if (ReadParam(aMsg, aIter, &id) &&
  22. ReadParam(aMsg, aIter, &value)) {
  23. aResult->id = id;
  24. aResult->value = value;
  25. return true;
  26. }
  27. return false;
  28. }
  29. };
  30. } // namespace IPC
  31. #endif // WidgetMessageUtils_h