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

Side by Side Diff: mojo/dart/packages/mojo_services/lib/notifications/notifications.mojom.dart

Issue 1476823003: Fix notifications. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: rebase Created 5 years 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 unified diff | Download patch
« no previous file with comments | « no previous file | mojo/services/notifications/interfaces/notifications.mojom » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | mojo/services/notifications/interfaces/notifications.mojom » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698