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

Side by Side Diff: sky/sdk/example/demo_launcher/lib/main.dart

Issue 1214633008: SkyDemo should launch demos in their own windows (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
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:sky'; 5 import 'dart:sky';
6 6
7 import 'package:mojom/intents/intents.mojom.dart'; 7 import 'package:mojom/intents/intents.mojom.dart';
8 import 'package:sky/mojo/activity.dart' as activity;
8 import 'package:sky/mojo/asset_bundle.dart'; 9 import 'package:sky/mojo/asset_bundle.dart';
9 import 'package:sky/mojo/shell.dart' as shell; 10 import 'package:sky/mojo/shell.dart' as shell;
10 import 'package:sky/painting/box_painter.dart'; 11 import 'package:sky/painting/box_painter.dart';
11 import 'package:sky/theme/colors.dart' as colors; 12 import 'package:sky/theme/colors.dart' as colors;
12 import 'package:sky/theme/typography.dart' as typography; 13 import 'package:sky/theme/typography.dart' as typography;
13 import 'package:sky/widgets/basic.dart'; 14 import 'package:sky/widgets/basic.dart';
14 import 'package:sky/widgets/card.dart'; 15 import 'package:sky/widgets/card.dart';
15 import 'package:sky/widgets/fixed_height_scrollable.dart'; 16 import 'package:sky/widgets/fixed_height_scrollable.dart';
16 import 'package:sky/widgets/flat_button.dart'; 17 import 'package:sky/widgets/flat_button.dart';
17 import 'package:sky/widgets/material.dart'; 18 import 'package:sky/widgets/material.dart';
(...skipping 13 matching lines...) Expand all
31 void launch(String relativeUrl, String bundle) { 32 void launch(String relativeUrl, String bundle) {
32 Uri url = Uri.base.resolve(relativeUrl); 33 Uri url = Uri.base.resolve(relativeUrl);
33 34
34 ActivityManagerProxy activityManager = new ActivityManagerProxy.unbound(); 35 ActivityManagerProxy activityManager = new ActivityManagerProxy.unbound();
35 ComponentName component = new ComponentName() 36 ComponentName component = new ComponentName()
36 ..packageName = 'org.domokit.sky.demo' 37 ..packageName = 'org.domokit.sky.demo'
37 ..className = 'org.domokit.sky.demo.SkyDemoActivity'; 38 ..className = 'org.domokit.sky.demo.SkyDemoActivity';
38 Intent intent = new Intent() 39 Intent intent = new Intent()
39 ..action = 'android.intent.action.VIEW' 40 ..action = 'android.intent.action.VIEW'
40 ..component = component 41 ..component = component
42 ..flags = activity.MULTIPLE_TASK | activity.NEW_DOCUMENT
41 ..url = url.toString(); 43 ..url = url.toString();
42 44
43 if (bundle != null) { 45 if (bundle != null) {
44 StringExtra extra = new StringExtra() 46 StringExtra extra = new StringExtra()
45 ..name = 'bundleName' 47 ..name = 'bundleName'
46 ..value = bundle; 48 ..value = bundle;
47 intent.stringExtras = [extra]; 49 intent.stringExtras = [extra];
48 } 50 }
49 51
50 shell.requestService(null, activityManager); 52 activity.startActivity(intent);
51 activityManager.ptr.startActivity(intent);
52 } 53 }
53 54
54 class SkyDemo { 55 class SkyDemo {
55 String name; 56 String name;
56 String href; 57 String href;
57 String bundle; 58 String bundle;
58 String description; 59 String description;
59 typography.TextTheme textTheme; 60 typography.TextTheme textTheme;
60 BoxDecoration decoration; 61 BoxDecoration decoration;
61 SkyDemo({ this.name, this.href, this.bundle, this.description, this.textTheme, this.decoration }); 62 SkyDemo({ this.name, this.href, this.bundle, this.description, this.textTheme, this.decoration });
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 child: new DemoList() 186 child: new DemoList()
186 ) 187 )
187 ) 188 )
188 ); 189 );
189 } 190 }
190 } 191 }
191 192
192 void main() { 193 void main() {
193 runApp(new SkyHome()); 194 runApp(new SkyHome());
194 } 195 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698