1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145
|
// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Private API for trusted extensions/apps to do desk related operations.
[platforms=("chromeos"),
implemented_in="chrome/browser/chromeos/extensions/wm/wm_desks_private_api.h"]
namespace wmDesksPrivate {
enum SavedDeskType {
// Desk saved for regular desk template.
kTemplate,
// Desk saved for Save & Recall.
kSaveAndRecall,
// Unknown desk type.
kUnknown
};
dictionary RemoveDeskOptions {
// Define whether close all windows on the desk and combine them to the
// active desk to the left.
boolean combineDesks;
// Define whether removed desk is retrievable.
boolean? allowUndo;
};
dictionary Desk {
// Unique ID for a desk.
DOMString deskUuid;
// User readable name of the desk.
DOMString deskName;
};
dictionary SavedDesk {
// Unique ID for a saved desk.
DOMString savedDeskUuid;
// User readable name of the saved desk.
DOMString savedDeskName;
// Saved desk type.
SavedDeskType savedDeskType;
};
// Launch desk options
dictionary LaunchOptions {
// User readable name of the desk.
DOMString? deskName;
};
// Window properties
dictionary WindowProperties {
// If window show up on all desks.
boolean allDesks;
};
callback DeskIdCallback = void (DOMString deskId);
callback VoidCallback = void ();
callback GetDeskTemplateJsonCallback = void (DOMString templateJson);
callback GetAllDesksCallback = void (Desk[] desks);
callback GetSavedDesksCallback = void (SavedDesk[] saveDesks);
callback SaveActiveDeskCallback = void (SavedDesk desk);
callback GetDeskByIDCallback = void (Desk desk);
interface Functions {
// Returns all available previously-saved desks.
static void getSavedDesks(
GetSavedDesksCallback callback);
// Launches a desk, if `templateUuid` is present in the options, launches a
// desk template, otherwise launches an empty desk. If `deskName` is present
// in the options, using provided name as desk name, otherwise launches with
// auto generated name.
static void launchDesk(
LaunchOptions launchOptions,
DeskIdCallback callback);
// Gets the template associated with the templateUuid and returns its JSON
// representation. Returns an error if either the template could not be
// found or the user profile is not valid.
static void getDeskTemplateJson(
DOMString templateUuid,
GetDeskTemplateJsonCallback callback);
// Removes a desk as specified in `deskId`. If `combineDesks` of
// `RemoveDeskOptions` is present or set to true, remove the desk and
// combine windows to the active desk to the left. If `allowUndo` is
// present or set to true, prompt the user with a notification allowing for
// the desk to be retrieved. Otherwise close all windows on the desk.
static void removeDesk(
DOMString deskId,
optional RemoveDeskOptions removeDeskOptions,
optional VoidCallback callback);
// Returns all available desks.
static void getAllDesks(GetAllDesksCallback callback);
// Sets the window properties for window identified by the `windowId`.
static void setWindowProperties(
long windowId,
WindowProperties windowProperties,
optional VoidCallback callback);
// Saves the current active desk to the library and remove it from the desk
// bar.
static void saveActiveDesk(
SaveActiveDeskCallback callback);
// Deletes the saved desk from the library.
static void deleteSavedDesk(
DOMString savedDeskUuid,
optional VoidCallback callback);
// Launches a saved desk from the library back to active desk.
static void recallSavedDesk(
DOMString savedDeskUuid,
DeskIdCallback callback);
// Retrieves the UUID of the current active desk.
static void getActiveDesk(DeskIdCallback callback);
// Switches to the target desk.
static void switchDesk(
DOMString deskUuid, VoidCallback callback);
// Retrieves desk by the desk UUID.
static void getDeskByID(
DOMString deskUuid, GetDeskByIDCallback callback);
};
interface Events {
// Fires when new desks is added.
static void OnDeskAdded(DOMString deskId, boolean fromUndo);
// Fires when desk removal is finalized.
static void OnDeskRemoved(DOMString deskId);
// Fires when desk activation changed.
static void OnDeskSwitched(DOMString activated, DOMString deactivated);
};
};
|