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

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

Issue 8680038: Revert initializing formals change in client code (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
« no previous file with comments | « client/observable/observable.dart ('k') | client/touch/Geometry.dart » ('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 (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, [description = '']) 143 Feed(this.id, this.title, this.iconUrl, [this.description = ''])
144 : this.description = description, 144 : articles = new ObservableList<Article>(),
145 articles = new ObservableList<Article>(),
146 error = new ObservableValue<bool>(false); 145 error = new ObservableValue<bool>(false);
147 146
148 static Feed decode(Decoder decoder) { 147 static Feed decode(Decoder decoder) {
149 final sourceId = decoder.readString(); 148 final sourceId = decoder.readString();
150 final sourceTitle = decoder.readString(); 149 final sourceTitle = decoder.readString();
151 final sourceIcon = decoder.readString(); 150 final sourceIcon = decoder.readString();
152 final feed = new Feed(sourceId, sourceTitle, sourceIcon); 151 final feed = new Feed(sourceId, sourceTitle, sourceIcon);
153 final nItems = decoder.readInt(); 152 final nItems = decoder.readInt();
154 153
155 for (int i=0; i < nItems; i++) { 154 for (int i=0; i < nItems; i++) {
(...skipping 20 matching lines...) Expand all
176 String textBody; // TODO(jimhug): rename to snipppet. 175 String textBody; // TODO(jimhug): rename to snipppet.
177 final Feed dataSource; // TODO(jimhug): rename to feed. 176 final Feed dataSource; // TODO(jimhug): rename to feed.
178 String _htmlBody; 177 String _htmlBody;
179 String srcUrl; 178 String srcUrl;
180 final ObservableValue<bool> unread; // TODO(jimhug): persist to server. 179 final ObservableValue<bool> unread; // TODO(jimhug): persist to server.
181 180
182 bool error; // TODO(jimhug): Check if this is dead and remove. 181 bool error; // TODO(jimhug): Check if this is dead and remove.
183 182
184 Article(this.dataSource, this.id, this.date, this.title, this.author, 183 Article(this.dataSource, this.id, this.date, this.title, this.author,
185 this.srcUrl, this.hasThumbnail, this.textBody, 184 this.srcUrl, this.hasThumbnail, this.textBody,
186 [htmlBody = null, bool unread = true, error = false]) 185 [this._htmlBody = null, bool unread = true, this.error = false])
187 : unread = new ObservableValue<bool>(unread), 186 : unread = new ObservableValue<bool>(unread);
188 this._htmlBody = htmlBody,
189 this.error = error;
190 187
191 String get htmlBody() { 188 String get htmlBody() {
192 _ensureLoaded(); 189 _ensureLoaded();
193 return _htmlBody; 190 return _htmlBody;
194 } 191 }
195 192
196 String get dataUri() { 193 String get dataUri() {
197 return Uri.encodeComponent(id).replaceAll( 194 return Uri.encodeComponent(id).replaceAll(
198 ',', '%2C').replaceAll('%2F', '/'); 195 ',', '%2C').replaceAll('%2F', '/');
199 } 196 }
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 final srcUrl = decoder.readString(); 234 final srcUrl = decoder.readString();
238 final hasThumbnail = decoder.readBool(); 235 final hasThumbnail = decoder.readBool();
239 final author = decoder.readString(); 236 final author = decoder.readString();
240 final dateInSeconds = decoder.readInt(); 237 final dateInSeconds = decoder.readInt();
241 final snippet = decoder.readString(); 238 final snippet = decoder.readString();
242 final date = new Date.fromEpoch(dateInSeconds*1000, new TimeZone.utc()); 239 final date = new Date.fromEpoch(dateInSeconds*1000, new TimeZone.utc());
243 return new Article(source, id, date, title, author, srcUrl, hasThumbnail, 240 return new Article(source, id, date, title, author, srcUrl, hasThumbnail,
244 snippet); 241 snippet);
245 } 242 }
246 } 243 }
OLDNEW
« no previous file with comments | « client/observable/observable.dart ('k') | client/touch/Geometry.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698