diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml
index b19390f..5435a05 100644
--- a/.github/workflows/build.yaml
+++ b/.github/workflows/build.yaml
@@ -17,7 +17,7 @@ jobs:
steps:
- uses: subosito/flutter-action@v2
with:
- channel: 'stable'
+ channel: 'master'
- uses: actions/checkout@v4
- run: dart --version
- run: |
diff --git a/CHANGELOG.md b/CHANGELOG.md
index dea50a7..967765c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,9 @@
+## 0.2.0
+
+- Regenerate the bindings based on Chrome v116
+- Update JS binding for Dart 3.2
+- Require Dart SDK >= 3.2
+
## 0.1.2
- Update the readme to give some tips on how to build Chrome extensions with Flutter.
diff --git a/README.md b/README.md
index fc05599..9bd2fdd 100644
--- a/README.md
+++ b/README.md
@@ -13,22 +13,64 @@ The JS interop is build on top of `dart:js_interop` (static interop) which make
### Example
+#### `chrome.tabs`
+```dart
+import 'package:chrome_extension/tabs.dart';
+
+void main() async {
+ var tabs = await chrome.tabs.query(QueryInfo(
+ active: true,
+ currentWindow: true,
+ ));
+ print(tabs.first.title);
+}
+```
+
+#### `chrome.alarms`
```dart
import 'package:chrome_extension/alarms.dart';
-import 'package:chrome_extension/power.dart';
-import 'package:chrome_extension/storage.dart';
void main() async {
- // Use the chrome.power API
+ await chrome.alarms.create('MyAlarm', AlarmCreateInfo(delayInMinutes: 2));
+
+ var alarm = await chrome.alarms.get('MyAlarm');
+ print(alarm!.name);
+}
+```
+
+#### `chrome.power`
+```dart
+import 'package:chrome_extension/power.dart';
+
+void main() {
chrome.power.requestKeepAwake(Level.display);
+}
+```
+
+#### `chrome.runtime`
+```dart
+import 'dart:js_interop';
+import 'package:chrome_extension/runtime.dart';
+
+void main() async {
+ chrome.runtime.onInstalled.listen((e) {
+ print('OnInstalled: ${e.reason}');
+ });
+
+ chrome.runtime.onMessage.listen((e) {
+ e.sendResponse.callAsFunction(null, {'the_response': 1}.jsify());
+ });
+}
+```
+
+#### `chrome.storage`
+```dart
+import 'package:chrome_extension/storage.dart';
- // Use the chrome.storage API
+void main() async {
await chrome.storage.local.set({'mykey': 'value'});
var values = await chrome.storage.local.get(null /* all */);
print(values['mykey']);
-
- // Use the chrome.alarms API
- await chrome.alarms.create('MyAlarm', AlarmCreateInfo(delayInMinutes: 2));
}
```
@@ -124,14 +166,16 @@ void main() async {
## Tips to build Chrome extensions with Flutter
+Here are some personal tips to build Chrome extension using the Flutter UI framework.
+
#### Develop the app using Flutter Desktop
In order to develop in a comfortable environment with hot-reload,
-most of the app can be developed using Flutter desktop.
+most of the app (the UI part) should be developed using Flutter desktop.
-This will require an abstraction layer between the UI and the `chrome_extension` APIs.
+This requires an abstraction layer between the UI and the `chrome_extension` APIs.
-A fake implementation of this abstraction layer is used in the Desktop entry point:
+In the Desktop entry point, a fake implementation of this abstraction layer is used, like this:
```dart
// lib/main_desktop.dart
@@ -154,7 +198,7 @@ class FakeBookmarkService implements BookmarkService {
Launch this entry point in desktop with
`flutter run -t lib/main_desktop.dart -d macos|windows|linux`
-Create the real entry point:
+And the real entry point (the one used in the actual compiled extension) looks like:
```dart
// lib/main.dart
diff --git a/README.template.md b/README.template.md
index 5db0d28..5e2ef5d 100644
--- a/README.template.md
+++ b/README.template.md
@@ -13,8 +13,29 @@ The JS interop is build on top of `dart:js_interop` (static interop) which make
### Example
+#### `chrome.tabs`
```dart
-import 'example/example.dart';
+import 'example/chrome_tabs.dart';
+```
+
+#### `chrome.alarms`
+```dart
+import 'example/chrome_alarms.dart';
+```
+
+#### `chrome.power`
+```dart
+import 'example/chrome_power.dart';
+```
+
+#### `chrome.runtime`
+```dart
+import 'example/chrome_runtime.dart';
+```
+
+#### `chrome.storage`
+```dart
+import 'example/chrome_storage.dart';
```
### Available APIs
@@ -28,14 +49,16 @@ import 'example/example.dart';
## Tips to build Chrome extensions with Flutter
+Here are some personal tips to build Chrome extension using the Flutter UI framework.
+
#### Develop the app using Flutter Desktop
In order to develop in a comfortable environment with hot-reload,
-most of the app can be developed using Flutter desktop.
+most of the app (the UI part) should be developed using Flutter desktop.
-This will require an abstraction layer between the UI and the `chrome_extension` APIs.
+This requires an abstraction layer between the UI and the `chrome_extension` APIs.
-A fake implementation of this abstraction layer is used in the Desktop entry point:
+In the Desktop entry point, a fake implementation of this abstraction layer is used, like this:
```dart
import 'example/desktop_entry_point.dart#example';
@@ -44,7 +67,7 @@ import 'example/desktop_entry_point.dart#example';
Launch this entry point in desktop with
`flutter run -t lib/main_desktop.dart -d macos|windows|linux`
-Create the real entry point:
+And the real entry point (the one used in the actual compiled extension) looks like:
```dart
import 'example/real_entry_point.dart#example';
diff --git a/example/chrome_alarms.dart b/example/chrome_alarms.dart
new file mode 100644
index 0000000..6b3358b
--- /dev/null
+++ b/example/chrome_alarms.dart
@@ -0,0 +1,8 @@
+import 'package:chrome_extension/alarms.dart';
+
+void main() async {
+ await chrome.alarms.create('MyAlarm', AlarmCreateInfo(delayInMinutes: 2));
+
+ var alarm = await chrome.alarms.get('MyAlarm');
+ print(alarm!.name);
+}
diff --git a/example/chrome_power.dart b/example/chrome_power.dart
new file mode 100644
index 0000000..1bb86db
--- /dev/null
+++ b/example/chrome_power.dart
@@ -0,0 +1,5 @@
+import 'package:chrome_extension/power.dart';
+
+void main() {
+ chrome.power.requestKeepAwake(Level.display);
+}
diff --git a/example/chrome_runtime.dart b/example/chrome_runtime.dart
new file mode 100644
index 0000000..9ea57b3
--- /dev/null
+++ b/example/chrome_runtime.dart
@@ -0,0 +1,12 @@
+import 'dart:js_interop';
+import 'package:chrome_extension/runtime.dart';
+
+void main() async {
+ chrome.runtime.onInstalled.listen((e) {
+ print('OnInstalled: ${e.reason}');
+ });
+
+ chrome.runtime.onMessage.listen((e) {
+ e.sendResponse.callAsFunction(null, {'the_response': 1}.jsify());
+ });
+}
diff --git a/example/chrome_storage.dart b/example/chrome_storage.dart
new file mode 100644
index 0000000..51271f3
--- /dev/null
+++ b/example/chrome_storage.dart
@@ -0,0 +1,7 @@
+import 'package:chrome_extension/storage.dart';
+
+void main() async {
+ await chrome.storage.local.set({'mykey': 'value'});
+ var values = await chrome.storage.local.get(null /* all */);
+ print(values['mykey']);
+}
diff --git a/example/chrome_tabs.dart b/example/chrome_tabs.dart
new file mode 100644
index 0000000..7ba1482
--- /dev/null
+++ b/example/chrome_tabs.dart
@@ -0,0 +1,9 @@
+import 'package:chrome_extension/tabs.dart';
+
+void main() async {
+ var tabs = await chrome.tabs.query(QueryInfo(
+ active: true,
+ currentWindow: true,
+ ));
+ print(tabs.first.title);
+}
diff --git a/extension_examples/dart/pubspec.lock b/extension_examples/dart/pubspec.lock
index a990d98..5cd6c95 100644
--- a/extension_examples/dart/pubspec.lock
+++ b/extension_examples/dart/pubspec.lock
@@ -47,7 +47,7 @@ packages:
path: "../.."
relative: true
source: path
- version: "0.1.2"
+ version: "0.3.0"
collection:
dependency: transitive
description:
@@ -92,10 +92,10 @@ packages:
dependency: transitive
description:
name: file
- sha256: "5fc22d7c25582e38ad9a8515372cd9a93834027aacf1801cf01164dac0ffa08c"
+ sha256: "1b92bec4fc2a72f59a8e15af5f52cd441e4a7860b49499d69dfa817af20e925d"
url: "https://pub.dev"
source: hosted
- version: "7.0.0"
+ version: "6.1.4"
frontend_server_client:
dependency: transitive
description:
@@ -208,6 +208,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.8.3"
+ platform:
+ dependency: transitive
+ description:
+ name: platform
+ sha256: ae68c7bfcd7383af3629daafb32fb4e8681c7154428da4febcff06200585f102
+ url: "https://pub.dev"
+ source: hosted
+ version: "3.1.2"
pool:
dependency: transitive
description:
@@ -216,6 +224,22 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.5.1"
+ process:
+ dependency: transitive
+ description:
+ name: process
+ sha256: "53fd8db9cec1d37b0574e12f07520d582019cb6c44abf5479a01505099a34a09"
+ url: "https://pub.dev"
+ source: hosted
+ version: "4.2.4"
+ process_runner:
+ dependency: "direct dev"
+ description:
+ name: process_runner
+ sha256: a3511a69d42216522166583f19cce6bf44efe109f3ca52fc7994f64bbdbe01e6
+ url: "https://pub.dev"
+ source: hosted
+ version: "4.1.2"
pub_semver:
dependency: transitive
description:
@@ -393,4 +417,4 @@ packages:
source: hosted
version: "3.1.2"
sdks:
- dart: ">=3.1.0 <4.0.0"
+ dart: ">=3.2.0-0 <4.0.0"
diff --git a/extension_examples/dart/pubspec.yaml b/extension_examples/dart/pubspec.yaml
index 1f22d0d..3e4b192 100644
--- a/extension_examples/dart/pubspec.yaml
+++ b/extension_examples/dart/pubspec.yaml
@@ -14,4 +14,5 @@ dependencies:
dev_dependencies:
lints:
+ process_runner:
test:
diff --git a/extension_examples/dart/tool/compile.dart b/extension_examples/dart/tool/compile.dart
new file mode 100644
index 0000000..098e5a7
--- /dev/null
+++ b/extension_examples/dart/tool/compile.dart
@@ -0,0 +1,15 @@
+import 'dart:io';
+import 'package:process_runner/process_runner.dart';
+
+final _process = ProcessRunner(printOutputDefault: true);
+
+void main() async {
+ await _process.runProcess([
+ Platform.resolvedExecutable,
+ 'compile',
+ 'js',
+ 'web/main.dart',
+ '-o',
+ 'web/_main.dart.js',
+ ]);
+}
diff --git a/extension_examples/dart/web/main.dart b/extension_examples/dart/web/main.dart
index 60f7172..6221942 100644
--- a/extension_examples/dart/web/main.dart
+++ b/extension_examples/dart/web/main.dart
@@ -1,11 +1,14 @@
import 'dart:js_interop';
+import 'package:chrome_extension/tabs.dart';
import 'package:web/web.dart';
void main() {
+ chrome.tabs.query(QueryInfo());
+
var button = document.querySelector('#startButton')! as HTMLElement;
button.addEventListener(
'click',
- (PointerEvent e) async {
+ (PointerEvent e) {
// Demonstrate apis
}
.toJS);
diff --git a/extension_examples/flutter/pubspec.lock b/extension_examples/flutter/pubspec.lock
index e30cec2..36a1656 100644
--- a/extension_examples/flutter/pubspec.lock
+++ b/extension_examples/flutter/pubspec.lock
@@ -31,7 +31,7 @@ packages:
path: "../.."
relative: true
source: path
- version: "0.1.2"
+ version: "0.3.0"
clock:
dependency: transitive
description:
@@ -44,10 +44,10 @@ packages:
dependency: transitive
description:
name: collection
- sha256: f092b211a4319e98e5ff58223576de6c2803db36221657b46c82574721240687
+ sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a
url: "https://pub.dev"
source: hosted
- version: "1.17.2"
+ version: "1.18.0"
cupertino_icons:
dependency: "direct main"
description:
@@ -110,10 +110,10 @@ packages:
dependency: transitive
description:
name: meta
- sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3"
+ sha256: a6e590c838b18133bb482a2745ad77c5bb7715fb0451209e1a7567d416678b8e
url: "https://pub.dev"
source: hosted
- version: "1.9.1"
+ version: "1.10.0"
path:
dependency: transitive
description:
@@ -139,18 +139,18 @@ packages:
dependency: transitive
description:
name: stack_trace
- sha256: c3c7d8edb15bee7f0f74debd4b9c5f3c2ea86766fe4178eb2a18eb30a0bdaed5
+ sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b"
url: "https://pub.dev"
source: hosted
- version: "1.11.0"
+ version: "1.11.1"
stream_channel:
dependency: transitive
description:
name: stream_channel
- sha256: "83615bee9045c1d322bbbd1ba209b7a749c2cbcdcb3fdd1df8eb488b3279c1c8"
+ sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7
url: "https://pub.dev"
source: hosted
- version: "2.1.1"
+ version: "2.1.2"
string_scanner:
dependency: transitive
description:
@@ -171,10 +171,10 @@ packages:
dependency: transitive
description:
name: test_api
- sha256: "75760ffd7786fffdfb9597c35c5b27eaeec82be8edfb6d71d32651128ed7aab8"
+ sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b"
url: "https://pub.dev"
source: hosted
- version: "0.6.0"
+ version: "0.6.1"
vector_math:
dependency: transitive
description:
@@ -187,9 +187,9 @@ packages:
dependency: transitive
description:
name: web
- sha256: dc8ccd225a2005c1be616fe02951e2e342092edf968cf0844220383757ef8f10
+ sha256: ccbbfbf29732ee1b391c4c6d13e7032d851f675f47365e81904e4c6fd669c854
url: "https://pub.dev"
source: hosted
- version: "0.1.4-beta"
+ version: "0.2.2-beta"
sdks:
- dart: ">=3.1.0 <4.0.0"
+ dart: ">=3.2.0-194.0.dev <4.0.0"
diff --git a/idl/chrome/action.json b/idl/chrome/action.json
index 015a6a0..43e07d9 100644
--- a/idl/chrome/action.json
+++ b/idl/chrome/action.json
@@ -175,7 +175,8 @@
"properties": {
"text": {
"type": "string",
- "description": "Any number of characters can be passed, but only about four can fit in the space."
+ "optional": true,
+ "description": "Any number of characters can be passed, but only about four can fit in the space. If an empty string ('') is passed, the badge text is cleared. If tabId is specified and text is null, the text for the specified tab is cleared and defaults to the global badge text."
},
"tabId": {
"type": "integer",
diff --git a/idl/chrome/autofill_private.idl b/idl/chrome/autofill_private.idl
index 6ac6510..423bf24 100644
--- a/idl/chrome/autofill_private.idl
+++ b/idl/chrome/autofill_private.idl
@@ -248,6 +248,7 @@ namespace autofillPrivate {
callback GetIbanListCallback = void(IbanEntry[] entries);
callback GetUpiIdListCallback = void(DOMString[] entries);
callback IsValidIbanCallback = void(boolean isValid);
+ callback CheckForUserAuthCallback = void(boolean isUserAuthSuccessful);
interface Functions {
// Gets currently signed-in user profile info, no value is returned if
@@ -348,6 +349,15 @@ namespace autofillPrivate {
// it refers to the legacy server id of credit cards, not the instrument
// ids.
static void removeVirtualCard(DOMString cardId);
+
+ // Authenticates the user via device authentication and if successful, it
+ // will then flip the mandatory auth toggle.
+ static void authenticateUserAndFlipMandatoryAuthToggle();
+
+ // Authenticates the user via device authentication and it would return
+ // the result of user auth. If the auth was successful, we will show
+ // the edit card dialog for the Local card.
+ [supportsPromises] static void authenticateUserToEditLocalCard(CheckForUserAuthCallback callback);
};
interface Events {
diff --git a/idl/chrome/autotest_private.idl b/idl/chrome/autotest_private.idl
index 79c60b5..a3c876a 100644
--- a/idl/chrome/autotest_private.idl
+++ b/idl/chrome/autotest_private.idl
@@ -5,6 +5,7 @@
// API for integration testing. To be used on test images with a test component
// extension.
[platforms=("chromeos"),
+ modernised_enums,
implemented_in="chrome/browser/ash/extensions/autotest_private/autotest_private_api.h"]
namespace autotestPrivate {
@@ -77,8 +78,8 @@ namespace autotestPrivate {
Minimized,
Maximized,
Fullscreen,
- LeftSnapped,
- RightSnapped,
+ PrimarySnapped,
+ SecondarySnapped,
PIP,
Floated
};
@@ -90,8 +91,8 @@ namespace autotestPrivate {
WMEventMaximize,
WMEventMinimize,
WMEventFullscreen,
- WMEventSnapLeft,
- WMEventSnapRight,
+ WMEventSnapPrimary,
+ WMEventSnapSecondary,
WMEventFloat
};
@@ -273,10 +274,12 @@ namespace autotestPrivate {
// A mapping of crosapi::BrowserManager::State
enum LacrosState {
NotInitialized,
+ Reloading,
Mounting,
Unavailable,
Stopped,
CreatingLogFile,
+ PreLaunched,
Starting,
Running,
Terminating
@@ -441,6 +444,7 @@ namespace autotestPrivate {
ShelfItemStatus status;
boolean showsTooltip;
boolean pinnedByPolicy;
+ boolean pinStateForcedByType;
boolean hasNotification;
};
@@ -813,6 +817,8 @@ namespace autotestPrivate {
// Callback invoked when the temporary directory was removed.
callback RemoveFuseboxTempDirCallback = void();
+ callback IsFeatureEnabledCallback = void(boolean enabled);
+
interface Functions {
// Must be called to allow autotestPrivateAPI events to be fired.
static void initializeEvents();
@@ -1476,6 +1482,13 @@ namespace autotestPrivate {
long timeout,
VoidCallback callback);
+ // Waits for ambient video to successfully start playback.
+ // |timeout|: the timeout in seconds.
+ // |callback|: Called when the operation has completed.
+ [supportsPromises] static void waitForAmbientVideo(
+ long timeout,
+ VoidCallback callback);
+
// Disables the automation feature. Note that the event handlers and caches
// of automation nodes still remain in the test extension and so the next
// automation.getDesktop will miss initialization. The caller should ensure
@@ -1508,15 +1521,17 @@ namespace autotestPrivate {
VoidCallback callback);
// Starts collection of ui::LoginEventRecorder data.
- static void startLoginEventRecorderDataCollection(VoidCallback callback);
+ [supportsPromises] static void startLoginEventRecorderDataCollection(
+ VoidCallback callback);
// Stops ui::LoginEventRecorder data collection and reports all the
// collected data.
- static void getLoginEventRecorderLoginEvents(
+ [supportsPromises] static void getLoginEventRecorderLoginEvents(
GetLoginEventRecorderLoginEventsCallback callback);
// Adds login event to test LoginEventRecorderDataCollection API.
- static void addLoginEventForTesting(VoidCallback callback);
+ [supportsPromises] static void addLoginEventForTesting(
+ VoidCallback callback);
// Force auto theme mode in dark mode or light mode for testing.
[supportsPromises] static void forceAutoThemeMode(boolean darkModeEnabled, VoidCallback callback);
@@ -1553,6 +1568,19 @@ namespace autotestPrivate {
// Ends frame counting in viz and return the collected data.
[supportsPromises] static void stopFrameCounting(
StopFrameCountingCallback callback);
+
+ // Install a bruschetta VM.
+ [supportsPromises] static void installBruschetta(
+ DOMString vm_name, VoidCallback callback);
+
+ // Delete a bruschetta VM.
+ [supportsPromises] static void removeBruschetta(
+ DOMString vm_name, VoidCallback callback);
+
+ // Returns whether a base::Feature is enabled. The state may change because
+ // a Chrome uprev into ChromeOS changed the default feature state.
+ [supportsPromises] static void isFeatureEnabled(
+ DOMString feature_name, IsFeatureEnabledCallback callback);
};
interface Events {
diff --git a/idl/chrome/braille_display_private.idl b/idl/chrome/braille_display_private.idl
index 44901b6..171c33d 100644
--- a/idl/chrome/braille_display_private.idl
+++ b/idl/chrome/braille_display_private.idl
@@ -3,6 +3,7 @@
// found in the LICENSE file.
// Braille display access private API.
+[modernised_enums]
namespace brailleDisplayPrivate {
// Braille display keyboard command.
enum KeyCommand {
@@ -64,7 +65,9 @@ namespace brailleDisplayPrivate {
interface Functions {
// Gets the current display state.
- static void getDisplayState(DisplayStateCallback callback);
+ [supportsPromises] static void getDisplayState(
+ DisplayStateCallback callback);
+
// Write the given dot patterns to the display. The buffer contains one
// byte for each braille cell on the display, starting from the leftmost
// cell. Each byte contains a bit pattern indicating which dots should be
diff --git a/idl/chrome/browser_action.json b/idl/chrome/browser_action.json
index a1b5683..7181559 100644
--- a/idl/chrome/browser_action.json
+++ b/idl/chrome/browser_action.json
@@ -117,14 +117,13 @@
"description": "Limits the change to when a particular tab is selected. Automatically resets when the tab is closed."
}
}
- },
- {
- "type": "function",
- "name": "callback",
- "optional": true,
- "parameters": []
}
- ]
+ ],
+ "returns_async": {
+ "name": "callback",
+ "optional": true,
+ "parameters": []
+ }
},
{
"name": "setPopup",
@@ -295,21 +294,19 @@
"type": "function",
"description": "Opens the extension popup window in the active window but does not grant tab permissions.",
"nodoc": true,
- "parameters": [
- {
- "type": "function",
- "name": "callback",
- "parameters": [
- {
- "name": "popupView",
- "type": "object",
- "optional": true,
- "description": "JavaScript 'window' object for the popup window if it was succesfully opened.",
- "additionalProperties": { "type": "any" }
- }
- ]
- }
- ]
+ "parameters": [],
+ "returns_async": {
+ "name": "callback",
+ "parameters": [
+ {
+ "name": "popupView",
+ "type": "object",
+ "optional": true,
+ "description": "JavaScript 'window' object for the popup window if it was succesfully opened.",
+ "additionalProperties": { "type": "any" }
+ }
+ ]
+ }
}
],
"events": [
diff --git a/idl/chrome/content_settings.json b/idl/chrome/content_settings.json
index a4d6392..d0a438e 100644
--- a/idl/chrome/content_settings.json
+++ b/idl/chrome/content_settings.json
@@ -7,7 +7,10 @@
{
"namespace": "contentSettings",
"description": "Use the chrome.contentSettings API to change settings that control whether websites can use features such as cookies, JavaScript, and plugins. More generally speaking, content settings allow you to customize Chrome's behavior on a per-site basis instead of globally.",
- "compiler_options": { "generate_type_functions": true },
+ "compiler_options": {
+ "generate_type_functions": true,
+ "modernised_enums": true
+ },
"types": [
{
"id": "ResourceIdentifier",
diff --git a/idl/chrome/cookies.json b/idl/chrome/cookies.json
index 47987db..44302c2 100644
--- a/idl/chrome/cookies.json
+++ b/idl/chrome/cookies.json
@@ -6,6 +6,9 @@
{
"namespace": "cookies",
"description": "Use the chrome.cookies API to query and modify cookies, and to be notified when they change.",
+ "compiler_options": {
+ "modernised_enums": true
+ },
"types": [
{
"id": "SameSiteStatus",
diff --git a/idl/chrome/dashboard_private.json b/idl/chrome/dashboard_private.json
index ad2de44..9b75b92 100644
--- a/idl/chrome/dashboard_private.json
+++ b/idl/chrome/dashboard_private.json
@@ -6,6 +6,9 @@
{
"namespace":"dashboardPrivate",
"description": "none",
+ "compiler_options": {
+ "modernised_enums": true
+ },
"types": [
{
"id": "Result",
@@ -70,21 +73,20 @@
"description": "A string to use instead of the raw value of the 'name' key from manifest.json."
}
}
- },
- {
- "name": "callback",
- "type": "function",
- "description": "Called when the user has either accepted/rejected the dialog, or some error occurred (such as invalid manifest or icon image data).",
- "optional": true,
- "parameters": [
- {
- "name": "result",
- "$ref": "Result",
- "description": "A string result code, which will be empty upon success. The possible values in the case of errors include 'unknown_error', 'user_cancelled', 'manifest_error', 'icon_error', 'invalid_id', and 'invalid_icon_url'."
- }
- ]
}
- ]
+ ],
+ "returns_async": {
+ "name": "callback",
+ "description": "Called when the user has either accepted/rejected the dialog, or some error occurred (such as invalid manifest or icon image data).",
+ "optional": true,
+ "parameters": [
+ {
+ "name": "result",
+ "$ref": "Result",
+ "description": "A string result code, which will be empty upon success. The possible values in the case of errors include 'unknown_error', 'user_cancelled', 'manifest_error', 'icon_error', 'invalid_id', and 'invalid_icon_url'."
+ }
+ ]
+ }
}
]
}
diff --git a/idl/chrome/debugger.json b/idl/chrome/debugger.json
index 70cb05a..7b99b9f 100644
--- a/idl/chrome/debugger.json
+++ b/idl/chrome/debugger.json
@@ -6,6 +6,9 @@
{
"namespace": "debugger",
"description": "The chrome.debugger API serves as an alternate transport for Chrome's remote debugging protocol. Use chrome.debugger to attach to one or more tabs to instrument network interaction, debug JavaScript, mutate the DOM and CSS, etc. Use the Debuggee tabId to target tabs with sendCommand and route events by tabId from onEvent callbacks.",
+ "compiler_options": {
+ "modernised_enums": true
+ },
"types": [
{
"id": "Debuggee",
diff --git a/idl/chrome/developer_private.idl b/idl/chrome/developer_private.idl
index 467ecf2..190a47c 100644
--- a/idl/chrome/developer_private.idl
+++ b/idl/chrome/developer_private.idl
@@ -140,6 +140,7 @@ namespace developerPrivate {
boolean suspiciousInstall;
boolean corruptInstall;
boolean updateRequired;
+ boolean publishedInStoreRequired;
boolean blockedByPolicy;
boolean reloading;
boolean custodianApprovalRequired;
@@ -172,6 +173,11 @@ namespace developerPrivate {
ON_ALL_SITES
};
+ dictionary SafetyCheckStrings {
+ DOMString? panelString;
+ DOMString? detailString;
+ };
+
dictionary ControlledInfo {
DOMString text;
};
@@ -223,6 +229,7 @@ namespace developerPrivate {
dictionary ExtensionInfo {
DOMString? blacklistText;
+ SafetyCheckStrings? safetyCheckText;
Command[] commands;
ControlledInfo? controlledInfo;
DependentExtension[] dependentExtensions;
@@ -317,6 +324,7 @@ namespace developerPrivate {
boolean? errorCollection;
HostAccess? hostAccess;
boolean? showAccessRequestsInToolbar;
+ boolean? acknowledgeSafetyCheckWarning;
};
dictionary ProfileConfigurationUpdate {
@@ -653,15 +661,6 @@ namespace developerPrivate {
[supportsPromises] static void getExtensionSize(DOMString id,
StringCallback callback);
- // Returns information of all the extensions and apps installed.
- // |includeDisabled| : include disabled items.
- // |includeTerminated| : include terminated items.
- // |callback| : Called with items info.
- [deprecated="Use getExtensionsInfo"] static void getItemsInfo(
- boolean includeDisabled,
- boolean includeTerminated,
- ItemsInfoCallback callback);
-
// Returns the current profile's configuration.
[supportsPromises] static void getProfileConfiguration(
ProfileInfoCallback callback);
@@ -673,12 +672,6 @@ namespace developerPrivate {
ProfileConfigurationUpdate update,
optional VoidCallback callback);
- // Opens a permissions dialog.
- // |extensionId| : The id of the extension to show permissions for.
- [supportsPromises] static void showPermissionsDialog(
- DOMString extensionId,
- optional VoidCallback callback);
-
// Reloads a given extension.
// |extensionId| : The id of the extension to reload.
// |options| : Additional configuration parameters.
@@ -837,18 +830,6 @@ namespace developerPrivate {
ExtensionSiteAccessUpdate[] updates,
optional VoidCallback callback);
- [nocompile, deprecated="Use management.setEnabled"]
- static void enable(DOMString id,
- boolean enabled,
- optional VoidCallback callback);
- [nocompile, deprecated="Use updateExtensionConfiguration"]
- static void allowIncognito(DOMString extensionId,
- boolean allow,
- optional VoidCallback callback);
- [nocompile, deprecated="Use updateExtensionConfiguration"]
- static void allowFileAccess(DOMString extensionId,
- boolean allow,
- optional VoidCallback callback);
[nocompile, deprecated="Use openDevTools"]
static void inspect(InspectOptions options,
optional VoidCallback callback);
diff --git a/idl/chrome/downloads.idl b/idl/chrome/downloads.idl
index 31a257f..de492fb 100644
--- a/idl/chrome/downloads.idl
+++ b/idl/chrome/downloads.idl
@@ -137,6 +137,7 @@ namespace downloads {
sensitiveContentWarning,
sensitiveContentBlock,
unsupportedFileType,
+ deepScannedFailed,
deepScannedSafe,
deepScannedOpenedDangerous,
promptForScaning,
diff --git a/idl/chrome/file_manager_private.idl b/idl/chrome/file_manager_private.idl
index aa869e4..232ae8b 100644
--- a/idl/chrome/file_manager_private.idl
+++ b/idl/chrome/file_manager_private.idl
@@ -253,7 +253,9 @@ enum EntryPropertyName {
isExternalMedia,
isArbitrarySyncFolder,
syncStatus,
- progress
+ progress,
+ shortcut,
+ syncCompletedTime
};
// Source of the volume data.
@@ -325,6 +327,17 @@ enum IOTaskType {
zip
};
+enum PolicyErrorType {
+ dlp,
+ enterprise_connectors,
+ dlp_warning_timeout
+};
+
+enum PolicyDialogType {
+ warning,
+ error
+};
+
enum RecentDateBucket {
today,
yesterday,
@@ -375,13 +388,15 @@ enum PolicyDefaultHandlerStatus {
};
// Describes the stage the bulk pinning manager is in. This enum should be kept
-// in sync with chromeos/ash/components/drivefs/drivefs_pin_manager.h
+// in sync with chromeos/ash/components/drivefs/mojom/pin_manager_types.mojom.
enum BulkPinStage {
// Initial stage.
stopped,
// Paused because of unfavorable network conditions.
- paused,
+ paused_offline,
+ // Paused due to battery saver mode active.
+ paused_battery_saver,
// In-progress stages.
getting_free_space,
@@ -549,6 +564,13 @@ dictionary EntryProperties {
// E.g., pasting, syncing. Note: currently, this is exclusively being used
// for Drive syncing.
double? progress;
+
+ // Time in milliseconds since the epoch when the file last received a
+ // "completed" sync status.
+ double? syncCompletedTime;
+
+ // True if the entry is a shortcut.
+ boolean? shortcut;
};
// Information about total and remaining size on the mount point.
@@ -846,7 +868,7 @@ dictionary SearchMetadataParams {
// Modified timestamp. The file must have modified timestamp more recent
// than this to be included in results.
- double? timestamp;
+ double? modifiedTimestamp;
// The category of files to which the search is limited.
FileCategory? category;
@@ -1052,8 +1074,8 @@ dictionary IOTaskParams {
boolean? showNotification;
};
-// IO task state::PAUSED parameters, see file_manager::io_task::PauseParams.
-dictionary PauseParams {
+// IO task state::PAUSED name conflict parameters, see file_manager::io_task::ConflictPauseParams.
+dictionary ConflictPauseParams {
// The conflict file name.
DOMString? conflictName;
@@ -1067,8 +1089,21 @@ dictionary PauseParams {
DOMString? conflictTargetUrl;
};
-// Resume IO Task parameters, see file_manager::io_task::ResumeParams.
-dictionary ResumeParams {
+// IO task state::PAUSED policy parameters, see file_manager::io_task::PolicyPauseParams.
+dictionary PolicyPauseParams {
+ PolicyErrorType type;
+};
+
+// IO task state::PAUSED parameters, see file_manager::io_task::PauseParams.
+dictionary PauseParams {
+ // Set iff pausing due to name conflict.
+ ConflictPauseParams? conflictParams;
+ // Set iff pausing due to policy.
+ PolicyPauseParams? policyParams;
+};
+
+// Resume IO Task parameters, see file_manager::io_task::ConflictResumeParams.
+dictionary ConflictResumeParams {
// How to resolve a CopyOrMoveIOTask file name conflict: either 'keepboth'
// or 'replace'.
DOMString? conflictResolve;
@@ -1077,6 +1112,19 @@ dictionary ResumeParams {
boolean? conflictApplyToAll;
};
+// Resume IO Task parameters, see file_manager::io_task::PolicyResumeParams.
+dictionary PolicyResumeParams {
+ PolicyErrorType type;
+};
+
+// Resume IO Task parameters, see file_manager::io_task::ResumeParams.
+dictionary ResumeParams {
+ // Set iff paused due to name conflict.
+ ConflictResumeParams? conflictParams;
+ // Set iff paused due to policy.
+ PolicyResumeParams? policyParams;
+};
+
// IO Task Progress status, see file_manager::io_task::ProgressStatus.
dictionary ProgressStatus {
@@ -1086,6 +1134,10 @@ dictionary ProgressStatus {
// Current state of the task sending the progress.
IOTaskState state;
+ // Type of policy error that occurred, if any.
+ // Used only if Data Leak Prevention or Enterprise Connectors policies apply.
+ PolicyErrorType? policyError;
+
// Name of the first source entry.
DOMString sourceName;
@@ -1111,6 +1163,14 @@ dictionary ProgressStatus {
// The estimate time to finish the operation.
double remainingSeconds;
+ // Number of sources scanned. Only used when in SCANNING state.
+ // When scanning files, the progress is roughly the percentage of the
+ // number of scanned items out of the total items. This isn't always
+ // accurate, e.g. when uploading entire folders or because some items
+ // are not scanned at all. The goal is to show the user that some
+ // progress is happening.
+ long sourcesScanned;
+
// Whether notifications should be shown on progress status.
boolean showNotification;
@@ -1207,6 +1267,9 @@ dictionary BulkPinProgress {
// Total number of files to pin.
long filesToPin;
+
+ // Estimated time remaining to pin all the `bytesToPin`.
+ double remainingSeconds;
};
// Callback that does not take arguments.
@@ -1303,27 +1366,11 @@ callback SearchFilesCallback = void([instanceOf=Entry] object[] entries);
// contain at most one path per hash.
callback SearchFilesByHashesCallback = void(object paths);
-// |zipId| The ID of the ZIP operation.
-// |totalBytes| Total number of bytes to be zipped.
-callback ZipSelectionCallback = void(long zipId, double totalBytes);
-
-// |result| Less than 0 if the operation is still in progress, 0 if the
-// operation finished successfully, or greater than 0 if the operation finished
-// with an error.
-// |bytes| Total number of bytes having been zipped so far.
-callback ZipProgressCallback = void(long result, double bytes);
-
callback GetDriveConnectionStateCallback = void(DriveConnectionState result);
// |result| true if the length is in the valid range, false otherwise.
callback ValidatePathNameLengthCallback = void(boolean result);
-// |accessToken| OAuth2 access token, or an empty string if failed to fetch.
-callback RequestWebStoreAccessTokenCallback = void(DOMString accessToken);
-
-// |url| Result url.
-callback GetUrlCallback = void(DOMString url);
-
// |profiles| List of profile information.
// |runningProfile| ID of the profile that runs the application instance.
// |showingProfile| ID of the profile that shows the application window.
@@ -1653,31 +1700,6 @@ interface Functions {
static void searchFiles(SearchMetadataParams searchParams,
SearchFilesCallback callback);
- // Creates a ZIP file for the selected files and folders. Folders are
- // recursively explored and zipped. Hidden files and folders (with names
- // starting with a dot) found during recursive exploration are included too.
- // |entries| Entries of the selected files and folders to zip. They must be
- // under the |parentEntry| directory.
- // |parentEntry| Entry of the directory containing the selected files and
- // folders. This is where the ZIP file will be created, too.
- // |destName| Name of the destination ZIP file. The ZIP file will be created
- // in the directory specified by |parentEntry|.
- // |callback| Callback called on completion.
- [nocompile]
- static void zipSelection([instanceOf=Entry] object[] entries,
- [instanceOf=DirectoryEntry] object parentEntry,
- DOMString destName,
- ZipSelectionCallback callback);
-
- // Cancels an ongoing ZIP operation.
- // Does nothing if there is no matching ongoing ZIP operation.
- // |zipId| ID of the ZIP operation.
- static void cancelZip(long zipId);
-
- // Gets the progress of an ongoing ZIP operation.
- // |zipId| ID of the ZIP operation.
- static void getZipProgress(long zipId, ZipProgressCallback callback);
-
// Retrieves the state of the current drive connection.
// |callback|
static void getDriveConnectionState(GetDriveConnectionStateCallback callback);
@@ -1696,18 +1718,6 @@ interface Functions {
// |operation| Zooming mode.
static void zoom(ZoomOperationType operation);
- // Requests a Webstore API OAuth2 access token.
- // |callback|
- static void requestWebStoreAccessToken(
- RequestWebStoreAccessTokenCallback callback);
-
- // Requests a download url to download the file contents.
- // |entry| The entry to download.
- // |callback|
- [nocompile]
- static void getDownloadUrl([instanceOf=Entry] object entry,
- GetUrlCallback callback);
-
// Obtains a list of profiles that are logged-in.
static void getProfiles(GetProfilesCallback callback);
@@ -1925,6 +1935,10 @@ interface Functions {
// each I/O task's progress status.
static void resumeIOTask(long taskId, ResumeParams params);
+ // Shows a policy dialog for a task. Task ids are communicated to the Files
+ // App in each I/O task's progress status.
+ static void showPolicyDialog(long taskId, PolicyDialogType type);
+
// Makes I/O tasks in state::PAUSED emit (broadcast) their current I/O task
// progress status.
static void progressPausedTasks();
@@ -1949,6 +1963,10 @@ interface Functions {
// Returns the current progress of the bulk pinning manager.
static void getBulkPinProgress(GetBulkPinProgressCallback callback);
+
+ // Starts calculating the space required to pin all the items in a users My
+ // drive.
+ static void calculateBulkPinRequiredSpace(SimpleCallback callback);
};
// Events supported by fileManagerPrivate API. These events are broadcasted.
diff --git a/idl/chrome/file_manager_private_internal.idl b/idl/chrome/file_manager_private_internal.idl
index a47a9d0..939303b 100644
--- a/idl/chrome/file_manager_private_internal.idl
+++ b/idl/chrome/file_manager_private_internal.idl
@@ -28,7 +28,7 @@ namespace fileManagerPrivateInternal {
DOMString query;
fileManagerPrivate.SearchType types;
long maxResults;
- double timestamp;
+ double modifiedTimestamp;
fileManagerPrivate.FileCategory category;
};
@@ -46,8 +46,6 @@ namespace fileManagerPrivateInternal {
fileManagerPrivate.MediaMetadata result);
callback ExecuteTaskCallback = void(fileManagerPrivate.TaskResult result);
callback GetFileTasksCallback = void(fileManagerPrivate.ResultingTasks resultingTasks);
- callback GetUrlCallback = void(DOMString url);
- callback GetUrlCallback = void(DOMString url);
callback GetDisallowedTransfersCallback =
void(EntryDescription[] entries);
callback GetDlpMetadataCallback =
@@ -55,7 +53,6 @@ namespace fileManagerPrivateInternal {
callback GetDriveQuotaMetadataCallback =
void(optional fileManagerPrivate.DriveQuotaMetadata driveQuotaMetadata);
callback IOTaskIdCallback = void(long taskId);
- callback ZipSelectionCallback = void(long zipId, double totalBytes);
callback ValidatePathNameLengthCallback = void(boolean result);
callback GetDirectorySizeCallback = void(double size);
callback GetRecentFilesCallback = void(EntryDescription[] entries);
@@ -113,7 +110,6 @@ namespace fileManagerPrivateInternal {
static void getFileTasks(DOMString[] urls,
DOMString[] dlpSourceUrls,
GetFileTasksCallback callback);
- static void getDownloadUrl(DOMString url, GetUrlCallback callback);
static void getDisallowedTransfers(DOMString[] entries,
DOMString destinationEntry,
boolean isMove,
@@ -122,10 +118,6 @@ namespace fileManagerPrivateInternal {
GetDlpMetadataCallback callback);
static void getDriveQuotaMetadata(DOMString url,
GetDriveQuotaMetadataCallback callback);
- static void zipSelection(DOMString parentUrl,
- DOMString[] urls,
- DOMString destName,
- ZipSelectionCallback callback);
static void validatePathNameLength(
DOMString parentUrl,
DOMString name,
diff --git a/idl/chrome/gcm.json b/idl/chrome/gcm.json
index cb023c0..a42dc58 100644
--- a/idl/chrome/gcm.json
+++ b/idl/chrome/gcm.json
@@ -28,33 +28,30 @@
"minItems": 1,
"maxItems": 100,
"description": "A list of server IDs that are allowed to send messages to the application. It should contain at least one and no more than 100 sender IDs."
- },
- {
- "name": "callback",
- "type": "function",
- "description": "Function called when registration completes. It should check $(ref:runtime.lastError) for error when registrationId is empty.",
- "parameters": [
- {
- "name": "registrationId",
- "type": "string",
- "description": "A registration ID assigned to the application by the FCM."
- }
- ]
}
- ]
+ ],
+ "returns_async": {
+ "name": "callback",
+ "description": "Function called when registration completes. It should check $(ref:runtime.lastError) for error when registrationId is empty.",
+ "parameters": [
+ {
+ "name": "registrationId",
+ "type": "string",
+ "description": "A registration ID assigned to the application by the FCM."
+ }
+ ]
+ }
},
{
"name": "unregister",
"type": "function",
"description": "Unregisters the application from FCM.",
- "parameters": [
- {
- "name": "callback",
- "type": "function",
- "description": "A function called after the unregistration completes. Unregistration was successful if $(ref:runtime.lastError) is not set.",
- "parameters": []
- }
- ]
+ "parameters": [],
+ "returns_async": {
+ "name": "callback",
+ "description": "A function called after the unregistration completes. Unregistration was successful if $(ref:runtime.lastError) is not set.",
+ "parameters": []
+ }
},
{
"name": "send",
@@ -93,20 +90,19 @@
"description": "Message data to send to the server. Case-insensitive goog. and google, as well as case-sensitive collapse_key are disallowed as key prefixes. Sum of all key/value pairs should not exceed $(ref:gcm.MAX_MESSAGE_SIZE)."
}
}
- },
- {
- "name": "callback",
- "type": "function",
- "description": "A function called after the message is successfully queued for sending. $(ref:runtime.lastError) should be checked, to ensure a message was sent without problems.",
- "parameters": [
- {
- "name": "messageId",
- "type": "string",
- "description": "The ID of the message that the callback was issued for."
- }
- ]
}
- ]
+ ],
+ "returns_async": {
+ "name": "callback",
+ "description": "A function called after the message is successfully queued for sending. $(ref:runtime.lastError) should be checked, to ensure a message was sent without problems.",
+ "parameters": [
+ {
+ "name": "messageId",
+ "type": "string",
+ "description": "The ID of the message that the callback was issued for."
+ }
+ ]
+ }
}
],
"events": [
diff --git a/idl/chrome/history.json b/idl/chrome/history.json
index 0895fae..4898aa7 100644
--- a/idl/chrome/history.json
+++ b/idl/chrome/history.json
@@ -31,14 +31,15 @@
"type": "object",
"description": "An object encapsulating one visit to a URL.",
"properties": {
- "id": {"type": "string", "minimum": 0, "description": "The unique identifier for the item."},
+ "id": {"type": "string", "minimum": 0, "description": "The unique identifier for the corresponding $(ref:history.HistoryItem)."},
"visitId": {"type": "string", "description": "The unique identifier for this visit."},
"visitTime": {"type": "number", "optional": true, "description": "When this visit occurred, represented in milliseconds since the epoch."},
"referringVisitId": {"type": "string", "description": "The visit ID of the referrer."},
"transition": {
"$ref": "TransitionType",
"description": "The transition type for this visit from its referrer."
- }
+ },
+ "isLocal": { "type": "boolean", "description": "True if the visit originated on this device. False if it was synced from a different device." }
}
},
{
diff --git a/idl/chrome/image_writer_private.idl b/idl/chrome/image_writer_private.idl
index d90ea6d..e491487 100644
--- a/idl/chrome/image_writer_private.idl
+++ b/idl/chrome/image_writer_private.idl
@@ -79,10 +79,11 @@ namespace imageWriterPrivate {
// temporary directory is desired
// |callback|: The callback which signifies that the write operation has
// been started by the system and provides a unique ID for this operation.
- static void writeFromUrl(DOMString storageUnitId,
- DOMString imageUrl,
- optional UrlWriteOptions options,
- WriteImageCallback callback);
+ [supportsPromises] static void writeFromUrl(
+ DOMString storageUnitId,
+ DOMString imageUrl,
+ optional UrlWriteOptions options,
+ WriteImageCallback callback);
// Write an image to the disk, prompting the user to supply the image from
// a local file. The callback will be called when the entire operation
@@ -92,16 +93,17 @@ namespace imageWriterPrivate {
// |fileEntry|: The FileEntry object of the image to be burned.
// |callback|: The callback which signifies that the write operation has
// been started by the system and provides a unique ID for this operation.
- static void writeFromFile(DOMString storageUnitId,
- [instanceOf=FileEntry] object fileEntry,
- WriteImageCallback callback);
+ [supportsPromises] static void writeFromFile(
+ DOMString storageUnitId,
+ [instanceOf=FileEntry] object fileEntry,
+ WriteImageCallback callback);
// Cancel a current write operation.
//
// |callback|: The callback which is triggered with the write is
// successfully cancelled, passing the $(ref:ProgressInfo) of the operation at
// the time it was cancelled.
- static void cancelWrite(WriteCancelCallback callback);
+ [supportsPromises] static void cancelWrite(WriteCancelCallback callback);
// Destroys the partition table of a disk, effectively erasing it. This is
// a fairly quick operation and so it does not have complex stages or
@@ -110,12 +112,13 @@ namespace imageWriterPrivate {
// |storageUnitId|: The identifier of the storage unit to wipe
// |callback|: A callback that triggers when the operation has been
// successfully started.
- static void destroyPartitions(DOMString storageUnitId,
- DestroyPartitionsCallback callback);
+ [supportsPromises] static void destroyPartitions(
+ DOMString storageUnitId,
+ DestroyPartitionsCallback callback);
// List all the removable block devices currently attached to the system.
// |callback|: A callback called with a list of removable storage devices
- static void listRemovableStorageDevices(
+ [supportsPromises] static void listRemovableStorageDevices(
ListRemovableStorageDevicesCallback callback);
};
diff --git a/idl/chrome/input_method_private.json b/idl/chrome/input_method_private.json
index 5f5e7af..ae67a46 100644
--- a/idl/chrome/input_method_private.json
+++ b/idl/chrome/input_method_private.json
@@ -77,7 +77,6 @@
"spellCheck": {"type": "boolean", "description": "Whether the text field wants spell-check."},
"shouldDoLearning": {"type": "boolean", "description": "Whether text entered into the text field should be used to improve typing suggestions for the user."},
"focusReason": {"$ref": "FocusReason", "description": "How the text field was focused"},
- "hasBeenPassword": {"type": "boolean", "description": "DEPRECATED: when this was true, we now just set input field type to be password. Was: Whether the text field has ever been a password field."},
"appKey": {"type": "string", "optional": true, "description": "Key of the app associated with this text field if any."}
}
},
@@ -91,6 +90,7 @@
"enableGestureTyping": { "type": "boolean", "optional": true, "description": "Whether to enable gesture typing."},
"enablePrediction": { "type": "boolean", "optional": true, "description": "Whether to enable word prediction."},
"enableSoundOnKeypress": { "type": "boolean", "optional": true, "description": "Whether to enable sound on keypress."},
+ "physicalKeyboardAutoCorrectionEnabledByDefault": {"type": "boolean", "optional": true, "description": "Whether auto correction should be enabled for physical keyboard by default."},
"physicalKeyboardAutoCorrectionLevel": { "type": "integer", "optional": true, "description": "The level of auto correction for physical keyboard (0: Off, 1: Modest, 2: Aggressive)."},
"physicalKeyboardEnableCapitalization": { "type": "boolean", "optional": true, "description": "Whether to enable auto capitalization for physical keyboard."},
"physicalKeyboardEnableDiacriticsOnLongpress": { "type": "boolean", "optional": true, "description": "Whether to enable diacritics on longpress for physical keyboard."},
diff --git a/idl/chrome/notifications.idl b/idl/chrome/notifications.idl
index 783a1cc..2d30def 100644
--- a/idl/chrome/notifications.idl
+++ b/idl/chrome/notifications.idl
@@ -151,9 +151,9 @@ namespace notifications {
// that represents the created notification.
//
// The callback is required before Chrome 42.
- static void create(optional DOMString notificationId,
- NotificationOptions options,
- optional CreateCallback callback);
+ [supportsPromises] static void create(optional DOMString notificationId,
+ NotificationOptions options,
+ optional CreateCallback callback);
// Updates an existing notification.
// |notificationId|: The id of the notification to be updated. This is
@@ -162,9 +162,9 @@ namespace notifications {
// |callback|: Called to indicate whether a matching notification existed.
//
// The callback is required before Chrome 42.
- static void update(DOMString notificationId,
- NotificationOptions options,
- optional UpdateCallback callback);
+ [supportsPromises] static void update(DOMString notificationId,
+ NotificationOptions options,
+ optional UpdateCallback callback);
// Clears the specified notification.
// |notificationId|: The id of the notification to be cleared. This is
@@ -172,17 +172,18 @@ namespace notifications {
// |callback|: Called to indicate whether a matching notification existed.
//
// The callback is required before Chrome 42.
- static void clear(DOMString notificationId,
- optional ClearCallback callback);
+ [supportsPromises] static void clear(DOMString notificationId,
+ optional ClearCallback callback);
// Retrieves all the notifications of this app or extension.
// |callback|: Returns the set of notification_ids currently in the system.
- static void getAll(GetAllCallback callback);
+ [supportsPromises] static void getAll(GetAllCallback callback);
// Retrieves whether the user has enabled notifications from this app
// or extension.
// |callback|: Returns the current permission level.
- static void getPermissionLevel(PermissionLevelCallback callback);
+ [supportsPromises] static void getPermissionLevel(
+ PermissionLevelCallback callback);
};
interface Events {
diff --git a/idl/chrome/page_capture.json b/idl/chrome/page_capture.json
index d032d8b..acba97c 100644
--- a/idl/chrome/page_capture.json
+++ b/idl/chrome/page_capture.json
@@ -22,21 +22,20 @@
"description": "The id of the tab to save as MHTML."
}
}
- },
- {
- "name": "callback",
- "type": "function",
- "description": "Called when the MHTML has been generated.",
- "parameters": [
- {
- "name": "mhtmlData",
- "type": "binary",
- "optional": true,
- "description": "The MHTML data as a Blob."
- }
- ]
}
- ]
+ ],
+ "returns_async": {
+ "name": "callback",
+ "description": "Called when the MHTML has been generated.",
+ "parameters": [
+ {
+ "name": "mhtmlData",
+ "type": "binary",
+ "optional": true,
+ "description": "The MHTML data as a Blob."
+ }
+ ]
+ }
}
]
}
diff --git a/idl/chrome/passwords_private.idl b/idl/chrome/passwords_private.idl
index e733130..03eb500 100644
--- a/idl/chrome/passwords_private.idl
+++ b/idl/chrome/passwords_private.idl
@@ -198,6 +198,9 @@ namespace passwordsPrivate {
// The username used in conjunction with the saved password.
DOMString username;
+ // If this is a passkey, the user's display name. Empty otherwise.
+ DOMString? displayName;
+
// The password of the credential. Empty by default, only set if explicitly
// requested.
DOMString? password;
@@ -214,6 +217,9 @@ namespace passwordsPrivate {
// Indicates whether this credential belongs to an Android app.
boolean isAndroidCredential;
+ // Indicates whether this credential is a passkey.
+ boolean isPasskey;
+
// The value of the attached note.
DOMString? note;
@@ -341,17 +347,26 @@ namespace passwordsPrivate {
// |id|: The id for the password entry being updated.
// |params|: The dictionary which holds the changed parameters.
// |callback|: The callback that gets invoked in the end.
+ // TODO(crbug.com/1420597): clean up after old password manager is removed.
[supportsPromises] static void changeSavedPassword(
long id,
ChangeSavedPasswordParams params,
optional ChangeSavedPasswordCallback callback);
- // Removes the saved password corresponding to |id| in |fromStores|. If no
- // saved password for this pair exists, this function is a no-op.
- // |id|: The id for the password entry being removed.
- // |fromStores|: The store(s) from which the password entry is being
- // removed.
- static void removeSavedPassword(long id, PasswordStoreSet fromStores);
+ // Changes the credential. Not all attributes can be updated.
+ // Optional attributes that are not set will be unchanged.
+ // Returns a promise that resolves if successful, and rejects otherwise.
+ // |credential|: The credential to update. This will be matched to the
+ // existing credential by id.
+ [supportsPromises] static void changeCredential(
+ PasswordUiEntry credential,
+ optional VoidCallback callback);
+
+ // Removes the credential corresponding to |id| in |fromStores|. If no
+ // credential for this pair exists, this function is a no-op.
+ // |id|: The id for the credential being removed.
+ // |fromStores|: The store(s) from which the credential is being removed.
+ static void removeCredential(long id, PasswordStoreSet fromStores);
// Removes the saved password exception corresponding to |id|. If
// no exception with this id exists, this function is a no-op. This will
diff --git a/idl/chrome/printing.idl b/idl/chrome/printing.idl
index 40673f8..4aeca11 100644
--- a/idl/chrome/printing.idl
+++ b/idl/chrome/printing.idl
@@ -110,6 +110,9 @@ namespace printing {
// The printer is unreachable and doesn't accept print jobs.
UNREACHABLE,
+ // The SSL certificate is expired. Printer accepts jobs but they fail.
+ EXPIRED_CERTIFICATE,
+
// The printer is available.
AVAILABLE
};
diff --git a/idl/chrome/safe_browsing_private.idl b/idl/chrome/safe_browsing_private.idl
index 3cc6cc2..414c83a 100644
--- a/idl/chrome/safe_browsing_private.idl
+++ b/idl/chrome/safe_browsing_private.idl
@@ -36,7 +36,12 @@ namespace safeBrowsingPrivate {
// Renderer initiated navigations involve interactions with the content
// area, such as link clicks or JS.
RENDERER_INITIATED_WITHOUT_USER_GESTURE,
- RENDERER_INITIATED_WITH_USER_GESTURE
+ RENDERER_INITIATED_WITH_USER_GESTURE,
+
+ // Navigation is initiated by the browser process and it is believed the
+ // navigation is the result of the user copy and paste the address from the
+ // browser into the address bar.
+ COPY_PASTE_USER_INITIATED
};
dictionary PolicySpecifiedPasswordReuse {
diff --git a/idl/chrome/side_panel.idl b/idl/chrome/side_panel.idl
index 04cbb87..57e6f15 100644
--- a/idl/chrome/side_panel.idl
+++ b/idl/chrome/side_panel.idl
@@ -2,7 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// chrome.sidePanel API
+// Use the `chrome.sidePanel` API to host content in the browser's side panel
+// alongside the main content of a webpage.
namespace sidePanel {
dictionary SidePanel {
// Developer specified path for side panel display.
@@ -45,6 +46,26 @@ namespace sidePanel {
long? tabId;
};
+ // Options for opening the side panel.
+ // At least one of `tabId` and `windowId` must be specified.
+ dictionary OpenOptions {
+ // The window in which to open the side panel. This is only applicable if
+ // the extension has a global (non-tab-specific) side panel or
+ // tabId is also specified. This will override any
+ // currently-active global side panel the user has open in the given
+ // window. At least one of this and tabId must be provided.
+ long? windowId;
+
+ // The tab in which to open the side panel. If the corresponding tab has
+ // a tab-specific side panel, the panel will only be open for that tab.
+ // If there is not a tab-specific panel, the global panel will be open in
+ // the specified tab and any other tabs without a currently-open tab-
+ // specific panel. This will override any currently-active side panel
+ // (global or tab-specific) in the corresponding tab. At least one of this
+ // and windowId must be provided.
+ long? tabId;
+ };
+
callback VoidCallback = void();
callback PanelOptionsCallback = void(PanelOptions options);
callback PanelBehaviorCallback = void(PanelBehavior behavior);
@@ -66,13 +87,20 @@ namespace sidePanel {
// operation.
// |behavior|: The new behavior to be set.
// |callback|: Called when the new behavior has been set.
- [nodoc, supportsPromises] static void setPanelBehavior(
+ [supportsPromises] static void setPanelBehavior(
PanelBehavior behavior,
optional VoidCallback callback);
// Returns the extension's current side panel behavior.
// |callback|: Called with the extension's side panel behavior.
- [nodoc, supportsPromises] static void getPanelBehavior(
+ [supportsPromises] static void getPanelBehavior(
PanelBehaviorCallback callback);
+
+ // Opens the side panel for the extension.
+ // This may only be called in response to a user action.
+ // |options|: Specifies the context in which to open the side panel.
+ // |callback|: Called when the side panel has been opened.
+ [supportsPromises] static void open(OpenOptions options,
+ VoidCallback callback);
};
};
\ No newline at end of file
diff --git a/idl/chrome/smart_card_provider_private.idl b/idl/chrome/smart_card_provider_private.idl
index 3d92dbb..c82e969 100644
--- a/idl/chrome/smart_card_provider_private.idl
+++ b/idl/chrome/smart_card_provider_private.idl
@@ -72,6 +72,21 @@ namespace smartCardProviderPrivate {
EJECT_CARD
};
+ enum ConnectionState {
+ // SCARD_ABSENT
+ ABSENT,
+ // SCARD_PRESENT
+ PRESENT,
+ // SCARD_SWALLOWED
+ SWALLOWED,
+ // SCARD_POWERED
+ POWERED,
+ // SCARD_NEGOTIABLE
+ NEGOTIABLE,
+ // SCARD_SPECIFIC
+ SPECIFIC
+ };
+
// Maps to the SCARD_STATE_* flags defined in the winscard.h API.
dictionary ReaderStateFlags {
boolean? unaware;
@@ -146,7 +161,7 @@ namespace smartCardProviderPrivate {
// Browser requested a SCardCancel call.
// Extension must report the result to the browser by calling
- // reportCancelResult.
+ // reportPlainResult.
[maxListeners=1] static void onCancelRequested(long requestId,
long scardContext);
@@ -161,9 +176,39 @@ namespace smartCardProviderPrivate {
// Browser requested a SCardDisconnect call.
// Extension must report the result to the browser by calling
- // reportDisconnectResult.
+ // reportPlainResult.
[maxListeners=1] static void onDisconnectRequested(long requestId,
long scardHandle, Disposition disposition);
+
+ // Browser requested a SCardTransmit call.
+ // Extension must report the result to the browser by calling
+ // reportDataResult.
+ [maxListeners=1] static void onTransmitRequested(long requestId,
+ long scardHandle, Protocol protocol, ArrayBuffer data);
+
+ // Browser requested a SCardControl call.
+ // Extension must report the result to the browser by calling
+ // reportDataResult.
+ [maxListeners=1] static void onControlRequested(long requestId,
+ long scardHandle, long controlCode, ArrayBuffer data);
+
+ // Browser requested a SCardGetAttrib call.
+ // Extension must report the result to the browser by calling
+ // reportDataResult.
+ [maxListeners=1] static void onGetAttribRequested(long requestId,
+ long scardHandle, long attribId);
+
+ // Browser requested a SCardSetAttrib call.
+ // Extension must report the result to the browser by calling
+ // reportPlainResult.
+ [maxListeners=1] static void onSetAttribRequested(long requestId,
+ long scardHandle, long attribId, ArrayBuffer data);
+
+ // Browser requested a SCardStatus call.
+ // Extension must report the result to the browser by calling
+ // reportStatusResult.
+ [maxListeners=1] static void onStatusRequested(long requestId,
+ long scardHandle);
};
interface Functions {
@@ -183,15 +228,22 @@ namespace smartCardProviderPrivate {
static void reportGetStatusChangeResult(long requestId,
ReaderStateOut[] readerStates, ResultCode resultCode);
- // Reports the result of a SCardCancel call.
- static void reportCancelResult(long requestId,
+ // Reports the result of a call which doesn't send back any other
+ // information.
+ static void reportPlainResult(long requestId,
ResultCode resultCode);
// Reports the result of a SCardConnect call.
static void reportConnectResult(long requestId, long scardHandle,
Protocol activeProtocol, ResultCode resultCode);
- // Reports the result of a SCardDisconnect call.
- static void reportDisconnectResult(long requestId, ResultCode resultCode);
+ // Reports the result of a call that sends back data on success.
+ static void reportDataResult(long requestId, ArrayBuffer data,
+ ResultCode resultCode);
+
+ // Reports the result of a SCardStatus call.
+ static void reportStatusResult(long requestId, DOMString readerName,
+ ConnectionState state, Protocol protocol, ArrayBuffer atr,
+ ResultCode resultCode);
};
};
\ No newline at end of file
diff --git a/idl/chrome/tab_capture.idl b/idl/chrome/tab_capture.idl
index 9cfdf7d..c082097 100644
--- a/idl/chrome/tab_capture.idl
+++ b/idl/chrome/tab_capture.idl
@@ -100,7 +100,8 @@ namespace tabCapture {
// tab capture that would prevent a new tab capture from succeeding (or
// to prevent redundant requests for the same tab).
// |callback| : Callback invoked with CaptureInfo[] for captured tabs.
- static void getCapturedTabs(GetCapturedTabsCallback callback);
+ [supportsPromises] static void getCapturedTabs(
+ GetCapturedTabsCallback callback);
// Creates a stream ID to capture the target tab.
// Similar to chrome.tabCapture.capture() method, but returns a media
@@ -112,8 +113,9 @@ namespace tabCapture {
// getUserMedia() API to generate a media stream that
// corresponds to the target tab. The created streamId can
// only be used once and expires after a few seconds if it is not used.
- static void getMediaStreamId(optional GetMediaStreamOptions options,
- GetMediaStreamIdCallback callback);
+ [supportsPromises] static void getMediaStreamId(
+ optional GetMediaStreamOptions options,
+ GetMediaStreamIdCallback callback);
};
interface Events {
diff --git a/idl/chrome/terminal_private.json b/idl/chrome/terminal_private.json
index c1e67ca..b0f04da 100644
--- a/idl/chrome/terminal_private.json
+++ b/idl/chrome/terminal_private.json
@@ -242,21 +242,9 @@
"description": "True if alternative emulator flag is enabled.",
"type": "boolean"
},
- "multi_profile": {
- "description": "True if multi profile settings is enabled.",
- "type": "boolean"
- },
- "sftp": {
- "description": "True if SFTP / mount is enabled.",
- "type": "boolean"
- },
"tast": {
"description": "True if tast extension is installed.",
"type": "boolean"
- },
- "tmux_integration": {
- "description": "True if tmux control mode integration is enabled.",
- "type": "boolean"
}
},
"description": "Information about which features are enabled."
diff --git a/idl/chrome/web_authentication_proxy.idl b/idl/chrome/web_authentication_proxy.idl
index f4bfb51..10579c3 100644
--- a/idl/chrome/web_authentication_proxy.idl
+++ b/idl/chrome/web_authentication_proxy.idl
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// The chrome.webAuthenticationProxy. API lets remote desktop
+// The chrome.webAuthenticationProxy API lets remote desktop
// software running on a remote host intercept Web Authentication API
// (WebAuthn) requests in order to handle them on a local client.
namespace webAuthenticationProxy {
diff --git a/idl/chrome/wm_desks_private.idl b/idl/chrome/wm_desks_private.idl
index cbd61c6..fcd070a 100644
--- a/idl/chrome/wm_desks_private.idl
+++ b/idl/chrome/wm_desks_private.idl
@@ -124,4 +124,16 @@ namespace wmDesksPrivate {
[supportsPromises] static void getDeskByID(
DOMString deskUuid, GetDeskByIDCallback callback);
};
+
+ interface Events {
+ // Fires when new desks is added.
+ static void OnDeskAdded(DOMString deskId);
+
+ // Fires when desk removal is finalized.
+ static void OnDeskRemoved(DOMString deskId);
+
+ // Fires when desk activation changed.
+ static void OnDeskSwitched(DOMString activated, DOMString deactivated);
+ };
+
};
\ No newline at end of file
diff --git a/idl/extensions/audio.idl b/idl/extensions/audio.idl
index a2c946b..7b83f11 100644
--- a/idl/extensions/audio.idl
+++ b/idl/extensions/audio.idl
@@ -113,8 +113,8 @@ namespace audio {
// audio devices. If the filter is not set or set to {},
// returned device list will contain all available audio devices.
// |callback|: Reports the requested list of audio devices.
- static void getDevices(optional DeviceFilter filter,
- GetDevicesCallback callback);
+ [supportsPromises] static void getDevices(optional DeviceFilter filter,
+ GetDevicesCallback callback);
// Sets lists of active input and/or output devices.
// |ids|:
Specifies IDs of devices that should be active. If either the
@@ -122,27 +122,28 @@ namespace audio {
// unaffected.
//
//
It is an error to pass in a non-existent device ID.
- static void setActiveDevices(DeviceIdLists ids,
- EmptyCallback callback);
+ [supportsPromises] static void setActiveDevices(DeviceIdLists ids,
+ EmptyCallback callback);
// Sets the properties for the input or output device.
- static void setProperties(DOMString id,
- DeviceProperties properties,
- EmptyCallback callback);
+ [supportsPromises] static void setProperties(DOMString id,
+ DeviceProperties properties,
+ EmptyCallback callback);
// Gets the system-wide mute state for the specified stream type.
// |streamType|: Stream type for which mute state should be fetched.
// |callback|: Callback reporting whether mute is set or not for specified
// stream type.
- static void getMute(StreamType streamType, GetMuteCallback callback);
+ [supportsPromises] static void getMute(StreamType streamType,
+ GetMuteCallback callback);
// Sets mute state for a stream type. The mute state will apply to all audio
// devices with the specified audio stream type.
// |streamType|: Stream type for which mute state should be set.
// |isMuted|: New mute value.
- static void setMute(StreamType streamType,
- boolean isMuted,
- optional EmptyCallback callback);
+ [supportsPromises] static void setMute(StreamType streamType,
+ boolean isMuted,
+ optional EmptyCallback callback);
};
interface Events {
diff --git a/idl/extensions/automation.idl b/idl/extensions/automation.idl
index 216fca7..897718e 100644
--- a/idl/extensions/automation.idl
+++ b/idl/extensions/automation.idl
@@ -1271,6 +1271,9 @@ enum PositionType {
// Whether or not this node is an image.
boolean isImage;
+ // Whether the node contains hidden nodes.
+ boolean hasHiddenOffscreenNodes;
+
// Aria auto complete.
DOMString? autoComplete;
diff --git a/idl/extensions/file_handlers.idl b/idl/extensions/file_handlers.idl
index e7535e0..b347746 100644
--- a/idl/extensions/file_handlers.idl
+++ b/idl/extensions/file_handlers.idl
@@ -37,11 +37,14 @@
// Description of the file type.
DOMString name;
- // Array of ImageResources.
+ // Array of ImageResources. Only icons declared at the manifest level are
+ // currently supported. The icon for the extension will appear in the "Open"
+ // menu.
Icon[]? icons;
// Whether multiple files should be opened in a single client or multiple.
- // Defaults to `single-client`.
+ // Defaults to `single-client`, which opens one window containing one array
+ // with each file. `multiple-clients` opens a new window for each file.
DOMString? launch_type;
};
diff --git a/idl/extensions/idle.json b/idl/extensions/idle.json
index bc557ba..68d2a1d 100644
--- a/idl/extensions/idle.json
+++ b/idl/extensions/idle.json
@@ -27,18 +27,17 @@
"type": "integer",
"minimum": 15,
"description": "The system is considered idle if detectionIntervalInSeconds seconds have elapsed since the last user input detected."
- },
- {
- "name": "callback",
- "type": "function",
- "parameters": [
- {
- "name": "newState",
- "$ref": "IdleState"
- }
- ]
}
- ]
+ ],
+ "returns_async": {
+ "name": "callback",
+ "parameters": [
+ {
+ "name": "newState",
+ "$ref": "IdleState"
+ }
+ ]
+ }
},
{
"name": "setDetectionInterval",
@@ -57,19 +56,17 @@
"name": "getAutoLockDelay",
"type": "function",
"description": "Gets the time, in seconds, it takes until the screen is locked automatically while idle. Returns a zero duration if the screen is never locked automatically. Currently supported on Chrome OS only.",
- "parameters": [
- {
- "name": "callback",
- "type": "function",
- "parameters": [
- {
- "name": "delay",
- "type": "integer",
- "description": "Time, in seconds, until the screen is locked automatically while idle. This is zero if the screen never locks automatically."
- }
- ]
- }
- ]
+ "parameters": [],
+ "returns_async": {
+ "name": "callback",
+ "parameters": [
+ {
+ "name": "delay",
+ "type": "integer",
+ "description": "Time, in seconds, until the screen is locked automatically while idle. This is zero if the screen never locks automatically."
+ }
+ ]
+ }
}
],
"events": [
diff --git a/idl/extensions/offscreen.idl b/idl/extensions/offscreen.idl
index 88e91fb..cec419e 100644
--- a/idl/extensions/offscreen.idl
+++ b/idl/extensions/offscreen.idl
@@ -25,7 +25,7 @@ namespace offscreen {
// media (e.g. getUserMedia()).
USER_MEDIA,
// The offscreen document needs to interact with media streams from display
- // media (e.g. getDisplayMedia()getDisplayMedia()).
DISPLAY_MEDIA,
// The offscreen document needs to use WebRTC APIs.
WEB_RTC,
@@ -35,7 +35,9 @@ namespace offscreen {
// The offscreen document needs access to localStorage.
LOCAL_STORAGE,
// The offscreen document needs to spawn workers.
- WORKERS
+ WORKERS,
+ // The offscreen document needs to use navigator.geolocation
+ GEOLOCATION
};
dictionary CreateParameters {
diff --git a/idl/extensions/runtime.json b/idl/extensions/runtime.json
index 685bfca..753fd0e 100644
--- a/idl/extensions/runtime.json
+++ b/idl/extensions/runtime.json
@@ -144,7 +144,7 @@
{
"id": "ContextType",
"type": "string",
- "enum": ["TAB", "POPUP", "BACKGROUND", "OFFSCREEN_DOCUMENT"]
+ "enum": ["TAB", "POPUP", "BACKGROUND", "OFFSCREEN_DOCUMENT", "SIDE_PANEL"]
},
{
"id": "ExtensionContext",
@@ -328,12 +328,12 @@
{
"name": "setUninstallURL",
"type": "function",
- "description": "Sets the URL to be visited upon uninstallation. This may be used to clean up server-side data, do analytics, and implement surveys. Maximum 255 characters.",
+ "description": "Sets the URL to be visited upon uninstallation. This may be used to clean up server-side data, do analytics, and implement surveys. Maximum 1023 characters.",
"parameters": [
{
"type": "string",
"name": "url",
- "maxLength": 255,
+ "maxLength": 1023,
"description": "URL to be opened after the extension is uninstalled. This URL must have an http: or https: scheme. Set an empty string to not open a new tab upon uninstallation."
}
],
@@ -657,6 +657,17 @@
{"$ref": "Port", "name": "port"}
]
},
+ {
+ "name": "onUserScriptConnect",
+ "nodoc": true,
+ "type": "function",
+ "nocompile": true,
+ "options": { "unmanaged": true },
+ "description": "Fired when a connection is made from a user script from this extension.",
+ "parameters": [
+ {"$ref": "Port", "name": "port"}
+ ]
+ },
{
"name": "onConnectNative",
"type": "function",
@@ -702,6 +713,24 @@
"description": "Return true from the event listener if you wish to call sendResponse after the event listener returns."
}
},
+ {
+ "name": "onUserScriptMessage",
+ "nodoc": true,
+ "type": "function",
+ "nocompile": true,
+ "options": { "unmanaged": true },
+ "description": "Fired when a message is sent from a user script associated with the same extension.",
+ "parameters": [
+ {"name": "message", "type": "any", "optional": true, "description": "The message sent by the user script."},
+ {"name": "sender", "$ref": "MessageSender" },
+ {"name": "sendResponse", "type": "function", "description": "Function to call (at most once) when you have a response. The argument should be any JSON-ifiable object. If you have more than one onMessage listener in the same document, then only one may send a response. This function becomes invalid when the event listener returns, unless you return true from the event listener to indicate you wish to send a response asynchronously (this will keep the message channel open to the other end until sendResponse is called)." }
+ ],
+ "returns": {
+ "type": "boolean",
+ "optional": true,
+ "description": "Return true from the event listener if you wish to call sendResponse after the event listener returns."
+ }
+ },
{
"name": "onRestartRequired",
"type": "function",
diff --git a/idl/extensions/usb.idl b/idl/extensions/usb.idl
index 987a094..9ef518d 100644
--- a/idl/extensions/usb.idl
+++ b/idl/extensions/usb.idl
@@ -241,8 +241,8 @@ namespace usb {
interface Functions {
// Enumerates connected USB devices.
// |options|: The properties to search for on target devices.
- static void getDevices(EnumerateDevicesOptions options,
- GetDevicesCallback callback);
+ [supportsPromises] static void getDevices(EnumerateDevicesOptions options,
+ GetDevicesCallback callback);
// Presents a device picker to the user and returns the $(ref:Device)s
// selected.
@@ -251,13 +251,15 @@ namespace usb {
// callback will run as though the user cancelled.
// |options|: Configuration of the device picker dialog box.
// |callback|: Invoked with a list of chosen $(ref:Device)s.
- static void getUserSelectedDevices(DevicePromptOptions options,
- GetDevicesCallback callback);
+ [supportsPromises] static void getUserSelectedDevices(
+ DevicePromptOptions options,
+ GetDevicesCallback callback);
// Returns the full set of device configuration descriptors.
// |device|: The $(ref:Device) to fetch descriptors from.
- static void getConfigurations(Device device,
- GetConfigurationsCallback callback);
+ [supportsPromises] static void getConfigurations(
+ Device device,
+ GetConfigurationsCallback callback);
// Requests access from the permission broker to a device claimed by
// Chrome OS if the given interface on the device is not claimed.
@@ -267,14 +269,15 @@ namespace usb {
[deprecated="This function was Chrome OS specific and calling it on other
platforms would fail. This operation is now implicitly performed as part of
$(ref:openDevice) and this function will return true on all
- platforms."]
+ platforms.", supportsPromises]
static void requestAccess(Device device,
long interfaceId,
RequestAccessCallback callback);
// Opens a USB device returned by $(ref:getDevices).
// |device|: The $(ref:Device) to open.
- static void openDevice(Device device, OpenDeviceCallback callback);
+ [supportsPromises] static void openDevice(Device device,
+ OpenDeviceCallback callback);
// Finds USB devices specified by the vendor, product and (optionally)
// interface IDs and if permissions allow opens them for use.
@@ -286,14 +289,16 @@ namespace usb {
// by $(ref:openDevice) for each device.
//
// |options|: The properties to search for on target devices.
- static void findDevices(EnumerateDevicesAndRequestAccessOptions options,
- FindDevicesCallback callback);
+ [supportsPromises] static void findDevices(
+ EnumerateDevicesAndRequestAccessOptions options,
+ FindDevicesCallback callback);
// Closes a connection handle. Invoking operations on a handle after it
// has been closed is a safe operation but causes no action to be taken.
// |handle|: The $(ref:ConnectionHandle) to close.
- static void closeDevice(ConnectionHandle handle,
- optional CloseDeviceCallback callback);
+ [supportsPromises] static void closeDevice(
+ ConnectionHandle handle,
+ optional CloseDeviceCallback callback);
// Select a device configuration.
//
@@ -302,20 +307,22 @@ namespace usb {
// than 0 are valid however some buggy devices have a working
// configuration 0 and so this value is allowed.
// |handle|: An open connection to the device.
- static void setConfiguration(ConnectionHandle handle,
- long configurationValue,
- VoidCallback callback);
+ [supportsPromises] static void setConfiguration(ConnectionHandle handle,
+ long configurationValue,
+ VoidCallback callback);
// Gets the configuration descriptor for the currently selected
// configuration.
// |handle|: An open connection to the device.
- static void getConfiguration(ConnectionHandle handle,
- GetConfigurationCallback callback);
+ [supportsPromises] static void getConfiguration(
+ ConnectionHandle handle,
+ GetConfigurationCallback callback);
// Lists all interfaces on a USB device.
// |handle|: An open connection to the device.
- static void listInterfaces(ConnectionHandle handle,
- ListInterfacesCallback callback);
+ [supportsPromises] static void listInterfaces(
+ ConnectionHandle handle,
+ ListInterfacesCallback callback);
// Claims an interface on a USB device.
// Before data can be transfered to an interface or associated endpoints the
@@ -328,24 +335,27 @@ namespace usb {
//
// |handle|: An open connection to the device.
// |interfaceNumber|: The interface to be claimed.
- static void claimInterface(ConnectionHandle handle, long interfaceNumber,
- VoidCallback callback);
+ [supportsPromises] static void claimInterface(ConnectionHandle handle,
+ long interfaceNumber,
+ VoidCallback callback);
// Releases a claimed interface.
// |handle|: An open connection to the device.
// |interfaceNumber|: The interface to be released.
- static void releaseInterface(ConnectionHandle handle, long interfaceNumber,
- VoidCallback callback);
+ [supportsPromises] static void releaseInterface(ConnectionHandle handle,
+ long interfaceNumber,
+ VoidCallback callback);
// Selects an alternate setting on a previously claimed interface.
// |handle|: An open connection to the device where this interface has been
// claimed.
// |interfaceNumber|: The interface to configure.
// |alternateSetting|: The alternate setting to configure.
- static void setInterfaceAlternateSetting(ConnectionHandle handle,
- long interfaceNumber,
- long alternateSetting,
- VoidCallback callback);
+ [supportsPromises] static void setInterfaceAlternateSetting(
+ ConnectionHandle handle,
+ long interfaceNumber,
+ long alternateSetting,
+ VoidCallback callback);
// Performs a control transfer on the specified device.
//
@@ -354,29 +364,33 @@ namespace usb {
// be claimed.
//
// |handle|: An open connection to the device.
- static void controlTransfer(ConnectionHandle handle,
- ControlTransferInfo transferInfo,
- TransferCallback callback);
+ [supportsPromises] static void controlTransfer(
+ ConnectionHandle handle,
+ ControlTransferInfo transferInfo,
+ TransferCallback callback);
// Performs a bulk transfer on the specified device.
// |handle|: An open connection to the device.
// |transferInfo|: The transfer parameters.
- static void bulkTransfer(ConnectionHandle handle,
- GenericTransferInfo transferInfo,
- TransferCallback callback);
+ [supportsPromises] static void bulkTransfer(
+ ConnectionHandle handle,
+ GenericTransferInfo transferInfo,
+ TransferCallback callback);
// Performs an interrupt transfer on the specified device.
// |handle|: An open connection to the device.
// |transferInfo|: The transfer parameters.
- static void interruptTransfer(ConnectionHandle handle,
- GenericTransferInfo transferInfo,
- TransferCallback callback);
+ [supportsPromises] static void interruptTransfer(
+ ConnectionHandle handle,
+ GenericTransferInfo transferInfo,
+ TransferCallback callback);
// Performs an isochronous transfer on the specific device.
// |handle|: An open connection to the device.
- static void isochronousTransfer(ConnectionHandle handle,
- IsochronousTransferInfo transferInfo,
- TransferCallback callback);
+ [supportsPromises] static void isochronousTransfer(
+ ConnectionHandle handle,
+ IsochronousTransferInfo transferInfo,
+ TransferCallback callback);
// Tries to reset the USB device.
// If the reset fails, the given connection handle will be closed and the
@@ -385,8 +399,8 @@ namespace usb {
// to acquire the device.
//
// |handle|: A connection handle to reset.
- static void resetDevice(ConnectionHandle handle,
- ResetDeviceCallback callback);
+ [supportsPromises] static void resetDevice(ConnectionHandle handle,
+ ResetDeviceCallback callback);
};
interface Events {
diff --git a/idl/extensions/web_request.json b/idl/extensions/web_request.json
index 11de1d7..78923a7 100644
--- a/idl/extensions/web_request.json
+++ b/idl/extensions/web_request.json
@@ -179,9 +179,8 @@
"name": "handlerBehaviorChanged",
"type": "function",
"description": "Needs to be called when the behavior of the webRequest handlers has changed to prevent incorrect handling due to caching. This function call is expensive. Don't call it often.",
- "parameters": [
- {"type": "function", "name": "callback", "optional": true, "parameters": []}
- ]
+ "parameters": [],
+ "returns_async": {"name": "callback", "optional": true, "parameters": []}
}
],
"events": [
diff --git a/lib/action.dart b/lib/action.dart
index a5ea2ae..b8fabdd 100644
--- a/lib/action.dart
+++ b/lib/action.dart
@@ -161,6 +161,7 @@ class TabDetails {
/// The ID of the tab to query state for. If no tab is specified, the
/// non-tab-specific state is returned.
int? get tabId => _wrapped.tabId;
+
set tabId(int? v) {
_wrapped.tabId = v;
}
@@ -185,6 +186,7 @@ class UserSettings {
/// top-level toolbar (i.e., whether the extension has been 'pinned' by the
/// user).
bool get isOnToolbar => _wrapped.isOnToolbar;
+
set isOnToolbar(bool v) {
_wrapped.isOnToolbar = v;
}
@@ -207,6 +209,7 @@ class OpenPopupOptions {
/// The id of the window to open the action popup in. Defaults to the
/// currently-active window if unspecified.
int? get windowId => _wrapped.windowId;
+
set windowId(int? v) {
_wrapped.windowId = v;
}
@@ -233,6 +236,7 @@ class SetTitleDetails {
/// The string the action should display when moused over.
String get title => _wrapped.title;
+
set title(String v) {
_wrapped.title = v;
}
@@ -240,6 +244,7 @@ class SetTitleDetails {
/// Limits the change to when a particular tab is selected. Automatically
/// resets when the tab is closed.
int? get tabId => _wrapped.tabId;
+
set tabId(int? v) {
_wrapped.tabId = v;
}
@@ -281,7 +286,7 @@ class SetIconDetails {
'Received type: ${imageData.runtimeType}. Supported types are: JSObject, Map')
},
path: switch (path) {
- String() => path,
+ String() => path.jsify()!,
Map() => path.jsify()!,
null => null,
_ => throw UnsupportedError(
@@ -306,6 +311,7 @@ class SetIconDetails {
isOther: (v) => (v as $js_browser_action.ImageDataType),
isMap: (v) => v.toDartMap(),
);
+
set imageData(Object? v) {
_wrapped.imageData = switch (v) {
JSObject() => v,
@@ -327,9 +333,10 @@ class SetIconDetails {
isString: (v) => v,
isMap: (v) => v.toDartMap(),
);
+
set path(Object? v) {
_wrapped.path = switch (v) {
- String() => v,
+ String() => v.jsify()!,
Map() => v.jsify()!,
null => null,
_ => throw UnsupportedError(
@@ -340,6 +347,7 @@ class SetIconDetails {
/// Limits the change to when a particular tab is selected. Automatically
/// resets when the tab is closed.
int? get tabId => _wrapped.tabId;
+
set tabId(int? v) {
_wrapped.tabId = v;
}
@@ -368,6 +376,7 @@ class SetPopupDetails {
/// Limits the change to when a particular tab is selected. Automatically
/// resets when the tab is closed.
int? get tabId => _wrapped.tabId;
+
set tabId(int? v) {
_wrapped.tabId = v;
}
@@ -375,6 +384,7 @@ class SetPopupDetails {
/// The relative path to the HTML file to show in a popup. If set to the empty
/// string (`''`), no popup is shown.
String get popup => _wrapped.popup;
+
set popup(String v) {
_wrapped.popup = v;
}
@@ -385,8 +395,10 @@ class SetBadgeTextDetails {
SetBadgeTextDetails({
/// Any number of characters can be passed, but only about four can fit in
- /// the space.
- required String text,
+ /// the space. If an empty string (`''`) is passed, the badge text is
+ /// cleared. If `tabId` is specified and `text` is null, the text for the
+ /// specified tab is cleared and defaults to the global badge text.
+ String? text,
/// Limits the change to when a particular tab is selected. Automatically
/// resets when the tab is closed.
@@ -401,15 +413,19 @@ class SetBadgeTextDetails {
$js.SetBadgeTextDetails get toJS => _wrapped;
/// Any number of characters can be passed, but only about four can fit in the
- /// space.
- String get text => _wrapped.text;
- set text(String v) {
+ /// space. If an empty string (`''`) is passed, the badge text is cleared. If
+ /// `tabId` is specified and `text` is null, the text for the specified tab is
+ /// cleared and defaults to the global badge text.
+ String? get text => _wrapped.text;
+
+ set text(String? v) {
_wrapped.text = v;
}
/// Limits the change to when a particular tab is selected. Automatically
/// resets when the tab is closed.
int? get tabId => _wrapped.tabId;
+
set tabId(int? v) {
_wrapped.tabId = v;
}
@@ -430,7 +446,7 @@ class SetBadgeBackgroundColorDetails {
int? tabId,
}) : _wrapped = $js.SetBadgeBackgroundColorDetails(
color: switch (color) {
- String() => color,
+ String() => color.jsify()!,
List() => color.toJSArray((e) => e),
_ => throw UnsupportedError(
'Received type: ${color.runtimeType}. Supported types are: String, List')
@@ -453,9 +469,10 @@ class SetBadgeBackgroundColorDetails {
.map((e) => e)
.toList(),
);
+
set color(Object v) {
_wrapped.color = switch (v) {
- String() => v,
+ String() => v.jsify()!,
List() => v.toJSArray((e) => e),
_ => throw UnsupportedError(
'Received type: ${v.runtimeType}. Supported types are: String, List')
@@ -465,6 +482,7 @@ class SetBadgeBackgroundColorDetails {
/// Limits the change to when a particular tab is selected. Automatically
/// resets when the tab is closed.
int? get tabId => _wrapped.tabId;
+
set tabId(int? v) {
_wrapped.tabId = v;
}
@@ -488,7 +506,7 @@ class SetBadgeTextColorDetails {
int? tabId,
}) : _wrapped = $js.SetBadgeTextColorDetails(
color: switch (color) {
- String() => color,
+ String() => color.jsify()!,
List() => color.toJSArray((e) => e),
_ => throw UnsupportedError(
'Received type: ${color.runtimeType}. Supported types are: String, List')
@@ -515,9 +533,10 @@ class SetBadgeTextColorDetails {
.map((e) => e)
.toList(),
);
+
set color(Object v) {
_wrapped.color = switch (v) {
- String() => v,
+ String() => v.jsify()!,
List() => v.toJSArray((e) => e),
_ => throw UnsupportedError(
'Received type: ${v.runtimeType}. Supported types are: String, List')
@@ -527,6 +546,7 @@ class SetBadgeTextColorDetails {
/// Limits the change to when a particular tab is selected. Automatically
/// resets when the tab is closed.
int? get tabId => _wrapped.tabId;
+
set tabId(int? v) {
_wrapped.tabId = v;
}
diff --git a/lib/alarms.dart b/lib/alarms.dart
index 6ff8ba7..f1a9cd1 100644
--- a/lib/alarms.dart
+++ b/lib/alarms.dart
@@ -118,6 +118,7 @@ class Alarm {
/// Name of this alarm.
String get name => _wrapped.name;
+
set name(String v) {
_wrapped.name = v;
}
@@ -126,6 +127,7 @@ class Alarm {
/// epoch (e.g. `Date.now() + n`). For performance reasons, the
/// alarm may have been delayed an arbitrary amount beyond this.
double get scheduledTime => _wrapped.scheduledTime;
+
set scheduledTime(double v) {
_wrapped.scheduledTime = v;
}
@@ -133,6 +135,7 @@ class Alarm {
/// If not null, the alarm is a repeating alarm and will fire again in
/// [periodInMinutes] minutes.
double? get periodInMinutes => _wrapped.periodInMinutes;
+
set periodInMinutes(double? v) {
_wrapped.periodInMinutes = v;
}
@@ -171,6 +174,7 @@ class AlarmCreateInfo {
/// Time at which the alarm should fire, in milliseconds past the epoch
/// (e.g. `Date.now() + n`).
double? get when => _wrapped.when;
+
set when(double? v) {
_wrapped.when = v;
}
@@ -180,6 +184,7 @@ class AlarmCreateInfo {
///
///
double? get delayInMinutes => _wrapped.delayInMinutes;
+
set delayInMinutes(double? v) {
_wrapped.delayInMinutes = v;
}
@@ -190,6 +195,7 @@ class AlarmCreateInfo {
///
///
double? get periodInMinutes => _wrapped.periodInMinutes;
+
set periodInMinutes(double? v) {
_wrapped.periodInMinutes = v;
}
diff --git a/lib/audio.dart b/lib/audio.dart
index bf9b795..1309856 100644
--- a/lib/audio.dart
+++ b/lib/audio.dart
@@ -2,6 +2,7 @@
library;
+import 'dart:js_util';
import 'src/internal_helpers.dart';
import 'src/js/audio.dart' as $js;
@@ -27,20 +28,13 @@ class ChromeAudio {
/// audio devices. If the filter is not set or set to `{}`,
/// returned device list will contain all available audio devices.
/// |callback|: Reports the requested list of audio devices.
- Future> getDevices(DeviceFilter? filter) {
- var $completer = Completer>();
- $js.chrome.audio.getDevices(
- filter?.toJS,
- (JSArray devices) {
- if (checkRuntimeLastError($completer)) {
- $completer.complete(devices.toDart
- .cast<$js.AudioDeviceInfo>()
- .map((e) => AudioDeviceInfo.fromJS(e))
- .toList());
- }
- }.toJS,
- );
- return $completer.future;
+ Future> getDevices(DeviceFilter? filter) async {
+ var $res = await promiseToFuture(
+ $js.chrome.audio.getDevices(filter?.toJS));
+ return $res.toDart
+ .cast<$js.AudioDeviceInfo>()
+ .map((e) => AudioDeviceInfo.fromJS(e))
+ .toList();
}
/// Sets lists of active input and/or output devices.
@@ -49,52 +43,29 @@ class ChromeAudio {
/// unaffected.
///
/// It is an error to pass in a non-existent device ID.
- Future setActiveDevices(DeviceIdLists ids) {
- var $completer = Completer();
- $js.chrome.audio.setActiveDevices(
- ids.toJS,
- () {
- if (checkRuntimeLastError($completer)) {
- $completer.complete(null);
- }
- }.toJS,
- );
- return $completer.future;
+ Future setActiveDevices(DeviceIdLists ids) async {
+ await promiseToFuture($js.chrome.audio.setActiveDevices(ids.toJS));
}
/// Sets the properties for the input or output device.
Future setProperties(
String id,
DeviceProperties properties,
- ) {
- var $completer = Completer();
- $js.chrome.audio.setProperties(
+ ) async {
+ await promiseToFuture($js.chrome.audio.setProperties(
id,
properties.toJS,
- () {
- if (checkRuntimeLastError($completer)) {
- $completer.complete(null);
- }
- }.toJS,
- );
- return $completer.future;
+ ));
}
/// Gets the system-wide mute state for the specified stream type.
/// |streamType|: Stream type for which mute state should be fetched.
/// |callback|: Callback reporting whether mute is set or not for specified
/// stream type.
- Future getMute(StreamType streamType) {
- var $completer = Completer();
- $js.chrome.audio.getMute(
- streamType.toJS,
- (bool value) {
- if (checkRuntimeLastError($completer)) {
- $completer.complete(value);
- }
- }.toJS,
- );
- return $completer.future;
+ Future getMute(StreamType streamType) async {
+ var $res =
+ await promiseToFuture($js.chrome.audio.getMute(streamType.toJS));
+ return $res;
}
/// Sets mute state for a stream type. The mute state will apply to all audio
@@ -104,18 +75,11 @@ class ChromeAudio {
Future setMute(
StreamType streamType,
bool isMuted,
- ) {
- var $completer = Completer();
- $js.chrome.audio.setMute(
+ ) async {
+ await promiseToFuture($js.chrome.audio.setMute(
streamType.toJS,
isMuted,
- () {
- if (checkRuntimeLastError($completer)) {
- $completer.complete(null);
- }
- }.toJS,
- );
- return $completer.future;
+ ));
}
/// Fired when sound level changes for an active audio device.
@@ -232,48 +196,56 @@ class AudioDeviceInfo {
/// The unique identifier of the audio device.
String get id => _wrapped.id;
+
set id(String v) {
_wrapped.id = v;
}
/// Stream type associated with this device.
StreamType get streamType => StreamType.fromJS(_wrapped.streamType);
+
set streamType(StreamType v) {
_wrapped.streamType = v.toJS;
}
/// Type of the device.
DeviceType get deviceType => DeviceType.fromJS(_wrapped.deviceType);
+
set deviceType(DeviceType v) {
_wrapped.deviceType = v.toJS;
}
/// The user-friendly name (e.g. "USB Microphone").
String get displayName => _wrapped.displayName;
+
set displayName(String v) {
_wrapped.displayName = v;
}
/// Device name.
String get deviceName => _wrapped.deviceName;
+
set deviceName(String v) {
_wrapped.deviceName = v;
}
/// True if this is the current active device.
bool get isActive => _wrapped.isActive;
+
set isActive(bool v) {
_wrapped.isActive = v;
}
/// The sound level of the device, volume for output, gain for input.
int get level => _wrapped.level;
+
set level(int v) {
_wrapped.level = v;
}
/// The stable/persisted device id string when available.
String? get stableDeviceId => _wrapped.stableDeviceId;
+
set stableDeviceId(String? v) {
_wrapped.stableDeviceId = v;
}
@@ -305,6 +277,7 @@ class DeviceFilter {
.cast<$js.StreamType>()
.map((e) => StreamType.fromJS(e))
.toList();
+
set streamTypes(List? v) {
_wrapped.streamTypes = v?.toJSArray((e) => e.toJS);
}
@@ -312,6 +285,7 @@ class DeviceFilter {
/// If set, only audio devices whose active state matches this value will
/// satisfy the filter.
bool? get isActive => _wrapped.isActive;
+
set isActive(bool? v) {
_wrapped.isActive = v;
}
@@ -342,6 +316,7 @@ class DeviceProperties {
/// If used with audio input device, represents audio device gain.
/// If used with audio output device, represents audio device volume.
int? get level => _wrapped.level;
+
set level(int? v) {
_wrapped.level = v;
}
@@ -374,6 +349,7 @@ class DeviceIdLists {
/// unset.
List? get input =>
_wrapped.input?.toDart.cast().map((e) => e).toList();
+
set input(List? v) {
_wrapped.input = v?.toJSArray((e) => e);
}
@@ -383,6 +359,7 @@ class DeviceIdLists {
/// unset.
List? get output =>
_wrapped.output?.toDart.cast().map((e) => e).toList();
+
set output(List? v) {
_wrapped.output = v?.toJSArray((e) => e);
}
@@ -411,12 +388,14 @@ class MuteChangedEvent {
/// The type of the stream for which the mute value changed. The updated mute
/// value applies to all devices with this stream type.
StreamType get streamType => StreamType.fromJS(_wrapped.streamType);
+
set streamType(StreamType v) {
_wrapped.streamType = v.toJS;
}
/// Whether or not the stream is now muted.
bool get isMuted => _wrapped.isMuted;
+
set isMuted(bool v) {
_wrapped.isMuted = v;
}
@@ -442,12 +421,14 @@ class LevelChangedEvent {
/// ID of device whose sound level has changed.
String get deviceId => _wrapped.deviceId;
+
set deviceId(String v) {
_wrapped.deviceId = v;
}
/// The device's new sound level.
int get level => _wrapped.level;
+
set level(int v) {
_wrapped.level = v;
}
diff --git a/lib/bookmarks.dart b/lib/bookmarks.dart
index 65b5b26..04c1dea 100644
--- a/lib/bookmarks.dart
+++ b/lib/bookmarks.dart
@@ -27,7 +27,7 @@ class ChromeBookmarks {
Future> get(Object idOrIdList) async {
var $res = await promiseToFuture(
$js.chrome.bookmarks.get(switch (idOrIdList) {
- String() => idOrIdList,
+ String() => idOrIdList.jsify()!,
List() => idOrIdList.toJSArrayString(),
_ => throw UnsupportedError(
'Received type: ${idOrIdList.runtimeType}. Supported types are: String, List')
@@ -89,8 +89,8 @@ class ChromeBookmarks {
Future> search(Object query) async {
var $res = await promiseToFuture(
$js.chrome.bookmarks.search(switch (query) {
- String() => query,
- SearchQuery() => query.toJS,
+ String() => query.jsify()!,
+ SearchQuery() => (query.toJS as JSAny),
_ => throw UnsupportedError(
'Received type: ${query.runtimeType}. Supported types are: String, SearchQuery')
}));
@@ -307,30 +307,35 @@ class BookmarkTreeNode {
/// The unique identifier for the node. IDs are unique within the current
/// profile, and they remain valid even after the browser is restarted.
String get id => _wrapped.id;
+
set id(String v) {
_wrapped.id = v;
}
/// The `id` of the parent folder. Omitted for the root node.
String? get parentId => _wrapped.parentId;
+
set parentId(String? v) {
_wrapped.parentId = v;
}
/// The 0-based position of this node within its parent folder.
int? get index => _wrapped.index;
+
set index(int? v) {
_wrapped.index = v;
}
/// The URL navigated to when a user clicks the bookmark. Omitted for folders.
String? get url => _wrapped.url;
+
set url(String? v) {
_wrapped.url = v;
}
/// The text displayed for the node.
String get title => _wrapped.title;
+
set title(String v) {
_wrapped.title = v;
}
@@ -338,6 +343,7 @@ class BookmarkTreeNode {
/// When this node was created, in milliseconds since the epoch (`new
/// Date(dateAdded)`).
double? get dateAdded => _wrapped.dateAdded;
+
set dateAdded(double? v) {
_wrapped.dateAdded = v;
}
@@ -345,6 +351,7 @@ class BookmarkTreeNode {
/// When this node was last opened, in milliseconds since the epoch. Not set
/// for folders.
double? get dateLastUsed => _wrapped.dateLastUsed;
+
set dateLastUsed(double? v) {
_wrapped.dateLastUsed = v;
}
@@ -352,6 +359,7 @@ class BookmarkTreeNode {
/// When the contents of this folder last changed, in milliseconds since the
/// epoch.
double? get dateGroupModified => _wrapped.dateGroupModified;
+
set dateGroupModified(double? v) {
_wrapped.dateGroupModified = v;
}
@@ -362,6 +370,7 @@ class BookmarkTreeNode {
/// the user and the extension (default).
BookmarkTreeNodeUnmodifiable? get unmodifiable =>
_wrapped.unmodifiable?.let(BookmarkTreeNodeUnmodifiable.fromJS);
+
set unmodifiable(BookmarkTreeNodeUnmodifiable? v) {
_wrapped.unmodifiable = v?.toJS;
}
@@ -371,6 +380,7 @@ class BookmarkTreeNode {
.cast<$js.BookmarkTreeNode>()
.map((e) => BookmarkTreeNode.fromJS(e))
.toList();
+
set children(List? v) {
_wrapped.children = v?.toJSArray((e) => e.toJS);
}
@@ -398,21 +408,25 @@ class CreateDetails {
/// Defaults to the Other Bookmarks folder.
String? get parentId => _wrapped.parentId;
+
set parentId(String? v) {
_wrapped.parentId = v;
}
int? get index => _wrapped.index;
+
set index(int? v) {
_wrapped.index = v;
}
String? get title => _wrapped.title;
+
set title(String? v) {
_wrapped.title = v;
}
String? get url => _wrapped.url;
+
set url(String? v) {
_wrapped.url = v;
}
@@ -436,16 +450,19 @@ class OnRemovedRemoveInfo {
$js.OnRemovedRemoveInfo get toJS => _wrapped;
String get parentId => _wrapped.parentId;
+
set parentId(String v) {
_wrapped.parentId = v;
}
int get index => _wrapped.index;
+
set index(int v) {
_wrapped.index = v;
}
BookmarkTreeNode get node => BookmarkTreeNode.fromJS(_wrapped.node);
+
set node(BookmarkTreeNode v) {
_wrapped.node = v.toJS;
}
@@ -467,11 +484,13 @@ class OnChangedChangeInfo {
$js.OnChangedChangeInfo get toJS => _wrapped;
String get title => _wrapped.title;
+
set title(String v) {
_wrapped.title = v;
}
String? get url => _wrapped.url;
+
set url(String? v) {
_wrapped.url = v;
}
@@ -497,21 +516,25 @@ class OnMovedMoveInfo {
$js.OnMovedMoveInfo get toJS => _wrapped;
String get parentId => _wrapped.parentId;
+
set parentId(String v) {
_wrapped.parentId = v;
}
int get index => _wrapped.index;
+
set index(int v) {
_wrapped.index = v;
}
String get oldParentId => _wrapped.oldParentId;
+
set oldParentId(String v) {
_wrapped.oldParentId = v;
}
int get oldIndex => _wrapped.oldIndex;
+
set oldIndex(int v) {
_wrapped.oldIndex = v;
}
@@ -530,6 +553,7 @@ class OnChildrenReorderedReorderInfo {
List get childIds =>
_wrapped.childIds.toDart.cast().map((e) => e).toList();
+
set childIds(List v) {
_wrapped.childIds = v.toJSArray((e) => e);
}
@@ -562,18 +586,21 @@ class SearchQuery {
/// A string of words and quoted phrases that are matched against bookmark
/// URLs and titles.
String? get query => _wrapped.query;
+
set query(String? v) {
_wrapped.query = v;
}
/// The URL of the bookmark; matches verbatim. Note that folders have no URL.
String? get url => _wrapped.url;
+
set url(String? v) {
_wrapped.url = v;
}
/// The title of the bookmark; matches verbatim.
String? get title => _wrapped.title;
+
set title(String? v) {
_wrapped.title = v;
}
@@ -595,11 +622,13 @@ class MoveDestination {
$js.MoveDestination get toJS => _wrapped;
String? get parentId => _wrapped.parentId;
+
set parentId(String? v) {
_wrapped.parentId = v;
}
int? get index => _wrapped.index;
+
set index(int? v) {
_wrapped.index = v;
}
@@ -621,11 +650,13 @@ class UpdateChanges {
$js.UpdateChanges get toJS => _wrapped;
String? get title => _wrapped.title;
+
set title(String? v) {
_wrapped.title = v;
}
String? get url => _wrapped.url;
+
set url(String? v) {
_wrapped.url = v;
}
diff --git a/lib/browser_action.dart b/lib/browser_action.dart
index 2c8650b..a6e7b3b 100644
--- a/lib/browser_action.dart
+++ b/lib/browser_action.dart
@@ -43,17 +43,8 @@ class ChromeBrowserAction {
/// path to an image file, as the pixel data from a canvas element, or as a
/// dictionary of one of those. Either the `path` or the `imageData` property
/// must be specified.
- Future setIcon(SetIconDetails details) {
- var $completer = Completer();
- $js.chrome.browserAction.setIcon(
- details.toJS,
- () {
- if (checkRuntimeLastError($completer)) {
- $completer.complete(null);
- }
- }.toJS,
- );
- return $completer.future;
+ Future setIcon(SetIconDetails details) async {
+ await promiseToFuture($js.chrome.browserAction.setIcon(details.toJS));
}
/// Sets the HTML document to be opened as a popup when the user clicks the
@@ -113,14 +104,10 @@ class ChromeBrowserAction {
/// Opens the extension popup window in the active window but does not grant
/// tab permissions.
- Future