| OLD | NEW |
| 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 import 'package:mojom/intents/intents.mojom.dart'; | 6 import 'package:mojom/activity/activity.mojom.dart'; |
| 7 import 'package:sky/mojo/shell.dart' as shell; | 7 import 'package:sky/mojo/shell.dart' as shell; |
| 8 export 'package:mojom/intents/intents.mojom.dart' show Intent, ComponentName, St
ringExtra; | 8 |
| 9 export 'package:mojom/activity/activity.mojom.dart' show Intent, ComponentName,
StringExtra; |
| 9 | 10 |
| 10 const int NEW_DOCUMENT = 0x00080000; | 11 const int NEW_DOCUMENT = 0x00080000; |
| 11 const int NEW_TASK = 0x10000000; | 12 const int NEW_TASK = 0x10000000; |
| 12 const int MULTIPLE_TASK = 0x08000000; | 13 const int MULTIPLE_TASK = 0x08000000; |
| 13 | 14 |
| 14 ActivityManagerProxy _initActivityManager() { | 15 ActivityProxy _initActivity() { |
| 15 ActivityManagerProxy activityManager = new ActivityManagerProxy.unbound(); | 16 ActivityProxy activity = new ActivityProxy.unbound(); |
| 16 shell.requestService('mojo:sky_viewer', activityManager); | 17 shell.requestService('mojo:sky_viewer', activity); |
| 17 return activityManager; | 18 return activity; |
| 18 } | 19 } |
| 19 | 20 |
| 20 final ActivityManagerProxy _activityManager = _initActivityManager(); | 21 final ActivityProxy _activity = _initActivity(); |
| 21 | 22 |
| 22 Color _cachedPrimaryColor; | 23 Color _cachedPrimaryColor; |
| 23 String _cachedLabel; | 24 String _cachedLabel; |
| 24 | 25 |
| 25 | 26 |
| 26 void finishCurrentActivity() { | 27 void finishCurrentActivity() { |
| 27 _activityManager.ptr.finishCurrentActivity(); | 28 _activity.ptr.finishCurrentActivity(); |
| 28 } | 29 } |
| 29 | 30 |
| 30 void startActivity(Intent intent) { | 31 void startActivity(Intent intent) { |
| 31 _activityManager.ptr.startActivity(intent); | 32 _activity.ptr.startActivity(intent); |
| 32 } | 33 } |
| 33 | 34 |
| 34 void updateTaskDescription(String label, Color color) { | 35 void updateTaskDescription(String label, Color color) { |
| 35 if (_cachedPrimaryColor == color && _cachedLabel == label) | 36 if (_cachedPrimaryColor == color && _cachedLabel == label) |
| 36 return; | 37 return; |
| 37 | 38 |
| 38 _cachedPrimaryColor = color; | 39 _cachedPrimaryColor = color; |
| 39 _cachedLabel = label; | 40 _cachedLabel = label; |
| 40 | 41 |
| 41 TaskDescription description = new TaskDescription() | 42 TaskDescription description = new TaskDescription() |
| 42 ..label = label | 43 ..label = label |
| 43 ..primaryColor = (color != null ? color.value : null); | 44 ..primaryColor = (color != null ? color.value : null); |
| 44 | 45 |
| 45 _activityManager.ptr.setTaskDescription(description); | 46 _activity.ptr.setTaskDescription(description); |
| 46 } | 47 } |
| OLD | NEW |