Chromium Code Reviews| Index: mash/shelf/public/interfaces/shelf.mojom |
| diff --git a/mash/shelf/public/interfaces/shelf.mojom b/mash/shelf/public/interfaces/shelf.mojom |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..c1532ec379287afe96e0d085eb7428c0ed0e1651 |
| --- /dev/null |
| +++ b/mash/shelf/public/interfaces/shelf.mojom |
| @@ -0,0 +1,70 @@ |
| +// Copyright 2016 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. |
| + |
| +module mash.shelf.mojom; |
| + |
| +import "skia/public/interfaces/bitmap.mojom"; |
| + |
| +// The Shelf interface allows clients (eg. Chrome) to control the mash shelf. |
| +interface Shelf { |
| + AddObserver(ShelfObserver observer); |
| + |
| + SetAlignment(Alignment alignment); |
| + SetAutoHideBehavior(AutoHideBehavior auto_hide); |
| + |
| + AddItem(ShelfItem item, ShelfItemDelegate delegate); |
| + RemoveItem(string id); |
| +}; |
| + |
| +// ShelfObserver is notified on shelf changes; used to persist profile settings. |
| +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.
|
| + OnAlignmentChanged(Alignment alignment); |
| + OnAutoHideBehaviorChanged(AutoHideBehavior auto_hide); |
| +}; |
| + |
| +// ShelfItemDelegate handles command execution and observes shelf item changes. |
| +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
|
| + // Called on invocation of a shelf item's context menu command. |
| + ExecuteCommand(string id, uint32 command_id, int32 event_flags); |
| + |
| + // Called when a pinned shelf item is unpinned. |
| + 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.
|
| + |
| + // Called when a pinned shelf item is reordered. |
| + ItemReordered(string id, uint32 order); |
|
sky
2016/04/06 02:57:45
Document what 'order' means.
msw
2016/04/07 20:34:57
Done.
|
| +}; |
| + |
| +// These values match ash::ShelfAlignment. |
| +enum Alignment { BOTTOM, LEFT, RIGHT, }; |
| + |
| +// These values match ash::ShelfAutoHideBehavior. |
| +enum AutoHideBehavior { ALWAYS, NEVER, HIDDEN, }; |
| + |
| +// ContextMenuItems may be used to supplement ash shelf item context menus. |
| +struct ContextMenuItem { |
| + enum Type { ITEM, CHECK, RADIO, SEPARATOR, SUBMENU }; |
| + |
| + Type type; |
| + uint32 command_id; |
| + string? label; |
| + array<ContextMenuItem>? submenu; |
| + bool enabled; |
| + bool checked; |
| + uint32 radio_group_id; |
| +}; |
| + |
| +// ShelfItem contains the basic fields needed to pin shortcut items. |
| +struct ShelfItem { |
| + // An id, used to correlate windows and shortcuts (eg. 'exe:chrome'). |
| + string id; |
| + |
| + // A title, used for tooltips, etc. (eg. 'Chrome'). |
| + string title; |
| + |
| + // An icon image Bitmap, shown on the shelf. |
| + skia.mojom.Bitmap image; |
| + |
| + // Additional context menu items (eg. 'New Incognito Window'). |
| + array<ContextMenuItem>? context_menu_items; |
| +}; |