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 "skia/public/interfaces/bitmap.mojom"; | |
8 | |
9 // The Shelf interface allows clients (eg. Chrome) to control the mash shelf. | |
10 interface Shelf { | |
11 AddObserver(ShelfObserver observer); | |
12 | |
13 SetAlignment(Alignment alignment); | |
14 SetAutoHideBehavior(AutoHideBehavior auto_hide); | |
15 | |
16 AddItem(ShelfItem item, ShelfItemDelegate delegate); | |
17 RemoveItem(string id); | |
18 }; | |
19 | |
20 // ShelfObserver is notified on shelf changes; used to persist profile settings. | |
21 interface ShelfObserver { | |
sky
2016/04/06 02:57:45
When the observer is added seems like you should c
msw
2016/04/07 20:34:57
Done. FYI: we now rely on the ordering of (1) chro
sky
2016/04/07 22:02:46
Be sure and document this.
| |
22 OnAlignmentChanged(Alignment alignment); | |
23 OnAutoHideBehaviorChanged(AutoHideBehavior auto_hide); | |
24 }; | |
25 | |
26 // ShelfItemDelegate handles command execution and observes shelf item changes. | |
27 interface ShelfItemDelegate { | |
sky
2016/04/06 02:57:45
Why do you need 'id' in each of these functions? I
sky
2016/04/06 02:57:45
I'm nervous that all the delegates are different p
msw
2016/04/07 20:34:57
I had planned that a single ShelfItemDelegate migh
msw
2016/04/07 20:34:58
OKay, I associated observers and item delegates wi
| |
28 // Called on invocation of a shelf item's context menu command. | |
29 ExecuteCommand(string id, uint32 command_id, int32 event_flags); | |
30 | |
31 // Called when a pinned shelf item is unpinned. | |
32 ItemRemoved(string id); | |
sky
2016/04/06 02:57:45
If this is called when the item is unpinned can it
msw
2016/04/07 20:34:57
Yes and good call.
| |
33 | |
34 // Called when a pinned shelf item is reordered. | |
35 ItemReordered(string id, uint32 order); | |
sky
2016/04/06 02:57:45
Document what 'order' means.
msw
2016/04/07 20:34:57
Done.
| |
36 }; | |
37 | |
38 // These values match ash::ShelfAlignment. | |
39 enum Alignment { BOTTOM, LEFT, RIGHT, }; | |
40 | |
41 // These values match ash::ShelfAutoHideBehavior. | |
42 enum AutoHideBehavior { ALWAYS, NEVER, HIDDEN, }; | |
43 | |
44 // ContextMenuItems may be used to supplement ash shelf item context menus. | |
45 struct ContextMenuItem { | |
46 enum Type { ITEM, CHECK, RADIO, SEPARATOR, SUBMENU }; | |
47 | |
48 Type type; | |
49 uint32 command_id; | |
50 string? label; | |
51 array<ContextMenuItem>? submenu; | |
52 bool enabled; | |
53 bool checked; | |
54 uint32 radio_group_id; | |
55 }; | |
56 | |
57 // ShelfItem contains the basic fields needed to pin shortcut items. | |
58 struct ShelfItem { | |
59 // An id, used to correlate windows and shortcuts (eg. 'exe:chrome'). | |
60 string id; | |
61 | |
62 // A title, used for tooltips, etc. (eg. 'Chrome'). | |
63 string title; | |
64 | |
65 // An icon image Bitmap, shown on the shelf. | |
66 skia.mojom.Bitmap image; | |
67 | |
68 // Additional context menu items (eg. 'New Incognito Window'). | |
69 array<ContextMenuItem>? context_menu_items; | |
70 }; | |
OLD | NEW |