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 // TODO(msw): Add support for multiple displays (with unified and multi-shelf). |
| 10 |
| 11 // The Shelf controller allows clients (eg. Chrome) to control the mash shelf. |
| 12 interface ShelfController { |
| 13 AddObserver(associated ShelfObserver observer); |
| 14 |
| 15 SetAlignment(Alignment alignment); |
| 16 SetAutoHideBehavior(AutoHideBehavior auto_hide); |
| 17 |
| 18 AddItem(ShelfItem item, associated ShelfItemDelegate delegate); |
| 19 RemoveItem(string id); |
| 20 }; |
| 21 |
| 22 // ShelfObserver is notified on shelf changes; used to persist profile settings. |
| 23 interface ShelfObserver { |
| 24 OnAlignmentChanged(Alignment alignment); |
| 25 OnAutoHideBehaviorChanged(AutoHideBehavior auto_hide); |
| 26 }; |
| 27 |
| 28 // ShelfItemDelegate handles command execution and observes shelf item changes. |
| 29 interface ShelfItemDelegate { |
| 30 // Called on invocation of a shelf item's context menu command. |
| 31 ExecuteCommand(uint32 command_id, int32 event_flags); |
| 32 |
| 33 // Called when a shelf item is pinned or unpinned. |
| 34 ItemPinned(); |
| 35 ItemUnpinned(); |
| 36 |
| 37 // Called when a pinned shelf item is reordered. |
| 38 // |order| is the index of the item on the shelf. |
| 39 ItemReordered(uint32 order); |
| 40 }; |
| 41 |
| 42 // These values match ash::ShelfAlignment. |
| 43 enum Alignment { BOTTOM, LEFT, RIGHT, }; |
| 44 |
| 45 // These values match ash::ShelfAutoHideBehavior. |
| 46 enum AutoHideBehavior { ALWAYS, NEVER, HIDDEN, }; |
| 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 id, used to correlate windows and shortcuts (eg. 'exe:chrome'). |
| 64 string id; |
| 65 |
| 66 // A title, used for tooltips, etc. (eg. 'Chrome'). |
| 67 string 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 |