| OLD | NEW |
| 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 "mojo/common/string16.mojom"; |
| 8 import "skia/public/interfaces/bitmap.mojom"; | 8 import "skia/public/interfaces/bitmap.mojom"; |
| 9 import "ui/events/mojo/event.mojom"; | 9 import "ui/events/mojo/event.mojom"; |
| 10 | 10 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 UNKNOWN, // The item was launched from outside the app list. | 54 UNKNOWN, // The item was launched from outside the app list. |
| 55 APP_LIST, // The item was launched from a generic app list view. | 55 APP_LIST, // The item was launched from a generic app list view. |
| 56 APP_LIST_SEARCH, // The item was launched from an app list search view. | 56 APP_LIST_SEARCH, // The item was launched from an app list search view. |
| 57 }; | 57 }; |
| 58 | 58 |
| 59 // The Shelf controller allows clients (eg. Chrome) to control the ash shelf. | 59 // The Shelf controller allows clients (eg. Chrome) to control the ash shelf. |
| 60 interface ShelfController { | 60 interface ShelfController { |
| 61 // Observers are immediately notified of the current shelf states when added. | 61 // Observers are immediately notified of the current shelf states when added. |
| 62 AddObserver(associated ShelfObserver observer); | 62 AddObserver(associated ShelfObserver observer); |
| 63 | 63 |
| 64 // Note: ShelfObservers are not notified of ShelfModel changes made by the |
| 65 // ShelfItem functions below. Chrome is the solitary ShelfObserver and client |
| 66 // of these functions, so notifications would be cyclical and problematic. |
| 67 |
| 68 // Add |item| at |index|, which is clamped to be greater than 0 (AppList's |
| 69 // index) and not exceeding the item count. Use a negative |index| to append. |
| 70 AddShelfItem(int32 index, ShelfItem item); |
| 71 // Remove the item with |id|. Bails if |id| is unknown or for the AppList. |
| 72 RemoveShelfItem(ShelfID id); |
| 73 // Moves item with |id| to |index|, which is in terms of the model after the |
| 74 // item is removed, and is clamped to be greater than 0 (AppList's index) and |
| 75 // not exceeding the item count. Bails if |id| is unknown or for the AppList. |
| 76 MoveShelfItem(ShelfID id, int32 target_index); |
| 77 // Updates |item| via ShelfID. Bails if the id is unknown or for the AppList. |
| 78 UpdateShelfItem(ShelfItem item); |
| 79 // Sets the |delegate| for the item with |id|. |
| 80 SetShelfItemDelegate(ShelfID id, ShelfItemDelegate delegate); |
| 81 |
| 64 // Set the shelf alignment and auto-hide behavior. See Shelf for details. | 82 // Set the shelf alignment and auto-hide behavior. See Shelf for details. |
| 83 // TODO(jamescook): Eliminate all these methods and use the ash pref service |
| 84 // to observe and to set prefs. http://crbug.com/723085 |
| 65 SetAlignment(ShelfAlignment alignment, int64 display_id); | 85 SetAlignment(ShelfAlignment alignment, int64 display_id); |
| 66 SetAutoHideBehavior(ShelfAutoHideBehavior auto_hide, int64 display_id); | 86 SetAutoHideBehavior(ShelfAutoHideBehavior auto_hide, int64 display_id); |
| 67 | |
| 68 // Pin and unpin items on the shelf, or update shelf item images. | |
| 69 PinItem(ShelfItem item, associated ShelfItemDelegate delegate); | |
| 70 UnpinItem(string app_id); | |
| 71 SetItemImage(string app_id, skia.mojom.Bitmap image); | |
| 72 }; | 87 }; |
| 73 | 88 |
| 74 // ShelfObserver is notified on shelf changes; used to persist profile settings. | 89 // A Shelf observer, used to persist profile settings and cache a ShelfModel. |
| 75 interface ShelfObserver { | 90 interface ShelfObserver { |
| 76 // TODO(jamescook): Eliminate all these methods and use the ash pref service | 91 // TODO(jamescook): Eliminate all these methods and use the ash pref service |
| 77 // to observe and to set prefs. http://crbug.com/723085 | 92 // to observe and to set prefs. http://crbug.com/723085 |
| 78 OnShelfInitialized(int64 display_id); | 93 OnShelfInitialized(int64 display_id); |
| 79 OnAlignmentChanged(ShelfAlignment alignment, int64 display_id); | 94 OnAlignmentChanged(ShelfAlignment alignment, int64 display_id); |
| 80 OnAutoHideBehaviorChanged(ShelfAutoHideBehavior auto_hide, int64 display_id); | 95 OnAutoHideBehaviorChanged(ShelfAutoHideBehavior auto_hide, int64 display_id); |
| 96 |
| 97 // Called when the |item| has been added at |index|. |
| 98 OnShelfItemAdded(int32 index, ShelfItem item); |
| 99 // Called when the item with |id| has been removed. |
| 100 OnShelfItemRemoved(ShelfID id); |
| 101 // Called when the item with |id| has been moved to |index|. |
| 102 OnShelfItemMoved(ShelfID id, int32 index); |
| 103 // Called when the |item| with matching ShelfID has been updated. |
| 104 OnShelfItemUpdated(ShelfItem item); |
| 105 // Called when |delegate| for the item with |id| has been changed. |
| 106 OnShelfItemDelegateChanged(ShelfID id, ShelfItemDelegate delegate); |
| 81 }; | 107 }; |
| 82 | 108 |
| 83 // ShelfItemDelegate handles shelf item selection, menu command execution, etc. | 109 // ShelfItemDelegate handles shelf item selection, menu command execution, etc. |
| 84 interface ShelfItemDelegate { | 110 interface ShelfItemDelegate { |
| 85 // Called when the user selects a shelf item. The event, display, and source | 111 // Called when the user selects a shelf item. The event, display, and source |
| 86 // info should be provided if known; some implementations use these arguments. | 112 // info should be provided if known; some implementations use these arguments. |
| 87 // Defaults: (nullptr, kInvalidDisplayId, LAUNCH_FROM_UNKNOWN) | 113 // Defaults: (nullptr, kInvalidDisplayId, LAUNCH_FROM_UNKNOWN) |
| 88 // The callback reports the action taken and any app menu items to show. | 114 // The callback reports the action taken and any app menu items to show. |
| 89 // | 115 // |
| 90 // NOTE: This codepath is not currently used for context menu triggering. | 116 // NOTE: This codepath is not currently used for context menu triggering. |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 struct ShelfID { | 148 struct ShelfID { |
| 123 string app_id; // An app id string, used to match app windows. | 149 string app_id; // An app id string, used to match app windows. |
| 124 // (eg. extension ids, arc ids, "AppList", etc.) | 150 // (eg. extension ids, arc ids, "AppList", etc.) |
| 125 string launch_id; // A string used to support multiple items per app. | 151 string launch_id; // A string used to support multiple items per app. |
| 126 // (eg. Citrix may use 'Word' or 'Excel' launch ids) | 152 // (eg. Citrix may use 'Word' or 'Excel' launch ids) |
| 127 }; | 153 }; |
| 128 | 154 |
| 129 // ShelfItems are used to populate the shelf. | 155 // ShelfItems are used to populate the shelf. |
| 130 // This structure matches ash::ShelfItem. | 156 // This structure matches ash::ShelfItem. |
| 131 struct ShelfItem { | 157 struct ShelfItem { |
| 132 ShelfItemType type; // The type of the shelf item. | 158 ShelfItemType type; // The type of the shelf item. |
| 133 skia.mojom.Bitmap image; // An icon image Bitmap, shown on the shelf. | 159 skia.mojom.Bitmap? image; // An icon image Bitmap, shown on the shelf. |
| 134 ShelfItemStatus status; // The running/closed/etc. status of the item. | 160 ShelfItemStatus status; // The running/closed/etc. status of the item. |
| 135 ShelfID shelf_id; // The id for the shelf item and its windows. | 161 ShelfID shelf_id; // The id for the shelf item and its windows. |
| 136 mojo.common.mojom.String16 title; // The title to display for tooltips, etc. | 162 mojo.common.mojom.String16 title; // The title to display for tooltips, etc. |
| 137 bool shows_tooltip; // Whether the tooltip should be shown on hover. | 163 bool shows_tooltip; // Whether the tooltip should be shown on hover. |
| 138 bool pinned_by_policy; // Whether the item is pinned by policy preferences, | 164 bool pinned_by_policy; // Whether the item is pinned by policy prefs, the |
| 139 // the user cannot un-pin these items. | 165 // user cannot un-pin these items. |
| 140 }; | 166 }; |
| OLD | NEW |