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

Side by Side Diff: samples/swarm/SwarmApp.dart

Issue 11810004: Make browser tests all run from a server instead of the local filesystem. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 months 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 part of swarmlib; 5 part of swarmlib;
6 6
7 /** 7 /**
8 * A simple news reader in Dart. 8 * A simple news reader in Dart.
9 */ 9 */
10 class Swarm extends App { 10 class Swarm extends App {
11 /** 11 /**
12 * Flag to insure the onLoad isn't called when callback from initializeFromUrl 12 * Flag to insure the onLoad isn't called when callback from initializeFromUrl
13 * could occur before the document's onload event. 13 * could occur before the document's onload event.
14 */ 14 */
15 bool onLoadFired; 15 bool onLoadFired;
16 16
17 /** Collections of datafeeds to show per page. */ 17 /** Collections of datafeeds to show per page. */
18 Sections sections; 18 Sections sections;
19 19
20 /** The front page of the app. */ 20 /** The front page of the app. */
21 FrontView frontView; 21 FrontView frontView;
22 22
23 /** Observable UI state. */ 23 /** Observable UI state. */
24 SwarmState state; 24 SwarmState state;
25 25
26 Swarm() : super(), onLoadFired = false { 26 Swarm({bool useCannedData : false}) : super(), onLoadFired = false {
27 Sections.initializeFromUrl((currSections) { 27 Sections.initializeFromUrl(useCannedData, (currSections) {
28 sections = currSections; 28 sections = currSections;
29 state = new SwarmState(sections); 29 state = new SwarmState(sections);
30 setupApp(); 30 setupApp();
31 }); 31 });
32 // Catch user keypresses and decide whether to use them for the 32 // Catch user keypresses and decide whether to use them for the
33 // Streams app or pass them on to the browser. 33 // Streams app or pass them on to the browser.
34 document.on.keyUp.add((e) { 34 document.on.keyUp.add((e) {
35 if (frontView != null) { 35 if (frontView != null) {
36 frontView.processKeyEvent(e); 36 frontView.processKeyEvent(e);
37 } 37 }
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 refresh(); 80 refresh();
81 eraseSplashScreen(); 81 eraseSplashScreen();
82 } 82 }
83 } 83 }
84 84
85 void render() { 85 void render() {
86 frontView = new FrontView(this); 86 frontView = new FrontView(this);
87 frontView.addToDocument(document.body); 87 frontView.addToDocument(document.body);
88 } 88 }
89 } 89 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698