OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 class IsolateNotFound implements Exception { | 7 class IsolateNotFound implements Exception { |
8 String isolateId; | 8 String isolateId; |
9 IsolateNotFound(this.isolateId); | 9 IsolateNotFound(this.isolateId); |
10 String toString() => "IsolateNotFound: $isolateId"; | 10 String toString() => "IsolateNotFound: $isolateId"; |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 bool canVisit(Uri uri) => uri.path == path; | 77 bool canVisit(Uri uri) => uri.path == path; |
78 } | 78 } |
79 | 79 |
80 /// Error page for unrecognized paths. | 80 /// Error page for unrecognized paths. |
81 class ErrorPage extends Page { | 81 class ErrorPage extends Page { |
82 ErrorPage(app) : super(app); | 82 ErrorPage(app) : super(app); |
83 | 83 |
84 void onInstall() { | 84 void onInstall() { |
85 if (element == null) { | 85 if (element == null) { |
86 // Lazily create page. | 86 // Lazily create page. |
87 element = new Element.tag('general-error'); | 87 element = new GeneralErrorElement(app.notifications, queue: app.queue); |
88 } | 88 } |
89 } | 89 } |
90 | 90 |
91 void _visit(Uri uri) { | 91 void _visit(Uri uri) { |
92 assert(element != null); | 92 assert(element != null); |
93 assert(canVisit(uri)); | 93 assert(canVisit(uri)); |
94 | 94 |
95 /* | 95 (element as GeneralErrorElement).message = "Path '${uri.path}' not found"; |
96 if (uri.path == '') { | |
97 // Nothing requested. | |
98 return; | |
99 } | |
100 */ | |
101 | |
102 if (element != null) { | |
103 GeneralErrorElement serviceElement = element; | |
104 serviceElement.message = "Path '${uri.path}' not found"; | |
105 } | |
106 } | 96 } |
107 | 97 |
108 /// Catch all. | 98 /// Catch all. |
109 bool canVisit(Uri uri) => true; | 99 bool canVisit(Uri uri) => true; |
110 } | 100 } |
111 | 101 |
112 /// Top-level vm info page. | 102 /// Top-level vm info page. |
113 class VMPage extends SimplePage { | 103 class VMPage extends SimplePage { |
114 VMPage(app) : super('vm', 'service-view', app); | 104 VMPage(app) : super('vm', 'service-view', app); |
115 | 105 |
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
476 assert(element != null); | 466 assert(element != null); |
477 } | 467 } |
478 | 468 |
479 void _visit(Uri uri) { | 469 void _visit(Uri uri) { |
480 assert(element != null); | 470 assert(element != null); |
481 assert(canVisit(uri)); | 471 assert(canVisit(uri)); |
482 } | 472 } |
483 | 473 |
484 bool canVisit(Uri uri) => uri.path == 'timeline'; | 474 bool canVisit(Uri uri) => uri.path == 'timeline'; |
485 } | 475 } |
OLD | NEW |