| 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"; |
| 11 } | 11 } |
| 12 | 12 |
| 13 /// A [Page] controls the user interface of Observatory. At any given time | 13 /// A [Page] controls the user interface of Observatory. At any given time |
| 14 /// one page will be the current page. Pages are registered at startup. | 14 /// one page will be the current page. Pages are registered at startup. |
| 15 /// When the user navigates within the application, each page is asked if it | 15 /// When the user navigates within the application, each page is asked if it |
| 16 /// can handle the current location, the first page to say yes, wins. | 16 /// can handle the current location, the first page to say yes, wins. |
| 17 abstract class Page extends Observable { | 17 abstract class Page extends Observable { |
| 18 final ObservatoryApplication app; | 18 final ObservatoryApplication app; |
| 19 final ObservableMap<String, String> internalArguments = | 19 final ObservableMap<String, String> internalArguments = |
| 20 new ObservableMap<String, String>(); | 20 new ObservableMap<String, String>(); |
| 21 @observable ObservatoryElement element; | 21 @observable HtmlElement element; |
| 22 | 22 |
| 23 Page(this.app); | 23 Page(this.app); |
| 24 | 24 |
| 25 /// Called when the page is installed, this callback must initialize | 25 /// Called when the page is installed, this callback must initialize |
| 26 /// [element]. | 26 /// [element]. |
| 27 void onInstall(); | 27 void onInstall(); |
| 28 | 28 |
| 29 /// Called when the page is uninstalled, this callback must clear | 29 /// Called when the page is uninstalled, this callback must clear |
| 30 /// [element]. | 30 /// [element]. |
| 31 void onUninstall() { | 31 void onUninstall() { |
| (...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 | 363 |
| 364 // TODO(turnidge): How to test this page? | 364 // TODO(turnidge): How to test this page? |
| 365 bool canVisit(Uri uri) => uri.path == 'error'; | 365 bool canVisit(Uri uri) => uri.path == 'error'; |
| 366 } | 366 } |
| 367 | 367 |
| 368 class VMConnectPage extends Page { | 368 class VMConnectPage extends Page { |
| 369 VMConnectPage(app) : super(app); | 369 VMConnectPage(app) : super(app); |
| 370 | 370 |
| 371 void onInstall() { | 371 void onInstall() { |
| 372 if (element == null) { | 372 if (element == null) { |
| 373 element = new Element.tag('vm-connect'); | 373 element = new VMConnectElement( |
| 374 ObservatoryApplication.app.targets, |
| 375 new CrashDumpRepositoryMock( |
| 376 load: ObservatoryApplication.app.loadCrashDump), |
| 377 ObservatoryApplication.app.notifications, |
| 378 queue: ObservatoryApplication.app.queue); |
| 374 } | 379 } |
| 375 assert(element != null); | 380 assert(element != null); |
| 376 } | 381 } |
| 377 | 382 |
| 378 void _visit(Uri uri) { | 383 void _visit(Uri uri) { |
| 379 assert(element != null); | 384 assert(element != null); |
| 380 assert(canVisit(uri)); | 385 assert(canVisit(uri)); |
| 381 } | 386 } |
| 382 | 387 |
| 383 bool canVisit(Uri uri) => uri.path == 'vm-connect'; | 388 bool canVisit(Uri uri) => uri.path == 'vm-connect'; |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 471 assert(element != null); | 476 assert(element != null); |
| 472 } | 477 } |
| 473 | 478 |
| 474 void _visit(Uri uri) { | 479 void _visit(Uri uri) { |
| 475 assert(element != null); | 480 assert(element != null); |
| 476 assert(canVisit(uri)); | 481 assert(canVisit(uri)); |
| 477 } | 482 } |
| 478 | 483 |
| 479 bool canVisit(Uri uri) => uri.path == 'timeline'; | 484 bool canVisit(Uri uri) => uri.path == 'timeline'; |
| 480 } | 485 } |
| OLD | NEW |