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

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

Issue 10544076: Changes to run Swarm from the Editor and to suppress warnings. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Clean up a constructor Created 8 years, 6 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
« no previous file with comments | « samples/swarm/SwarmViews.dart ('k') | samples/ui_lib/view/view.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 /** 5 /**
6 * The base class for UI state that intends to support browser history. 6 * The base class for UI state that intends to support browser history.
7 */ 7 */
8 class UIState { 8 class UIState {
9 /** 9 /**
10 * The event listener we hook to the window's "popstate" event. 10 * The event listener we hook to the window's "popstate" event.
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 void pushToHistory() { 51 void pushToHistory() {
52 if (_historyTracking == null) { 52 if (_historyTracking == null) {
53 throw 'history tracking not started'; 53 throw 'history tracking not started';
54 } 54 }
55 55
56 String state = JSON.stringify(toHistory()); 56 String state = JSON.stringify(toHistory());
57 57
58 // TODO(jmesserly): [state] should be an Object, and we should pass it to 58 // TODO(jmesserly): [state] should be an Object, and we should pass it to
59 // the state parameter instead of as a #hash URL. Right now we're working 59 // the state parameter instead of as a #hash URL. Right now we're working
60 // around b/4582542. 60 // around b/4582542.
61 window.history.pushState(null, document.title, '#' + state); 61 window.history.pushState(null, '${document.title}#$state');
62 } 62 }
63 63
64 /** 64 /**
65 * Serialize the state to a form suitable for storing in browser history. 65 * Serialize the state to a form suitable for storing in browser history.
66 */ 66 */
67 abstract Map<String, String> toHistory(); 67 abstract Map<String, String> toHistory();
68 68
69 /** 69 /**
70 * Load the UI state from the given [values]. 70 * Load the UI state from the given [values].
71 */ 71 */
72 abstract void loadFromHistory(Map<String, String> values); 72 abstract void loadFromHistory(Map<String, String> values);
73 } 73 }
OLDNEW
« no previous file with comments | « samples/swarm/SwarmViews.dart ('k') | samples/ui_lib/view/view.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698