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

Unified Diff: mash/shelf/public/interfaces/shelf.mojom

Issue 1839223003: Add basic Chrome interaction with the mash shelf. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use associated interfaces for observers and item delegates. Created 4 years, 8 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 side-by-side diff with in-line comments
Download patch
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..a441e3f11711103d099e05a0ad11ba950c824e81
--- /dev/null
+++ b/mash/shelf/public/interfaces/shelf.mojom
@@ -0,0 +1,72 @@
+// 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 controller allows clients (eg. Chrome) to control the mash shelf.
+interface ShelfController {
+ AddObserver(associated ShelfObserver observer);
+
+ SetAlignment(Alignment alignment);
+ SetAutoHideBehavior(AutoHideBehavior auto_hide);
+
+ AddItem(ShelfItem item, associated ShelfItemDelegate delegate);
+ RemoveItem(string id);
+};
+
+// ShelfObserver is notified on shelf changes; used to persist profile settings.
+interface ShelfObserver {
+ OnAlignmentChanged(Alignment alignment);
+ OnAutoHideBehaviorChanged(AutoHideBehavior auto_hide);
+};
+
+// ShelfItemDelegate handles command execution and observes shelf item changes.
+interface ShelfItemDelegate {
+ // Called on invocation of a shelf item's context menu command.
+ ExecuteCommand(uint32 command_id, int32 event_flags);
+
+ // Called when a shelf item is pinned or unpinned.
+ ItemPinned();
+ ItemUnpinned();
+
+ // Called when a pinned shelf item is reordered.
+ // |order| is the index of the item on the shelf.
+ ItemReordered(uint32 order);
+};
+
+// 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;
+};

Powered by Google App Engine
This is Rietveld 408576698