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

Side by Side Diff: runtime/observatory/lib/src/app/page.dart

Issue 2180803002: Converted Observatory vm-connect element (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 5 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
OLDNEW
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
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 DumpRepositoryMock(ObservatoryApplication.app.loadCrashDump),
Cutch 2016/07/25 13:57:15 why are we using a mock here?
cbernaschina 2016/07/25 17:27:28 It is to adapt the method name from loadCrashDump
376 ObservatoryApplication.app.notifications,
377 queue: ObservatoryApplication.app.queue);
374 } 378 }
375 assert(element != null); 379 assert(element != null);
376 } 380 }
377 381
378 void _visit(Uri uri) { 382 void _visit(Uri uri) {
379 assert(element != null); 383 assert(element != null);
380 assert(canVisit(uri)); 384 assert(canVisit(uri));
381 } 385 }
382 386
383 bool canVisit(Uri uri) => uri.path == 'vm-connect'; 387 bool canVisit(Uri uri) => uri.path == 'vm-connect';
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
471 assert(element != null); 475 assert(element != null);
472 } 476 }
473 477
474 void _visit(Uri uri) { 478 void _visit(Uri uri) {
475 assert(element != null); 479 assert(element != null);
476 assert(canVisit(uri)); 480 assert(canVisit(uri));
477 } 481 }
478 482
479 bool canVisit(Uri uri) => uri.path == 'timeline'; 483 bool canVisit(Uri uri) => uri.path == 'timeline';
480 } 484 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698