Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 import 'package:mojom/intents/intents.mojom.dart' as intents; | |
| 6 import 'package:sky/mojo/shell.dart' as shell; | |
| 7 import 'package:sky/widgets/widget.dart'; | |
| 8 import 'package:sky/widgets/theme.dart'; | |
| 9 | |
| 10 class TaskDescription extends StatefulComponent { | |
| 11 Widget child; | |
| 12 String label; | |
| 13 Color _cachedPrimaryColor; | |
| 14 String _cachedLabel; | |
| 15 | |
| 16 TaskDescription({this.label, this.child}); | |
| 17 | |
| 18 void syncFields(TaskDescription source) { | |
| 19 child = source.child; | |
| 20 label = source.label; | |
| 21 } | |
| 22 | |
| 23 void updateTaskDescription(String label, Color color) { | |
|
abarth-chromium
2015/07/07 19:57:45
Can we put this code in sky/sdk/lib/mojo/activity.
| |
| 24 if (_cachedPrimaryColor == color && _cachedLabel == label) | |
| 25 return; | |
| 26 | |
| 27 _cachedPrimaryColor = color; | |
| 28 _cachedLabel = label; | |
| 29 | |
| 30 intents.ActivityManagerProxy activityManager = | |
| 31 new intents.ActivityManagerProxy.unbound(); | |
| 32 intents.TaskDescription description = new intents.TaskDescription() | |
| 33 ..label = label | |
| 34 ..primaryColor = (color != null ? color.value : null); | |
| 35 | |
| 36 shell.requestService(null, activityManager); | |
| 37 activityManager.ptr.setTaskDescription(description); | |
| 38 } | |
| 39 | |
| 40 Widget build() { | |
| 41 updateTaskDescription(label, Theme.of(this).primaryColor); | |
| 42 return child; | |
| 43 } | |
| 44 } | |
| OLD | NEW |