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

Side by Side Diff: sky/sdk/lib/widgets/widget.dart

Issue 1213623008: Back button should be able to close apps (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 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
« no previous file with comments | « sky/sdk/example/stocks/lib/main.dart ('k') | sky/services/intents/intents.mojom » ('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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 import 'dart:async'; 5 import 'dart:async';
6 import 'dart:collection'; 6 import 'dart:collection';
7 import 'dart:mirrors'; 7 import 'dart:mirrors';
8 import 'dart:sky' as sky; 8 import 'dart:sky' as sky;
9 9
10 import 'package:mojom/intents/intents.mojom.dart';
11 import 'package:sky/mojo/shell.dart' as shell;
12
10 import '../base/hit_test.dart'; 13 import '../base/hit_test.dart';
11 import '../rendering/box.dart'; 14 import '../rendering/box.dart';
12 import '../rendering/object.dart'; 15 import '../rendering/object.dart';
13 import '../rendering/sky_binding.dart'; 16 import '../rendering/sky_binding.dart';
14 17
15 export '../rendering/box.dart' show BoxConstraints, BoxDecoration, Border, Borde rSide, EdgeDims; 18 export '../rendering/box.dart' show BoxConstraints, BoxDecoration, Border, Borde rSide, EdgeDims;
16 export '../rendering/flex.dart' show FlexDirection; 19 export '../rendering/flex.dart' show FlexDirection;
17 export '../rendering/object.dart' show Point, Offset, Size, Rect, Color, Paint, Path; 20 export '../rendering/object.dart' show Point, Offset, Size, Rect, Color, Paint, Path;
18 21
19 final bool _shouldLogRenderDuration = false; 22 final bool _shouldLogRenderDuration = false;
(...skipping 924 matching lines...) Expand 10 before | Expand all | Expand 10 after
944 super.didMount(); 947 super.didMount();
945 SkyBinding.instance.addEventListener(_handleEvent); 948 SkyBinding.instance.addEventListener(_handleEvent);
946 } 949 }
947 950
948 void didUnmount() { 951 void didUnmount() {
949 super.didUnmount(); 952 super.didUnmount();
950 SkyBinding.instance.removeEventListener(_handleEvent); 953 SkyBinding.instance.removeEventListener(_handleEvent);
951 } 954 }
952 955
953 // Override this to handle back button behavior in your app 956 // Override this to handle back button behavior in your app
954 void onBack() { } 957 // Call super.onBack() to finish the activity
958 void onBack() {
959 ActivityManagerProxy activityManager = new ActivityManagerProxy.unbound();
960 shell.requestService(null, activityManager);
abarth-chromium 2015/07/07 00:14:24 s/null/'mojo:sky_viewer'/
961 activityManager.ptr.finishCurrentActivity();
962 }
955 } 963 }
956 964
957 abstract class AbstractWidgetRoot extends Component { 965 abstract class AbstractWidgetRoot extends Component {
958 966
959 AbstractWidgetRoot() : super(stateful: true) { 967 AbstractWidgetRoot() : super(stateful: true) {
960 _mounted = true; 968 _mounted = true;
961 _scheduleComponentForRender(this); 969 _scheduleComponentForRender(this);
962 } 970 }
963 971
964 void syncFields(AbstractWidgetRoot source) { 972 void syncFields(AbstractWidgetRoot source) {
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
1034 if (root.parent == null) { 1042 if (root.parent == null) {
1035 // we haven't attached it yet 1043 // we haven't attached it yet
1036 assert(_container.child == null); 1044 assert(_container.child == null);
1037 _container.child = root; 1045 _container.child = root;
1038 } 1046 }
1039 assert(root.parent == _container); 1047 assert(root.parent == _container);
1040 } 1048 }
1041 1049
1042 Widget build() => builder(); 1050 Widget build() => builder();
1043 } 1051 }
OLDNEW
« no previous file with comments | « sky/sdk/example/stocks/lib/main.dart ('k') | sky/services/intents/intents.mojom » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698