Chromium Code Reviews| 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 // Functions to modify ShelfModel items and their delegates. Observers are not | |
| 65 // notified of these changes, since Chrome is the solitary ShelfObserver and | |
| 66 // client of these functions; notifications would be cyclical and problematic. | |
| 67 AddShelfItem(int32 index, ShelfItem item); // Use a negative index to append. | |
| 68 RemoveShelfItem(ShelfID id); | |
| 69 MoveShelfItem(ShelfID id, int32 target_index); | |
|
James Cook
2017/05/30 22:47:47
nit: document what happens for negative/out-of-ran
msw
2017/05/31 16:55:21
Done.
| |
| 70 UpdateShelfItem(ShelfItem item); | |
| 71 SetShelfItemDelegate(ShelfID id, ShelfItemDelegate delegate); | |
| 72 | |
| 64 // Set the shelf alignment and auto-hide behavior. See Shelf for details. | 73 // Set the shelf alignment and auto-hide behavior. See Shelf for details. |
| 74 // TODO(jamescook): Eliminate all these methods and use the ash pref service | |
| 75 // to observe and to set prefs. http://crbug.com/723085 | |
| 65 SetAlignment(ShelfAlignment alignment, int64 display_id); | 76 SetAlignment(ShelfAlignment alignment, int64 display_id); |
| 66 SetAutoHideBehavior(ShelfAutoHideBehavior auto_hide, int64 display_id); | 77 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 }; | 78 }; |
| 73 | 79 |
| 74 // ShelfObserver is notified on shelf changes; used to persist profile settings. | 80 // A Shelf observer, used to persist profile settings and cache a ShelfModel. |
| 75 interface ShelfObserver { | 81 interface ShelfObserver { |
| 76 // TODO(jamescook): Eliminate all these methods and use the ash pref service | 82 // TODO(jamescook): Eliminate all these methods and use the ash pref service |
| 77 // to observe and to set prefs. http://crbug.com/723085 | 83 // to observe and to set prefs. http://crbug.com/723085 |
| 78 OnShelfInitialized(int64 display_id); | 84 OnShelfInitialized(int64 display_id); |
| 79 OnAlignmentChanged(ShelfAlignment alignment, int64 display_id); | 85 OnAlignmentChanged(ShelfAlignment alignment, int64 display_id); |
| 80 OnAutoHideBehaviorChanged(ShelfAutoHideBehavior auto_hide, int64 display_id); | 86 OnAutoHideBehaviorChanged(ShelfAutoHideBehavior auto_hide, int64 display_id); |
| 87 | |
| 88 // Functions to observe changes to ShelfModel items and their delegates. | |
| 89 OnShelfItemAdded(int32 index, ShelfItem item); | |
| 90 OnShelfItemRemoved(int32 index, ShelfItem item); | |
| 91 OnShelfItemMoved(int32 start_index, int32 target_index); | |
|
James Cook
2017/05/30 22:47:47
naively it seems like this should pass an ID to ve
msw
2017/05/31 16:55:21
I'll pass the item's id instead of the original in
| |
| 92 OnShelfItemChanged(int32 index, ShelfItem item); | |
|
James Cook
2017/05/30 22:47:47
It's a little odd that this takes an index. I woul
msw
2017/05/31 16:55:21
I removed that index param, fixed the name, added
| |
| 93 OnShelfItemDelegateChanged(ShelfID id, ShelfItemDelegate delegate); | |
| 81 }; | 94 }; |
| 82 | 95 |
| 83 // ShelfItemDelegate handles shelf item selection, menu command execution, etc. | 96 // ShelfItemDelegate handles shelf item selection, menu command execution, etc. |
| 84 interface ShelfItemDelegate { | 97 interface ShelfItemDelegate { |
| 85 // Called when the user selects a shelf item. The event, display, and source | 98 // 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. | 99 // info should be provided if known; some implementations use these arguments. |
| 87 // Defaults: (nullptr, kInvalidDisplayId, LAUNCH_FROM_UNKNOWN) | 100 // Defaults: (nullptr, kInvalidDisplayId, LAUNCH_FROM_UNKNOWN) |
| 88 // The callback reports the action taken and any app menu items to show. | 101 // The callback reports the action taken and any app menu items to show. |
| 89 // | 102 // |
| 90 // NOTE: This codepath is not currently used for context menu triggering. | 103 // 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 { | 135 struct ShelfID { |
| 123 string app_id; // An app id string, used to match app windows. | 136 string app_id; // An app id string, used to match app windows. |
| 124 // (eg. extension ids, arc ids, "AppList", etc.) | 137 // (eg. extension ids, arc ids, "AppList", etc.) |
| 125 string launch_id; // A string used to support multiple items per app. | 138 string launch_id; // A string used to support multiple items per app. |
| 126 // (eg. Citrix may use 'Word' or 'Excel' launch ids) | 139 // (eg. Citrix may use 'Word' or 'Excel' launch ids) |
| 127 }; | 140 }; |
| 128 | 141 |
| 129 // ShelfItems are used to populate the shelf. | 142 // ShelfItems are used to populate the shelf. |
| 130 // This structure matches ash::ShelfItem. | 143 // This structure matches ash::ShelfItem. |
| 131 struct ShelfItem { | 144 struct ShelfItem { |
| 132 ShelfItemType type; // The type of the shelf item. | 145 ShelfItemType type; // The type of the shelf item. |
| 133 skia.mojom.Bitmap image; // An icon image Bitmap, shown on the shelf. | 146 skia.mojom.Bitmap? image; // An icon image Bitmap, shown on the shelf. |
| 134 ShelfItemStatus status; // The running/closed/etc. status of the item. | 147 ShelfItemStatus status; // The running/closed/etc. status of the item. |
| 135 ShelfID shelf_id; // The id for the shelf item and its windows. | 148 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. | 149 mojo.common.mojom.String16 title; // The title to display for tooltips, etc. |
| 137 bool shows_tooltip; // Whether the tooltip should be shown on hover. | 150 bool shows_tooltip; // Whether the tooltip should be shown on hover. |
| 138 bool pinned_by_policy; // Whether the item is pinned by policy preferences, | 151 bool pinned_by_policy; // Whether the item is pinned by policy prefs, the |
| 139 // the user cannot un-pin these items. | 152 // user cannot un-pin these items. |
| 140 }; | 153 }; |
| OLD | NEW |