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

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

Issue 2828603002: Format samples and samples-dev directories. (Closed)
Patch Set: Created 3 years, 8 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
« no previous file with comments | « samples-dev/swarm/SwarmViews.dart ('k') | samples-dev/swarm/Views.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 part of swarmlib; 5 part of swarmlib;
6 6
7 /** 7 /**
8 * The base class for UI state that intends to support browser history. 8 * The base class for UI state that intends to support browser history.
9 */ 9 */
10 abstract class UIState { 10 abstract class UIState {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 void pushToHistory() { 53 void pushToHistory() {
54 if (_historyTracking == null) { 54 if (_historyTracking == null) {
55 throw 'history tracking not started'; 55 throw 'history tracking not started';
56 } 56 }
57 57
58 String state = JSON.encode(toHistory()); 58 String state = JSON.encode(toHistory());
59 59
60 // TODO(jmesserly): [state] should be an Object, and we should pass it to 60 // TODO(jmesserly): [state] should be an Object, and we should pass it to
61 // the state parameter instead of as a #hash URL. Right now we're working 61 // the state parameter instead of as a #hash URL. Right now we're working
62 // around b/4582542. 62 // around b/4582542.
63 window.history.pushState(null, 63 window.history
64 '${document.title}', '${document.title}#$state'); 64 .pushState(null, '${document.title}', '${document.title}#$state');
65 } 65 }
66 66
67 /** 67 /**
68 * Serialize the state to a form suitable for storing in browser history. 68 * Serialize the state to a form suitable for storing in browser history.
69 */ 69 */
70 Map<String, String> toHistory(); 70 Map<String, String> toHistory();
71 71
72 /** 72 /**
73 * Load the UI state from the given [values]. 73 * Load the UI state from the given [values].
74 */ 74 */
75 void loadFromHistory(Map<String, String> values); 75 void loadFromHistory(Map<String, String> values);
76 } 76 }
OLDNEW
« no previous file with comments | « samples-dev/swarm/SwarmViews.dart ('k') | samples-dev/swarm/Views.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698