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 // Start syncing a remote (Chrome) ShelfModel and the local (Ash) ShelfModel. | |
65 // Chrome's supplied |observer| will be notified of Ash's ShelfModel changes. | |
66 // The callback passes Ash's corresponding |observer| of Chrome's ShelfModel. | |
67 // Chrome delays binding its observer until the callback is run, so it can | |
68 // prepend Ash's |items| and notify Ash's observer of existing Chrome items. | |
69 LinkShelfModels(ShelfModelObserver observer) => (ShelfModelObserver observer, | |
sky
2017/05/26 19:42:01
Is there a reason you don't want LinkShelfModels t
msw
2017/05/27 00:04:38
I've started pursuing changes like what you sugges
| |
70 array<ShelfItem> items); | |
71 | |
64 // Set the shelf alignment and auto-hide behavior. See Shelf for details. | 72 // Set the shelf alignment and auto-hide behavior. See Shelf for details. |
73 // TODO(jamescook): Eliminate all these methods and use the ash pref service | |
74 // to observe and to set prefs. http://crbug.com/723085 | |
65 SetAlignment(ShelfAlignment alignment, int64 display_id); | 75 SetAlignment(ShelfAlignment alignment, int64 display_id); |
66 SetAutoHideBehavior(ShelfAutoHideBehavior auto_hide, int64 display_id); | 76 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 }; | 77 }; |
73 | 78 |
74 // ShelfObserver is notified on shelf changes; used to persist profile settings. | 79 // ShelfObserver is notified on shelf changes; used to persist profile settings. |
75 interface ShelfObserver { | 80 interface ShelfObserver { |
76 // TODO(jamescook): Eliminate all these methods and use the ash pref service | 81 // TODO(jamescook): Eliminate all these methods and use the ash pref service |
77 // to observe and to set prefs. http://crbug.com/723085 | 82 // to observe and to set prefs. http://crbug.com/723085 |
78 OnShelfInitialized(int64 display_id); | 83 OnShelfInitialized(int64 display_id); |
79 OnAlignmentChanged(ShelfAlignment alignment, int64 display_id); | 84 OnAlignmentChanged(ShelfAlignment alignment, int64 display_id); |
80 OnAutoHideBehaviorChanged(ShelfAutoHideBehavior auto_hide, int64 display_id); | 85 OnAutoHideBehaviorChanged(ShelfAutoHideBehavior auto_hide, int64 display_id); |
81 }; | 86 }; |
82 | 87 |
88 // ShelfModelObserver is notified on changes to the shelf model and its items. | |
89 interface ShelfModelObserver { | |
90 OnShelfItemAdded(int32 index, ShelfItem item); | |
91 OnShelfItemRemoved(int32 index, ShelfItem item); | |
92 OnShelfItemMoved(int32 start_index, int32 target_index); | |
93 OnShelfItemChanged(int32 index, ShelfItem item); | |
94 OnShelfItemDelegateChanged(ShelfID id, ShelfItemDelegate delegate); | |
95 }; | |
96 | |
83 // ShelfItemDelegate handles shelf item selection, menu command execution, etc. | 97 // ShelfItemDelegate handles shelf item selection, menu command execution, etc. |
84 interface ShelfItemDelegate { | 98 interface ShelfItemDelegate { |
85 // Called when the user selects a shelf item. The event, display, and source | 99 // 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. | 100 // info should be provided if known; some implementations use these arguments. |
87 // Defaults: (nullptr, kInvalidDisplayId, LAUNCH_FROM_UNKNOWN) | 101 // Defaults: (nullptr, kInvalidDisplayId, LAUNCH_FROM_UNKNOWN) |
88 // The callback reports the action taken and any app menu items to show. | 102 // The callback reports the action taken and any app menu items to show. |
89 // | 103 // |
90 // NOTE: This codepath is not currently used for context menu triggering. | 104 // NOTE: This codepath is not currently used for context menu triggering. |
91 // TODO(msw): Remove |display_id| once panels are removed. crbug.com/691099 | 105 // TODO(msw): Remove |display_id| once panels are removed. crbug.com/691099 |
92 ItemSelected(ui.mojom.Event event, | 106 ItemSelected(ui.mojom.Event event, |
(...skipping 29 matching lines...) Expand all Loading... | |
122 struct ShelfID { | 136 struct ShelfID { |
123 string app_id; // An app id string, used to match app windows. | 137 string app_id; // An app id string, used to match app windows. |
124 // (eg. extension ids, arc ids, "AppList", etc.) | 138 // (eg. extension ids, arc ids, "AppList", etc.) |
125 string launch_id; // A string used to support multiple items per app. | 139 string launch_id; // A string used to support multiple items per app. |
126 // (eg. Citrix may use 'Word' or 'Excel' launch ids) | 140 // (eg. Citrix may use 'Word' or 'Excel' launch ids) |
127 }; | 141 }; |
128 | 142 |
129 // ShelfItems are used to populate the shelf. | 143 // ShelfItems are used to populate the shelf. |
130 // This structure matches ash::ShelfItem. | 144 // This structure matches ash::ShelfItem. |
131 struct ShelfItem { | 145 struct ShelfItem { |
132 ShelfItemType type; // The type of the shelf item. | 146 ShelfItemType type; // The type of the shelf item. |
133 skia.mojom.Bitmap image; // An icon image Bitmap, shown on the shelf. | 147 skia.mojom.Bitmap? image; // An icon image Bitmap, shown on the shelf. |
134 ShelfItemStatus status; // The running/closed/etc. status of the item. | 148 ShelfItemStatus status; // The running/closed/etc. status of the item. |
135 ShelfID shelf_id; // The id for the shelf item and its windows. | 149 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. | 150 mojo.common.mojom.String16 title; // The title to display for tooltips, etc. |
137 bool shows_tooltip; // Whether the tooltip should be shown on hover. | 151 bool shows_tooltip; // Whether the tooltip should be shown on hover. |
138 bool pinned_by_policy; // Whether the item is pinned by policy preferences, | 152 bool pinned_by_policy; // Whether the item is pinned by policy prefs, the |
139 // the user cannot un-pin these items. | 153 // user cannot un-pin these items. |
140 }; | 154 }; |
OLD | NEW |