OLD | NEW |
| (Empty) |
1 // Copyright 2016 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 module mash.shelf.mojom; | |
6 | |
7 import "mash/shelf/public/interfaces/shelf_constants.mojom"; | |
8 import "skia/public/interfaces/bitmap.mojom"; | |
9 | |
10 // TODO(msw): Add support for multiple displays (with unified and multi-shelf). | |
11 | |
12 // The Shelf controller allows clients (eg. Chrome) to control the mash shelf. | |
13 interface ShelfController { | |
14 AddObserver(associated ShelfObserver observer); | |
15 | |
16 SetAlignment(Alignment alignment); | |
17 SetAutoHideBehavior(AutoHideBehavior auto_hide); | |
18 | |
19 PinItem(ShelfItem item, associated ShelfItemDelegate delegate); | |
20 UnpinItem(string app_id); | |
21 | |
22 SetItemImage(string app_id, skia.mojom.Bitmap image); | |
23 }; | |
24 | |
25 // ShelfObserver is notified on shelf changes; used to persist profile settings. | |
26 interface ShelfObserver { | |
27 OnAlignmentChanged(Alignment alignment); | |
28 OnAutoHideBehaviorChanged(AutoHideBehavior auto_hide); | |
29 }; | |
30 | |
31 // ShelfItemDelegate handles command execution and observes shelf item changes. | |
32 interface ShelfItemDelegate { | |
33 // Called when a pinned shelf item is invoked without an open window. | |
34 LaunchItem(); | |
35 | |
36 // Called on invocation of a shelf item's context menu command. | |
37 ExecuteCommand(uint32 command_id, int32 event_flags); | |
38 | |
39 // Called when a shelf item is pinned or unpinned. | |
40 ItemPinned(); | |
41 ItemUnpinned(); | |
42 | |
43 // Called when a pinned shelf item is reordered. | |
44 // |order| is the index of the item on the shelf. | |
45 ItemReordered(uint32 order); | |
46 }; | |
47 | |
48 // ContextMenuItems may be used to supplement ash shelf item context menus. | |
49 struct ContextMenuItem { | |
50 enum Type { ITEM, CHECK, RADIO, SEPARATOR, SUBMENU }; | |
51 | |
52 Type type; | |
53 uint32 command_id; | |
54 string? label; | |
55 array<ContextMenuItem>? submenu; | |
56 bool enabled; | |
57 bool checked; | |
58 uint32 radio_group_id; | |
59 }; | |
60 | |
61 // ShelfItem contains the basic fields needed to pin shortcut items. | |
62 struct ShelfItem { | |
63 // An app id, used to correlate windows and shortcuts (eg. 'mojo:foo'). | |
64 string app_id; | |
65 | |
66 // A app title, used for tooltips, etc. (eg. 'Foo Application'). | |
67 string app_title; | |
68 | |
69 // An icon image Bitmap, shown on the shelf. | |
70 skia.mojom.Bitmap image; | |
71 | |
72 // Additional context menu items (eg. 'New Incognito Window'). | |
73 array<ContextMenuItem>? context_menu_items; | |
74 }; | |
OLD | NEW |