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

Side by Side Diff: client/samples/swarm/DataSource.dart

Issue 8666012: Partial fix to client breakage (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 9 years, 1 month 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 /** The top-level collection of all sections for a user. */ 5 /** The top-level collection of all sections for a user. */
6 // TODO(jimhug): This is known as UserData in the server model. 6 // TODO(jimhug): This is known as UserData in the server model.
7 class Sections implements Collection<Section> { 7 class Sections implements Collection<Section> {
8 final List<Section> _sections; 8 final List<Section> _sections;
9 9
10 Sections(this._sections); 10 Sections(this._sections);
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 133
134 /** Provider of a news feed. */ 134 /** Provider of a news feed. */
135 class Feed { 135 class Feed {
136 String id; 136 String id;
137 final String title; 137 final String title;
138 final String iconUrl; 138 final String iconUrl;
139 final String description; 139 final String description;
140 ObservableList<Article> articles; 140 ObservableList<Article> articles;
141 ObservableValue<bool> error; // TODO(jimhug): Check if dead code. 141 ObservableValue<bool> error; // TODO(jimhug): Check if dead code.
142 142
143 Feed(this.id, this.title, this.iconUrl, [this.description = '']) 143 Feed(this.id, this.title, this.iconUrl, [description = ''])
144 : articles = new ObservableList<Article>(), 144 : this.description = description,
145 articles = new ObservableList<Article>(),
145 error = new ObservableValue<bool>(false); 146 error = new ObservableValue<bool>(false);
146 147
147 static Feed decode(Decoder decoder) { 148 static Feed decode(Decoder decoder) {
148 final sourceId = decoder.readString(); 149 final sourceId = decoder.readString();
149 final sourceTitle = decoder.readString(); 150 final sourceTitle = decoder.readString();
150 final sourceIcon = decoder.readString(); 151 final sourceIcon = decoder.readString();
151 final feed = new Feed(sourceId, sourceTitle, sourceIcon); 152 final feed = new Feed(sourceId, sourceTitle, sourceIcon);
152 final nItems = decoder.readInt(); 153 final nItems = decoder.readInt();
153 154
154 for (int i=0; i < nItems; i++) { 155 for (int i=0; i < nItems; i++) {
(...skipping 20 matching lines...) Expand all
175 String textBody; // TODO(jimhug): rename to snipppet. 176 String textBody; // TODO(jimhug): rename to snipppet.
176 final Feed dataSource; // TODO(jimhug): rename to feed. 177 final Feed dataSource; // TODO(jimhug): rename to feed.
177 String _htmlBody; 178 String _htmlBody;
178 String srcUrl; 179 String srcUrl;
179 final ObservableValue<bool> unread; // TODO(jimhug): persist to server. 180 final ObservableValue<bool> unread; // TODO(jimhug): persist to server.
180 181
181 bool error; // TODO(jimhug): Check if this is dead and remove. 182 bool error; // TODO(jimhug): Check if this is dead and remove.
182 183
183 Article(this.dataSource, this.id, this.date, this.title, this.author, 184 Article(this.dataSource, this.id, this.date, this.title, this.author,
184 this.srcUrl, this.hasThumbnail, this.textBody, 185 this.srcUrl, this.hasThumbnail, this.textBody,
185 [this._htmlBody = null, bool unread = true, this.error = false]) 186 [htmlBody = null, bool unread = true, error = false])
186 : unread = new ObservableValue<bool>(unread); 187 : unread = new ObservableValue<bool>(unread),
188 this._htmlBody = htmlBody,
189 this.error = error;
187 190
188 String get htmlBody() { 191 String get htmlBody() {
189 _ensureLoaded(); 192 _ensureLoaded();
190 return _htmlBody; 193 return _htmlBody;
191 } 194 }
192 195
193 String get dataUri() { 196 String get dataUri() {
194 return Uri.encodeComponent(id).replaceAll( 197 return Uri.encodeComponent(id).replaceAll(
195 ',', '%2C').replaceAll('%2F', '/'); 198 ',', '%2C').replaceAll('%2F', '/');
196 } 199 }
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 final srcUrl = decoder.readString(); 237 final srcUrl = decoder.readString();
235 final hasThumbnail = decoder.readBool(); 238 final hasThumbnail = decoder.readBool();
236 final author = decoder.readString(); 239 final author = decoder.readString();
237 final dateInSeconds = decoder.readInt(); 240 final dateInSeconds = decoder.readInt();
238 final snippet = decoder.readString(); 241 final snippet = decoder.readString();
239 final date = new Date.fromEpoch(dateInSeconds*1000, new TimeZone.utc()); 242 final date = new Date.fromEpoch(dateInSeconds*1000, new TimeZone.utc());
240 return new Article(source, id, date, title, author, srcUrl, hasThumbnail, 243 return new Article(source, id, date, title, author, srcUrl, hasThumbnail,
241 snippet); 244 snippet);
242 } 245 }
243 } 246 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698