Chromium Code Reviews| Index: sky/sdk/lib/widgets/task_description.dart |
| diff --git a/sky/sdk/lib/widgets/task_description.dart b/sky/sdk/lib/widgets/task_description.dart |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..7419759db0c28bf9f268774a1e0d9ff6da28ba8f |
| --- /dev/null |
| +++ b/sky/sdk/lib/widgets/task_description.dart |
| @@ -0,0 +1,44 @@ |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +import 'package:mojom/intents/intents.mojom.dart' as intents; |
| +import 'package:sky/mojo/shell.dart' as shell; |
| +import 'package:sky/widgets/widget.dart'; |
| +import 'package:sky/widgets/theme.dart'; |
| + |
| +class TaskDescription extends StatefulComponent { |
| + Widget child; |
| + String label; |
| + Color _cachedPrimaryColor; |
| + String _cachedLabel; |
| + |
| + TaskDescription({this.label, this.child}); |
| + |
| + void syncFields(TaskDescription source) { |
| + child = source.child; |
| + label = source.label; |
| + } |
| + |
| + 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.
|
| + if (_cachedPrimaryColor == color && _cachedLabel == label) |
| + return; |
| + |
| + _cachedPrimaryColor = color; |
| + _cachedLabel = label; |
| + |
| + intents.ActivityManagerProxy activityManager = |
| + new intents.ActivityManagerProxy.unbound(); |
| + intents.TaskDescription description = new intents.TaskDescription() |
| + ..label = label |
| + ..primaryColor = (color != null ? color.value : null); |
| + |
| + shell.requestService(null, activityManager); |
| + activityManager.ptr.setTaskDescription(description); |
| + } |
| + |
| + Widget build() { |
| + updateTaskDescription(label, Theme.of(this).primaryColor); |
| + return child; |
| + } |
| +} |