| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 library notifications_mojom; | 5 library notifications_mojom; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'package:mojo/bindings.dart' as bindings; | 9 import 'package:mojo/bindings.dart' as bindings; |
| 10 import 'package:mojo/core.dart' as core; | 10 import 'package:mojo/core.dart' as core; |
| 11 | 11 |
| 12 | 12 |
| 13 | 13 |
| 14 class NotificationData extends bindings.Struct { | 14 class NotificationData extends bindings.Struct { |
| 15 static const List<bindings.StructDataHeader> kVersions = const [ | 15 static const List<bindings.StructDataHeader> kVersions = const [ |
| 16 const bindings.StructDataHeader(24, 0) | 16 const bindings.StructDataHeader(32, 0) |
| 17 ]; | 17 ]; |
| 18 String title = null; | 18 String title = null; |
| 19 String text = null; | 19 String text = null; |
| 20 bool playSound = false; |
| 21 bool vibrate = false; |
| 22 bool setLights = false; |
| 20 | 23 |
| 21 NotificationData() : super(kVersions.last.size); | 24 NotificationData() : super(kVersions.last.size); |
| 22 | 25 |
| 23 static NotificationData deserialize(bindings.Message message) { | 26 static NotificationData deserialize(bindings.Message message) { |
| 24 var decoder = new bindings.Decoder(message); | 27 var decoder = new bindings.Decoder(message); |
| 25 var result = decode(decoder); | 28 var result = decode(decoder); |
| 26 if (decoder.excessHandles != null) { | 29 if (decoder.excessHandles != null) { |
| 27 decoder.excessHandles.forEach((h) => h.close()); | 30 decoder.excessHandles.forEach((h) => h.close()); |
| 28 } | 31 } |
| 29 return result; | 32 return result; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 54 'required by the last known version.'); | 57 'required by the last known version.'); |
| 55 } | 58 } |
| 56 if (mainDataHeader.version >= 0) { | 59 if (mainDataHeader.version >= 0) { |
| 57 | 60 |
| 58 result.title = decoder0.decodeString(8, true); | 61 result.title = decoder0.decodeString(8, true); |
| 59 } | 62 } |
| 60 if (mainDataHeader.version >= 0) { | 63 if (mainDataHeader.version >= 0) { |
| 61 | 64 |
| 62 result.text = decoder0.decodeString(16, true); | 65 result.text = decoder0.decodeString(16, true); |
| 63 } | 66 } |
| 67 if (mainDataHeader.version >= 0) { |
| 68 |
| 69 result.playSound = decoder0.decodeBool(24, 0); |
| 70 } |
| 71 if (mainDataHeader.version >= 0) { |
| 72 |
| 73 result.vibrate = decoder0.decodeBool(24, 1); |
| 74 } |
| 75 if (mainDataHeader.version >= 0) { |
| 76 |
| 77 result.setLights = decoder0.decodeBool(24, 2); |
| 78 } |
| 64 return result; | 79 return result; |
| 65 } | 80 } |
| 66 | 81 |
| 67 void encode(bindings.Encoder encoder) { | 82 void encode(bindings.Encoder encoder) { |
| 68 var encoder0 = encoder.getStructEncoderAtOffset(kVersions.last); | 83 var encoder0 = encoder.getStructEncoderAtOffset(kVersions.last); |
| 69 | 84 |
| 70 encoder0.encodeString(title, 8, true); | 85 encoder0.encodeString(title, 8, true); |
| 71 | 86 |
| 72 encoder0.encodeString(text, 16, true); | 87 encoder0.encodeString(text, 16, true); |
| 88 |
| 89 encoder0.encodeBool(playSound, 24, 0); |
| 90 |
| 91 encoder0.encodeBool(vibrate, 24, 1); |
| 92 |
| 93 encoder0.encodeBool(setLights, 24, 2); |
| 73 } | 94 } |
| 74 | 95 |
| 75 String toString() { | 96 String toString() { |
| 76 return "NotificationData(" | 97 return "NotificationData(" |
| 77 "title: $title" ", " | 98 "title: $title" ", " |
| 78 "text: $text" ")"; | 99 "text: $text" ", " |
| 100 "playSound: $playSound" ", " |
| 101 "vibrate: $vibrate" ", " |
| 102 "setLights: $setLights" ")"; |
| 79 } | 103 } |
| 80 | 104 |
| 81 Map toJson() { | 105 Map toJson() { |
| 82 Map map = new Map(); | 106 Map map = new Map(); |
| 83 map["title"] = title; | 107 map["title"] = title; |
| 84 map["text"] = text; | 108 map["text"] = text; |
| 109 map["playSound"] = playSound; |
| 110 map["vibrate"] = vibrate; |
| 111 map["setLights"] = setLights; |
| 85 return map; | 112 return map; |
| 86 } | 113 } |
| 87 } | 114 } |
| 88 | 115 |
| 89 | 116 |
| 90 class NotificationClientOnSelectedParams extends bindings.Struct { | 117 class NotificationClientOnSelectedParams extends bindings.Struct { |
| 91 static const List<bindings.StructDataHeader> kVersions = const [ | 118 static const List<bindings.StructDataHeader> kVersions = const [ |
| 92 const bindings.StructDataHeader(8, 0) | 119 const bindings.StructDataHeader(8, 0) |
| 93 ]; | 120 ]; |
| 94 | 121 |
| (...skipping 868 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 963 | 990 |
| 964 String toString() { | 991 String toString() { |
| 965 var superString = super.toString(); | 992 var superString = super.toString(); |
| 966 return "NotificationServiceStub($superString)"; | 993 return "NotificationServiceStub($superString)"; |
| 967 } | 994 } |
| 968 | 995 |
| 969 int get version => 0; | 996 int get version => 0; |
| 970 } | 997 } |
| 971 | 998 |
| 972 | 999 |
| OLD | NEW |