Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(402)

Side by Side Diff: ash/public/interfaces/shelf.mojom

Issue 2718563008: mash: Use mojo for ShelfItemDelegate and [app] MenuItem. (Closed)
Patch Set: Cleanup; fix ash_shell compile and a couple tests. Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 module ash.mojom; 5 module ash.mojom;
6 6
7 import "mojo/common/string16.mojom";
7 import "skia/public/interfaces/bitmap.mojom"; 8 import "skia/public/interfaces/bitmap.mojom";
9 import "ui/events/mojo/event.mojom";
10
11 // These values match ash::ShelfAction.
12 enum ShelfAction {
13 NONE,
James Cook 2017/03/09 01:09:47 nit: document these. Everything in mojoms needs to
msw 2017/03/10 06:17:56 Done.
14 WINDOW_CREATED,
15 WINDOW_ACTIVATED,
16 WINDOW_MINIMIZED,
17 APP_LIST_SHOWN,
18 };
8 19
9 // These values match ash::ShelfAlignment. 20 // These values match ash::ShelfAlignment.
10 enum ShelfAlignment { BOTTOM, LEFT, RIGHT, BOTTOM_LOCKED, }; 21 enum ShelfAlignment { BOTTOM, LEFT, RIGHT, BOTTOM_LOCKED, };
11 22
12 // These values match ash::ShelfAutoHideBehavior. 23 // These values match ash::ShelfAutoHideBehavior.
13 enum ShelfAutoHideBehavior { ALWAYS, NEVER, HIDDEN, }; 24 enum ShelfAutoHideBehavior { ALWAYS, NEVER, HIDDEN, };
14 25
26 // These values match ash::ShelfLaunchSource.
27 enum ShelfLaunchSource { UNKNOWN, APP_LIST, APP_LIST_SEARCH, };
James Cook 2017/03/09 01:09:46 ditto arguably the mojo docs are more important t
msw 2017/03/10 06:17:56 Done.
28
15 // The Shelf controller allows clients (eg. Chrome) to control the ash shelf. 29 // The Shelf controller allows clients (eg. Chrome) to control the ash shelf.
16 interface ShelfController { 30 interface ShelfController {
17 // Observers are immediately notified of the current shelf states when added. 31 // Observers are immediately notified of the current shelf states when added.
18 AddObserver(associated ShelfObserver observer); 32 AddObserver(associated ShelfObserver observer);
19 33
20 // Set the shelf alignment and auto-hide behavior. See WmShelf for details. 34 // Set the shelf alignment and auto-hide behavior. See WmShelf for details.
21 SetAlignment(ShelfAlignment alignment, int64 display_id); 35 SetAlignment(ShelfAlignment alignment, int64 display_id);
22 SetAutoHideBehavior(ShelfAutoHideBehavior auto_hide, int64 display_id); 36 SetAutoHideBehavior(ShelfAutoHideBehavior auto_hide, int64 display_id);
23 37
24 // Pin and unpin items on the shelf, or update shelf item images. 38 // Pin and unpin items on the shelf, or update shelf item images.
25 PinItem(ShelfItem item, associated ShelfItemDelegate delegate); 39 PinItem(ShelfItem item, associated ShelfItemDelegate delegate);
26 UnpinItem(string app_id); 40 UnpinItem(string app_id);
27 SetItemImage(string app_id, skia.mojom.Bitmap image); 41 SetItemImage(string app_id, skia.mojom.Bitmap image);
28 }; 42 };
29 43
30 // ShelfObserver is notified on shelf changes; used to persist profile settings. 44 // ShelfObserver is notified on shelf changes; used to persist profile settings.
31 interface ShelfObserver { 45 interface ShelfObserver {
32 OnShelfCreated(int64 display_id); 46 OnShelfCreated(int64 display_id);
33 OnAlignmentChanged(ShelfAlignment alignment, int64 display_id); 47 OnAlignmentChanged(ShelfAlignment alignment, int64 display_id);
34 OnAutoHideBehaviorChanged(ShelfAutoHideBehavior auto_hide, int64 display_id); 48 OnAutoHideBehaviorChanged(ShelfAutoHideBehavior auto_hide, int64 display_id);
35 }; 49 };
36 50
37 // ShelfItemDelegate handles command execution and observes shelf item changes. 51 // ShelfItemDelegate handles shelf item selection, menu command execution, etc.
38 interface ShelfItemDelegate { 52 interface ShelfItemDelegate {
39 // Called when a pinned shelf item is invoked without an open window. 53 // Called when the user selects a shelf item. The event, display, and source
40 LaunchItem(); 54 // info should be provided if known; some implementations use these arguments.
55 // Defaults: (nullptr, kInvalidDisplayId, LAUNCH_FROM_UNKNOWN)
56 // The callback reports the action taken and any app menu items to show.
James Cook 2017/03/09 01:09:47 Is this used for context menus? Either way it woul
msw 2017/03/10 06:17:56 Done. This and MenuItem are not used for context m
57 //
58 // TODO(msw): Use the Event location to determine the display id?
59 ItemSelected(ui.mojom.Event event,
60 int64 display_id,
61 ShelfLaunchSource source) => (ShelfAction action,
62 array<MenuItem> menu_items);
James Cook 2017/03/09 01:09:47 I like how you return both pieces of data atomical
msw 2017/03/10 06:17:56 Acknowledged.
41 63
42 // Called on invocation of a shelf item's context menu command. 64 // Called on invocation of a shelf item's context or application menu command.
43 ExecuteCommand(uint32 command_id, int32 event_flags); 65 ExecuteCommand(uint32 command_id, int32 event_flags);
44 66
45 // Called when a shelf item is pinned or unpinned. 67 // Closes all windows associated with this shelf item.
46 ItemPinned(); 68 Close();
47 ItemUnpinned();
48
49 // Called when a pinned shelf item is reordered.
50 // |order| is the index of the item on the shelf.
51 ItemReordered(uint32 order);
52 }; 69 };
53 70
54 // ContextMenuItems may be used to supplement ash shelf item context menus. 71 // MenuItems are used to populate context and application menus for shelf items.
55 struct ContextMenuItem { 72 struct MenuItem {
56 enum Type { ITEM, CHECK, RADIO, SEPARATOR, SUBMENU }; 73 enum Type { ITEM, CHECK, RADIO, SEPARATOR, SUBMENU };
57 74
58 Type type; 75 Type type;
59 uint32 command_id; 76 uint32 command_id;
60 string? label; 77 mojo.common.mojom.String16 label;
61 array<ContextMenuItem>? submenu; 78 skia.mojom.Bitmap image;
James Cook 2017/03/09 01:09:47 Is image optional? How is it used? Can it be a nul
msw 2017/03/10 06:17:57 It's not 'optional' in the sense of having a quest
79 array<MenuItem>? submenu;
62 bool enabled; 80 bool enabled;
63 bool checked; 81 bool checked;
64 uint32 radio_group_id; 82 uint32 radio_group_id;
65 }; 83 };
66 84
67 // ShelfItem contains the basic fields needed to pin shortcut items. 85 // ShelfItem contains the basic fields needed to pin shortcut items.
68 struct ShelfItem { 86 struct ShelfItem {
69 // An app id, used to correlate windows and shortcuts (eg. 'mojo:foo'). 87 // An app id, used to correlate windows and shortcuts (eg. 'mojo:foo').
70 string app_id; 88 string app_id;
71 89
72 // A app title, used for tooltips, etc. (eg. 'Foo Application'). 90 // A app title, used for tooltips, etc. (eg. 'Foo Application').
73 string app_title; 91 string app_title;
74 92
75 // An icon image Bitmap, shown on the shelf. 93 // An icon image Bitmap, shown on the shelf.
76 skia.mojom.Bitmap image; 94 skia.mojom.Bitmap image;
77 95
78 // Additional context menu items (eg. 'New Incognito Window'). 96 // Additional context menu items (eg. 'New Incognito Window').
79 array<ContextMenuItem>? context_menu_items; 97 array<MenuItem>? context_menu_items;
80 }; 98 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698