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

Side by Side Diff: runtime/bin/vmservice/client/lib/src/app/location_manager.dart

Issue 322483005: Final Observatory 1.5 fixes (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 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
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 app; 5 part of app;
6 6
7 abstract class LocationManager extends Observable { 7 abstract class LocationManager extends Observable {
8 final _initialPath = '/vm'; 8 final _initialPath = '/vm';
9 ObservatoryApplication _app; 9 ObservatoryApplication _app;
10 10
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 event.preventDefault(); 68 event.preventDefault();
69 } 69 }
70 70
71 /// Given an application url, generate a link. 71 /// Given an application url, generate a link.
72 String makeLink(String url); 72 String makeLink(String url);
73 } 73 }
74 74
75 /// Uses location.hash to encode application urls. 75 /// Uses location.hash to encode application urls.
76 class HashLocationManager extends LocationManager { 76 class HashLocationManager extends LocationManager {
77 void _onStartup() { 77 void _onStartup() {
78 String initialPath = '/${window.location.hash}'; 78 String initialPath = '${window.location.hash}';
79 if ((window.location.hash == '') || (window.location.hash == '#')) { 79 if ((window.location.hash == '') || (window.location.hash == '#')) {
80 initialPath = '/#${_initialPath}'; 80 initialPath = '#${_initialPath}';
81 } 81 }
82 window.history.replaceState(initialPath, document.title, initialPath); 82 window.history.pushState(initialPath, document.title, initialPath);
83 _go(window.location.hash); 83 _go(window.location.hash);
84 } 84 }
85 85
86 void _onLocationChange(PopStateEvent _) { 86 void _onLocationChange(PopStateEvent _) {
87 _go(window.location.hash); 87 _go(window.location.hash);
88 } 88 }
89 89
90 /// Given an application url, generate a link for an anchor tag. 90 /// Given an application url, generate a link for an anchor tag.
91 String makeLink(String url) { 91 String makeLink(String url) {
92 return '#$url'; 92 return '#$url';
(...skipping 15 matching lines...) Expand all
108 _go(window.location.pathname); 108 _go(window.location.pathname);
109 } 109 }
110 110
111 void _onLocationChange(PopStateEvent _) { 111 void _onLocationChange(PopStateEvent _) {
112 _go(window.location.pathname); 112 _go(window.location.pathname);
113 } 113 }
114 114
115 /// Given an application url, generate a link for an anchor tag. 115 /// Given an application url, generate a link for an anchor tag.
116 String makeLink(String url) => url; 116 String makeLink(String url) => url;
117 } 117 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698