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
|
// Copyright 2025 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
dictionary ReadingListEntry {
// The url of the entry.
DOMString url;
// The title of the entry.
DOMString title;
// Will be <code>true</code> if the entry has been read.
boolean hasBeenRead;
// The last time the entry was updated.
// This value is in milliseconds since Jan 1, 1970.
double lastUpdateTime;
// The time the entry was created.
// Recorded in milliseconds since Jan 1, 1970.
double creationTime;
};
dictionary AddEntryOptions {
// The url of the entry.
DOMString url;
// The title of the entry.
DOMString title;
// Will be <code>true</code> if the entry has been read.
boolean hasBeenRead;
};
dictionary RemoveOptions {
// The url to remove.
DOMString url;
};
dictionary UpdateEntryOptions {
// The url that will be updated.
DOMString url;
// The new title. The existing tile remains if a value isn't provided.
DOMString? title;
// The updated read status. The existing status remains if a value
// isn't provided.
boolean? hasBeenRead;
};
dictionary QueryInfo {
// A url to search for.
DOMString? url;
// A title to search for.
DOMString? title;
// Indicates whether to search for read (<code>true</code>) or unread
// (<code>false</code>) items.
boolean? hasBeenRead;
};
// Listener callback for the onEntryAdded event.
// |entry|: The entry that was added.
callback OnEntryAddedListener = undefined (ReadingListEntry entry);
interface OnEntryAddedEvent : ExtensionEvent {
static undefined addListener(OnEntryAddedListener listener);
static undefined removeListener(OnEntryAddedListener listener);
static boolean hasListener(OnEntryAddedListener listener);
};
// Listener callback for the onEntryRemoved event.
// |entry|: The entry that was removed.
callback OnEntryRemovedListener = undefined (ReadingListEntry entry);
interface OnEntryRemovedEvent : ExtensionEvent {
static undefined addListener(OnEntryRemovedListener listener);
static undefined removeListener(OnEntryRemovedListener listener);
static boolean hasListener(OnEntryRemovedListener listener);
};
// Listener callback for the onEntryUpdated event.
// |entry|: The entry that was updated.
callback OnEntryUpdatedListener = undefined (ReadingListEntry entry);
interface OnEntryUpdatedEvent : ExtensionEvent {
static undefined addListener(OnEntryUpdatedListener listener);
static undefined removeListener(OnEntryUpdatedListener listener);
static boolean hasListener(OnEntryUpdatedListener listener);
};
// Use the <code>chrome.readingList</code> API to read from and modify
// the items in the
// <a href="https://support.google.com/chrome/answer/7343019">Reading List</a>.
interface ReadingList {
// Adds an entry to the reading list if it does not exist.
// |entry|: The entry to add to the reading list.
// |Returns|: Invoked once the entry has been added.
static Promise<undefined> addEntry(AddEntryOptions entry);
// Removes an entry from the reading list if it exists.
// |info|: The entry to remove from the reading list.
// |Returns|: Invoked once the entry has been removed.
static Promise<undefined> removeEntry(RemoveOptions info);
// Updates a reading list entry if it exists.
// |info|: The entry to update.
// |Returns|: Invoked once the matched entries have been updated.
static Promise<undefined> updateEntry(UpdateEntryOptions info);
// Retrieves all entries that match the <code>QueryInfo</code> properties.
// Properties that are not provided will not be matched.
// |info|: The properties to search for.
// |Returns|: Invoked once the entries have been matched.
// |PromiseValue|: entries
[requiredCallback] static Promise<sequence<ReadingListEntry>> query(
QueryInfo info);
// Triggered when a <code>ReadingListEntry</code> is added to the reading
// list.
static attribute OnEntryAddedEvent onEntryAdded;
// Triggered when a <code>ReadingListEntry</code> is removed from the reading
// list.
static attribute OnEntryRemovedEvent onEntryRemoved;
// Triggered when a <code>ReadingListEntry</code> is updated in the reading
// list.
static attribute OnEntryUpdatedEvent onEntryUpdated;
};
partial interface Browser {
static attribute ReadingList readingList;
};
|