| Index: components/arc/common/arc_message_param_traits.cc
|
| diff --git a/components/arc/common/arc_message_param_traits.cc b/components/arc/common/arc_message_param_traits.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..2d1cf878861e6b0ad963c7ea2d37861e393277d5
|
| --- /dev/null
|
| +++ b/components/arc/common/arc_message_param_traits.cc
|
| @@ -0,0 +1,66 @@
|
| +// 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.
|
| +
|
| +// Using relative paths since this file is shared between chromium and android.
|
| +#include "arc_message_param_traits.h"
|
| +
|
| +namespace IPC {
|
| +
|
| +// static
|
| +void ParamTraits<arc::ArcNotificationData>::Write(Message* m,
|
| + const param_type& p) {
|
| + WriteParam(m, p.key);
|
| + WriteParam(m, p.message);
|
| + WriteParam(m, p.title);
|
| + WriteParam(m, p.icon_mimetype);
|
| + WriteParam(m, p.icon_data);
|
| + WriteParam(m, p.priority);
|
| +}
|
| +
|
| +// static
|
| +bool ParamTraits<arc::ArcNotificationData>::Read(const Message* m,
|
| + base::PickleIterator* iter,
|
| + param_type* r) {
|
| + std::string key;
|
| + std::string message;
|
| + std::string title;
|
| + std::string icon_mimetype;
|
| + std::vector<uint8_t> icon_data;
|
| + int priority;
|
| +
|
| + if (!ReadParam(m, iter, &key) ||
|
| + !ReadParam(m, iter, &message) ||
|
| + !ReadParam(m, iter, &title) ||
|
| + !ReadParam(m, iter, &icon_mimetype) ||
|
| + !ReadParam(m, iter, &icon_data) ||
|
| + !ReadParam(m, iter, &priority)) {
|
| + return false;
|
| + }
|
| +
|
| + r->key = key;
|
| +
|
| + // TODO(yoshiki): Support other types.
|
| + r->type = arc::NOTIFICATION_TYPE_BASIC;
|
| +
|
| + r->message = message;
|
| + r->title = title;
|
| + r->icon_mimetype = icon_mimetype;
|
| + r->icon_data.swap(icon_data);
|
| + r->priority = std::min(std::max(-2, priority), 2);
|
| +
|
| + // TODO(yoshiki): Transfer following parameters from Android.
|
| + r->timestamp = base::Time::Now();
|
| + r->progress_current = 0;
|
| + r->progress_max = 0;
|
| +
|
| + return true;
|
| +}
|
| +
|
| +// static
|
| +void ParamTraits<arc::ArcNotificationData>::Log(const param_type& p,
|
| + std::string* l) {
|
| + l->append(base::StringPrintf("<ArcNotificationData>"));
|
| +}
|
| +
|
| +} // namespace IPC
|
|
|