1// Copyright (c) 2012 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5// API for integration testing. To be used on test images with a test component
6// extension.
7[platforms=("chromeos"),
8 implemented_in="chrome/browser/chromeos/extensions/autotest_private/autotest_private_api.h"]
9namespace autotestPrivate {
10
11  enum ShelfAlignmentType {
12    // BottomLocked not supported by shelf_prefs.
13    Bottom, Left, Right
14  };
15
16  // A mapping of ash::ShelfItemType.
17  enum ShelfItemType {
18    App,
19    PinnedApp,
20    BrowserShortcut,
21    Dialog
22  };
23
24  // A mapping of ash::ShelfItemStatus.
25  enum ShelfItemStatus {
26    Closed,
27    Running,
28    Attention
29  };
30
31  // A mapping of apps::mojom::Type
32  enum AppType {
33    Arc,
34    BuiltIn,
35    Crostini,
36    Extension,
37    Web,
38    MacOS,
39    PluginVm,
40    Lacros,
41    Remote,
42    Borealis
43  };
44
45  // A mapping of apps::mojom::InstallSource
46  enum AppInstallSource {
47    Unknown,
48    System,
49    Policy,
50    Oem,
51    Default,
52    Sync,
53    User
54  };
55
56  // A mapping of apps::mojom::Readiness
57  enum AppReadiness {
58    Ready,
59    DisabledByBlacklist,
60    DisabledByPolicy,
61    DisabledByUser,
62    Terminated,
63    UninstalledByUser
64  };
65
66  // A subset of Window State types in ash::WindowStateType. We may add more
67  // into the set in the future.
68  enum WindowStateType {
69    Normal,
70    Minimized,
71    Maximized,
72    Fullscreen,
73    LeftSnapped,
74    RightSnapped,
75    PIP
76  };
77
78  // A subset of WM event types in ash::WMEventType. We may add more in the
79  // set in the future.
80  enum WMEventType {
81    WMEventNormal,
82    WMEventMaximize,
83    WMEventMinimize,
84    WMEventFullscreen,
85    WMEventSnapLeft,
86    WMEventSnapRight
87  };
88
89  // Display orientation type.
90  enum RotationType {
91    // RotateAny is the auto-rotation status (not locked to a rotation) for
92    // tablet mode. Not working in clamshell mode.
93    RotateAny,
94    Rotate0,
95    Rotate90,
96    Rotate180,
97    Rotate270
98  };
99
100  enum LauncherStateType {
101    Closed,
102    Peeking,
103    Half,
104    FullscreenAllApps,
105    FullscreenSearch
106  };
107
108  enum OverviewStateType {
109   Shown,
110   Hidden
111  };
112
113  enum MouseButton {
114    Left,
115    Middle,
116    Right
117  };
118
119  // A paramter used in setArcAppWindowState() function.
120  dictionary WindowStateChangeDict {
121    // The WM event to change the ARC window state.
122    WMEventType eventType;
123
124    // If the initial state is already same as the expected state, should we
125    // treat this case as a failure? Default value is false.
126    boolean? failIfNoChange;
127  };
128
129  dictionary LoginStatusDict {
130    // Are we logged in?
131    boolean isLoggedIn;
132    // Is the logged-in user the owner?
133    boolean isOwner;
134    // Is the screen locked?
135    boolean isScreenLocked;
136    // Is the screen ready for password?
137    boolean isReadyForPassword;
138
139    // Is the logged-in user a regular user?
140    boolean isRegularUser;
141    // Are we logged into the guest account?
142    boolean isGuest;
143    // Are we logged into kiosk-app mode?
144    boolean isKiosk;
145
146    DOMString email;
147    DOMString displayEmail;
148    // User image: 'file', 'profile' or a number.
149    DOMString userImage;
150  };
151  callback LoginStatusCallback = void (LoginStatusDict status);
152
153  // |all_policies| will be the full list of policies as returned by the
154  // DictionaryPolicyConversions.ToValue function.
155  callback AllEnterprisePoliciesCallback = void (any all_policies);
156
157  dictionary ExtensionInfoDict {
158    DOMString id;
159    DOMString version;
160    DOMString name;
161    DOMString publicKey;
162    DOMString description;
163    DOMString backgroundUrl;
164    DOMString optionsUrl;
165
166    DOMString[] hostPermissions;
167    DOMString[] effectiveHostPermissions;
168    DOMString[] apiPermissions;
169
170    boolean isComponent;
171    boolean isInternal;
172    boolean isUserInstalled;
173    boolean isEnabled;
174    boolean allowedInIncognito;
175    boolean hasPageAction;
176  };
177  dictionary ExtensionsInfoArray {
178    ExtensionInfoDict[] extensions;
179  };
180  callback ExtensionsInfoCallback = void (ExtensionsInfoArray info);
181
182  dictionary Notification {
183    DOMString id;
184    DOMString type;
185    DOMString title;
186    DOMString message;
187    long priority;
188    long progress;
189  };
190  callback NotificationArrayCallback = void (Notification[] notifications);
191
192  dictionary Printer {
193    DOMString printerName;
194    DOMString? printerId;
195    DOMString? printerType;
196    DOMString? printerDesc;
197    DOMString? printerMakeAndModel;
198    DOMString? printerUri;
199    DOMString? printerPpd;
200  };
201  callback PrinterArrayCallback = void (Printer[] printers);
202
203  callback ArcStartTimeCallback = void (double startTime);
204
205  dictionary ArcState {
206    // Whether the ARC is provisioned.
207    boolean provisioned;
208    // Whether ARC Terms of Service needs to be shown.
209    boolean tosNeeded;
210  };
211  callback ArcStateCallback = void (ArcState result);
212
213  dictionary PlayStoreState {
214    // Whether the Play Store allowed for the current user.
215    boolean allowed;
216    // Whether the Play Store currently enabled.
217    boolean? enabled;
218    // Whether the Play Store managed by policy.
219    boolean? managed;
220  };
221  callback PlayStoreStateCallback = void (PlayStoreState result);
222
223  dictionary AssistantQueryResponse {
224    // Text response returned from server.
225    DOMString? text;
226    // HTML response returned from server, usually accompanied with
227    // fallback text.
228    DOMString? htmlResponse;
229    // Text messages used as the "fallback" for HTML card rendering.
230    // Generally the fallback text is similar to transcribed TTS,
231    // e.g. "It's exactly 6 o'clock." or "Turning bluetooth off.".
232    DOMString? htmlFallback;
233  };
234  dictionary AssistantQueryStatus {
235    // Indicates whether this might be a voice interaction.
236    boolean isMicOpen;
237    // Query text sent to Assistant. In the event of a voice interaction,
238    // this field will be same as the speech recognition final result.
239    DOMString queryText;
240    // Response for the current query.
241    AssistantQueryResponse queryResponse;
242  };
243  callback AssistantQueryStatusCallback = void (AssistantQueryStatus status);
244
245  callback IsAppShownCallback = void (boolean appShown);
246
247  callback IsArcProvisionedCallback = void (boolean arcProvisioned);
248
249  callback IsArcPackageListInitialRefreshedCallback = void (boolean refreshed);
250
251  dictionary ArcAppDict {
252    DOMString name;
253    DOMString packageName;
254    DOMString activity;
255    DOMString intentUri;
256    DOMString iconResourceId;
257    double lastLaunchTime;
258    double installTime;
259    boolean sticky;
260    boolean notificationsEnabled;
261    boolean ready;
262    boolean suspended;
263    boolean showInLauncher;
264    boolean shortcut;
265    boolean launchable;
266  };
267  callback GetArcAppCallback = void (ArcAppDict package);
268
269  dictionary ArcPackageDict {
270    DOMString packageName;
271    long packageVersion;
272    DOMString lastBackupAndroidId;
273    double lastBackupTime;
274    boolean shouldSync;
275    boolean system;
276    boolean vpnProvider;
277  };
278  callback GetArcPackageCallback = void (ArcPackageDict package);
279
280  dictionary Location {
281    double x;
282    double y;
283  };
284
285  dictionary Bounds {
286    double left;
287    double top;
288    double width;
289    double height;
290  };
291
292  dictionary ArcAppTracingInfo {
293    boolean success;
294    double fps;
295    double commitDeviation;
296    double renderQuality;
297  };
298
299  callback LaunchArcAppCallback = void (boolean appLaunched);
300
301  callback TakeScreenshotCallback = void (DOMString base64Png);
302
303  callback GetPrimaryDisplayScaleFactorCallback = void (double scaleFactor);
304
305  callback IsTabletModeEnabledCallback = void (boolean enabled);
306
307  callback SetTabletModeEnabledCallback = void(boolean enabled);
308
309  callback SetOverviewModeStateCallback = void(boolean finished);
310
311  callback ArcAppTracingCallback = void(ArcAppTracingInfo info);
312
313  callback WaitForDisplayRotationCallback = void (boolean success);
314
315  callback InstallPWAForCurrentURLCallback = void (DOMString appId);
316
317  dictionary App {
318    DOMString appId;
319    DOMString name;
320    DOMString shortName;
321    AppType? type;
322    AppInstallSource? installSource;
323    AppReadiness? readiness;
324    DOMString[] additionalSearchTerms;
325    boolean? showInLauncher;
326    boolean? showInSearch;
327  };
328
329  dictionary SystemApp {
330    DOMString internalName;
331    DOMString url;
332  };
333
334  callback GetAllInstalledAppsCallback = void (App[] apps);
335
336  dictionary ShelfItem {
337    DOMString appId;
338    DOMString launchId;
339    DOMString title;
340    ShelfItemType? type;
341    ShelfItemStatus status;
342    boolean showsTooltip;
343    boolean pinnedByPolicy;
344    boolean hasNotification;
345  };
346
347  // A mapping of ash::AppType.
348  enum AppWindowType {
349    Browser,
350    ChromeApp,
351    ArcApp,
352    CrostiniApp,
353    SystemApp,
354    ExtensionApp,
355    Lacros
356  };
357
358  // A mapping of HotseatState in ash/public/cpp/shelf_types.h.
359  enum HotseatState {
360    Hidden,
361    ShownClamShell,
362    ShownHomeLauncher,
363    Extended
364  };
365
366  // The frame mode of a window. None if the window is framesless.
367  enum FrameMode {
368    Normal,
369    Immersive
370  };
371
372  dictionary OverviewInfo {
373    // Bounds in screen of an OverviewItem.
374    Bounds bounds;
375    // Whether an OverviewItem is being dragged in overview.
376    boolean isDragged;
377  };
378
379  dictionary AppWindowInfo {
380    // The identifier of the window. This shouldn't change across the time.
381    long id;
382
383    // The name of the window object -- typically internal class name of the
384    // window (like 'BrowserFrame').
385    DOMString name;
386
387    AppWindowType windowType;
388    WindowStateType stateType;
389
390    // The bounds of the window, in the coordinate of the root window (i.e.
391    // relative to the display where this window resides).
392    Bounds boundsInRoot;
393
394    // The identifier of the display where this window resides.
395    DOMString displayId;
396
397    boolean isVisible;
398    boolean canFocus;
399
400    // The title of the window; this can be seen in the window caption, or in
401    // the overview mode. Typically, this provides the title of the webpage or
402    // the title supplied by the application.
403    DOMString title;
404
405    // Whether some animation is ongoing on the window or not.
406    boolean isAnimating;
407
408    // The final bounds of the window when the animation completes. This should
409    // be same as |boundsInRoot| when |isAnimating| is false.
410    Bounds targetBounds;
411
412    // Whether or not the window is going to be visible after the animation
413    // completes. This should be same as |isVisible| when |isAnimating| is
414    // false.
415    boolean targetVisibility;
416
417    // WM Releated states
418    boolean isActive;
419    boolean hasFocus;
420    boolean onActiveDesk;
421    boolean hasCapture;
422    boolean canResize;
423
424    // Window frame info
425    FrameMode frameMode;
426    boolean isFrameVisible;
427    long captionHeight;
428    // The bitset of the enabled caption buttons. See
429    // ui/views/window/caption_button_types.h.
430    long captionButtonEnabledStatus;
431    // The bitset of the caption buttons which are visible on the frame.
432    long captionButtonVisibleStatus;
433
434    DOMString? arcPackageName;
435
436    OverviewInfo? overviewInfo;
437  };
438
439  dictionary Accelerator {
440    DOMString keyCode;
441    boolean shift;
442    boolean control;
443    boolean alt;
444    boolean search;
445    boolean pressed;
446  };
447
448  // Mapped to ScrollableShelfState in ash/public/cpp/shelf_ui_info.h.
449  // [deprecated="Use ShelfState"]
450  dictionary ScrollableShelfState {
451    double? scrollDistance;
452  };
453
454  // Mapped to ShelfState in ash/public/cpp/shelf_ui_info.h.
455  dictionary ShelfState {
456    double? scrollDistance;
457  };
458
459  // Mapped to ScrollableShelfInfo in ash/public/cpp/shelf_ui_info.h.
460  // |targetMainAxisOffset| is set when ShelfState used in query
461  // specifies the scroll distance.
462  dictionary ScrollableShelfInfo {
463    double mainAxisOffset;
464    double pageOffset;
465    double? targetMainAxisOffset;
466    Bounds leftArrowBounds;
467    Bounds rightArrowBounds;
468    boolean isAnimating;
469    boolean isOverflow;
470    Bounds[] iconsBoundsInScreen;
471    boolean isShelfWidgetAnimating;
472  };
473
474  // Mapped to HotseatSwipeDescriptor in ash/public/cpp/shelf_ui_info.h.
475  dictionary HotseatSwipeDescriptor {
476    Location swipeStartLocation;
477    Location swipeEndLocation;
478  };
479
480  // Mapped to HotseatInfo in ash/public/cpp/shelf_ui_info.h.
481  dictionary HotseatInfo {
482    HotseatSwipeDescriptor swipeUp;
483    HotseatState state;
484    boolean isAnimating;
485  };
486
487  // The ui information of shelf components, including hotseat and
488  // scrollable shelf.
489  dictionary ShelfUIInfo {
490    HotseatInfo hotseatInfo;
491    ScrollableShelfInfo scrollableShelfInfo;
492  };
493
494  callback GetShelfItemsCallback = void (ShelfItem[] items);
495
496  callback GetShelfAutoHideBehaviorCallback = void (DOMString behavior);
497
498  callback GetShelfAlignmentCallback = void (ShelfAlignmentType alignment);
499
500  callback WindowStateCallback = void (WindowStateType currentType);
501
502  callback VoidCallback = void ();
503
504  callback DOMStringCallback = void (DOMString data);
505
506  callback GetAppWindowListCallback = void (AppWindowInfo[] window_list);
507
508  callback AcceleratorCallback = void (boolean success);
509
510  callback DesksCallback = void (boolean success);
511
512  callback GetScrollableShelfInfoForStateCallback = void (
513      ScrollableShelfInfo info);
514
515  callback GetShelfUIInfoForStateCallback = void (ShelfUIInfo info);
516
517  dictionary TraceConfig {
518    // The recording mode of the trace. Possible options are:
519    // "record-until-full", "record-continuously", "record-as-much-as-possible",
520    // and "trace-to-console".
521    DOMString? record_mode;
522    // Stop trace after capturing |trace_buffer_size_in_events| events.
523    long? trace_buffer_size_in_events;
524    // Stop trace after capturing |trace_buffer_size_in_kb| kilobytes worth of
525    // events.
526    long? trace_buffer_size_in_kb;
527    // Determines whether systrace events should be included in the trace.
528    boolean? enable_systrace;
529    // Enables argument filter.
530    boolean? enable_argument_filter;
531    // A list of categories that should be included in the trace.
532    DOMString[]? included_categories;
533    // A list of categories that should be excluded from the the trace.
534    DOMString[]? excluded_categories;
535    // A list of processes from which events should be included in the trace. If
536    // this parameter is empty or missing, traces from all processes are
537    // included.
538    DOMString[]? included_process_ids;
539    // A list of Systrace events that will be included in the trace.
540    DOMString[]? enable_systrace_events;
541  };
542
543  // Defines a callback that will be run when the trace is complete. The parameter
544  // |data| contains the result of the trace in Trace Event JSON format.
545  callback TraceCompleteCallback = void (DOMString data);
546
547  // Result of calling setWindowBounds, which returns the actual bounds and
548  // display the window was set to. This may be different than the requested
549  // bounds and display, for example if the window is showing an ARC app and
550  // Android modifies the bounds request. Further, this result may never be
551  // returned in some situations (e.g. Android ignoring a bounds request),
552  // causing a timeout.
553  dictionary SetWindowBoundsResult {
554    // Bounds of the window.
555    Bounds bounds;
556    // Display ID of the display the window is on.
557    DOMString displayId;
558  };
559  callback WindowBoundsCallback = void (SetWindowBoundsResult result);
560
561  // Collected ui::ThroughputTracker data for one animation. It is based on
562  // cc::FrameSequenceMetrics::ThroughputData.
563  dictionary ThroughputTrackerAnimationData {
564    // Number of frames expected to be shown for this animation.
565    long framesExpected;
566    // Number of frames actually shown for this animation.
567    long framesProduced;
568    // Number of janks during this animation. A jank is counted when the current
569    // frame latency is larger than previous ones.
570    long jankCount;
571  };
572
573  // Callback invoked to report the smoothness after StopSmoothnessTracking is
574  // called.
575  callback StopSmoothnessTrackingCallback = void
576      (ThroughputTrackerAnimationData data);
577
578  // Callback invoked to report the collection ui::ThroughputTracker data
579  // after stopThroughputTrackerDataCollection is called.
580  callback StopThroughputTrackerDataCollectionCallback = void
581      (ThroughputTrackerAnimationData[] data);
582
583  // Callback invoked to report the number of system web apps that should be
584  // installed.
585  callback GetRegisteredSystemWebAppsCallback = void
586      (SystemApp[] systemApps);
587
588  interface Functions {
589    // Must be called to allow autotestPrivateAPI events to be fired.
590    static void initializeEvents();
591
592    // Logout of a user session.
593    static void logout();
594
595    // Restart the browser.
596    static void restart();
597
598    // Shutdown the browser.
599    // |force|: if set, ignore ongoing downloads and onunbeforeunload handlers.
600    static void shutdown(boolean force);
601
602    // Get login status.
603    static void loginStatus(LoginStatusCallback callback);
604
605    // Locks the screen.
606    static void lockScreen();
607
608    // Get info about installed extensions.
609    static void getExtensionsInfo(ExtensionsInfoCallback callback);
610
611    // Get state of the policies.
612    // Will contain device policies and policies from the active profile.
613    // The policy values are formatted as they would be for exporting in
614    // chrome://policy.
615    static void getAllEnterprisePolicies(
616        AllEnterprisePoliciesCallback callback);
617
618    // Refreshes the Enterprise Policies.
619    static void refreshEnterprisePolicies(VoidCallback callback);
620
621    // Simulates a memory access bug for asan testing.
622    static void simulateAsanMemoryBug();
623
624    // Set the touchpad pointer sensitivity setting.
625    // |value|: the pointer sensitivity setting index.
626    static void setTouchpadSensitivity(long value);
627
628    // Turn on/off tap-to-click for the touchpad.
629    // |enabled|: if set, enable tap-to-click.
630    static void setTapToClick(boolean enabled);
631
632    // Turn on/off three finger click for the touchpad.
633    // |enabled|: if set, enable three finger click.
634    static void setThreeFingerClick(boolean enabled);
635
636    // Turn on/off tap dragging for the touchpad.
637    // |enabled|: if set, enable tap dragging.
638    static void setTapDragging(boolean enabled);
639
640    // Turn on/off Australian scrolling for devices other than wheel mouse.
641    // |enabled|: if set, enable Australian scrolling.
642    static void setNaturalScroll(boolean enabled);
643
644    // Set the mouse pointer sensitivity setting.
645    // |value|: the pointer sensitivity setting index.
646    static void setMouseSensitivity(long value);
647
648    // Swap the primary mouse button for left click.
649    // |right|: if set, swap the primary mouse button.
650    static void setPrimaryButtonRight(boolean right);
651
652    // Turn on/off reverse scrolling for mice.
653    // |enabled|: if set, enable reverse scrolling.
654    static void setMouseReverseScroll(boolean enabled);
655
656    // Get visible notifications on the system.
657    static void getVisibleNotifications(NotificationArrayCallback callback);
658
659    // Remove all notifications.
660    static void removeAllNotifications(VoidCallback callback);
661
662    // Get ARC start time.
663    static void getArcStartTime(ArcStartTimeCallback callback);
664
665    // Get state of the ARC session.
666    static void getArcState(ArcStateCallback callback);
667
668    // Get state of the Play Store.
669    static void getPlayStoreState(PlayStoreStateCallback callback);
670
671    // Get list of available printers
672    static void getPrinterList(PrinterArrayCallback callback);
673
674    // Returns true if requested app is shown in Chrome.
675    static void isAppShown(DOMString appId, IsAppShownCallback callback);
676
677    // Returns true if ARC is provisioned.
678    // [deprecated="Use getArcState()"]
679    static void isArcProvisioned(IsArcProvisionedCallback callback);
680
681    // Gets information about the requested ARC app.
682    static void getArcApp(DOMString appId, GetArcAppCallback callback);
683
684    // Gets information about requested ARC package.
685    static void getArcPackage(DOMString packageName,
686                              GetArcPackageCallback callback);
687
688    // Waits for system web apps to complete the installation.
689    static void waitForSystemWebAppsInstall(VoidCallback callback);
690
691    // Returns the number of system web apps that should be installed.
692    static void getRegisteredSystemWebApps(
693        GetRegisteredSystemWebAppsCallback callback);
694
695    // Launches ARC app with optional intent. Returns true if ARC is active,
696    // app exists and launch request is passed to Android.
697    static void launchArcApp(DOMString appId, DOMString intent,
698                             LaunchArcAppCallback callback);
699
700    // Launches an application from the launcher with the given appId.
701    static void launchApp(DOMString appId, VoidCallback callback);
702
703    // Launches an system web app from the launcher with the given app name and
704    // url.
705    static void launchSystemWebApp(DOMString appName, DOMString url,
706                                   VoidCallback callback);
707
708    // Closes an application the given appId in case it was running.
709    static void closeApp(DOMString appId, VoidCallback callback);
710
711    // Update printer. Printer with empty ID is considered new.
712    static void updatePrinter(Printer printer);
713
714    // Remove printer.
715    static void removePrinter(DOMString printerId);
716
717    // Enable/disable the Play Store.
718    // |enabled|: if set, enable the Play Store.
719    // |callback|: Called when the operation has completed.
720    static void setPlayStoreEnabled(boolean enabled, VoidCallback callback);
721
722    // Get text from ui::Clipboard.
723    // |callback|: Called with result.
724    static void getClipboardTextData(DOMStringCallback callback);
725
726    // Set text in ui::Clipbaord.
727    // |callback|: Called when operation is complete.
728    static void setClipboardTextData(DOMString data, VoidCallback callback);
729
730    // Run the crostini installer GUI to install the default crostini
731    // vm / container and create sshfs mount.  The installer launches the
732    // crostini terminal app on completion.  The installer expects that
733    // crostini is not already installed.
734    // |callback|: Called when the operation has completed.
735    static void runCrostiniInstaller(VoidCallback callback);
736
737    // Run the crostini uninstaller GUI to remove the default crostini
738    // vm / container. The callback is invoked upon completion.
739    static void runCrostiniUninstaller(VoidCallback callback);
740
741    // Enable/disable Crostini in preferences.
742    // |enabled|: Enable Crostini.
743    // |callback|: Called when the operation has completed.
744    static void setCrostiniEnabled(boolean enabled, VoidCallback callback);
745
746    // Export the crostini container.
747    // |path|: The path in Downloads to save the export.
748    // |callback|: Called when the operation has completed.
749    static void exportCrostini(DOMString path, VoidCallback callback);
750
751    // Import the crostini container.
752    // |path|: The path in Downloads to read the import.
753    // |callback|: Called when the operation has completed.
754    static void importCrostini(DOMString path, VoidCallback callback);
755
756    // Sets mock Plugin VM policy.
757    // |imageUrl|: URL to the image to install.
758    // |imageHash|: Hash for the provided image.
759    // |licenseKey|: License key for Plugin VM.
760    static void setPluginVMPolicy(DOMString imageUrl,
761                                  DOMString imageHash,
762                                  DOMString licenseKey);
763
764    // Shows the Plugin VM installer. Does not start installation.
765    static void showPluginVMInstaller();
766
767    // Register a component with CrOSComponentManager.
768    // |name|: The name of the component.
769    // |path|: Path to the component.
770    static void registerComponent(DOMString name, DOMString path);
771
772    // Takes a screenshot and returns the data in base64 encoded PNG format.
773    static void takeScreenshot(TakeScreenshotCallback callback);
774
775    // Tasks a screenshot for a display.
776    // |display_id|: the display id of the display.
777    // |callback|: called when the operation has completed.
778    static void takeScreenshotForDisplay(DOMString display_id,
779                                         TakeScreenshotCallback callback);
780
781    // Makes a basic request to ML Service, triggering 1. ML Service
782    // daemon startup, and 2. the initial D-Bus -> Mojo IPC bootstrap.
783    // |callback|: Called when the operation has completed.
784    static void bootstrapMachineLearningService(VoidCallback callback);
785
786    // Enables/disables the Google Assistant.
787    // |callback|: Called when the operation has completed.
788    static void setAssistantEnabled(boolean enabled, long timeout_ms,
789                                    VoidCallback callback);
790
791    // Bring up the Assistant service, and wait for the ready signal.
792    // |callback|: Called when the operation has completed.
793    static void enableAssistantAndWaitForReady(VoidCallback callback);
794
795    // Sends a text query via Google Assistant.
796    // |callback|: Called when response has been received.
797    static void sendAssistantTextQuery(DOMString query, long timeout_ms,
798                                       AssistantQueryStatusCallback callback);
799
800    // Invokes |callback| once the current text/voice interaction is completed.
801    // Responds with the the query status if any valid response was caught
802    // before the timeout. This API should be called before sending the query.
803    // To use it for testing a voice query via OKG in Autotest, for example,
804    // you can do:
805    //
806    //    // Enable hotword setting for Assistant.
807    //    assistant_util.enable_hotword();
808    //
809    //    // Call this API with your callback function.
810    //    chrome.autotestPrivate.waitForAssistantQueryStatus(timeout_s,
811    //        function(status) {...});
812    //
813    // then start Assistant via OKG and send voice query before timeout.
814    //
815    // TODO(meilinw@): disable warmer welcome to avoid an unintended early
816    // return of this API when launching Assistant via hotkey.
817    // TODO(meilinw@): update the comment above to use Tast instead after
818    // adding API to enable hotword in Tast.
819    static void waitForAssistantQueryStatus(
820        long timeout_s,
821        AssistantQueryStatusCallback callback);
822
823    // Whether the local list of installed ARC packages has been refreshed for
824    // the first time after user login.
825    static void isArcPackageListInitialRefreshed(
826        IsArcPackageListInitialRefreshedCallback callback);
827
828    // Set value for the specified user pref in the pref tree.
829    static void setWhitelistedPref(DOMString pref_name, any value,
830                                   VoidCallback callback);
831
832    // Enable/disable a Crostini app's "scaled" property.
833    // |appId|: The Crostini application ID.
834    // |scaled|: The app is "scaled" when shown, which means it uses low display
835    //           density.
836    // |callback|: Called when the operation has completed.
837    static void setCrostiniAppScaled(DOMString appId, boolean scaled,
838                                     VoidCallback callback);
839
840    // Get the primary display scale factor.
841    // |callback| is invoked with the scale factor.
842    static void getPrimaryDisplayScaleFactor(
843        GetPrimaryDisplayScaleFactorCallback callback);
844
845    // Get the tablet mode enabled status.
846    // |callback| is invoked with the tablet mode enablement status.
847    static void isTabletModeEnabled(IsTabletModeEnabledCallback callback);
848
849    // Enable/disable tablet mode. After calling this function, it won't be
850    // possible to physically switch to/from tablet mode since that
851    // functionality will be disabled.
852    // |enabled|: if set, enable tablet mode.
853    // |callback|: Called when the operation has completed.
854    static void setTabletModeEnabled(boolean enabled,
855        SetTabletModeEnabledCallback callback);
856
857    // Get the list of all installed applications
858    static void getAllInstalledApps(GetAllInstalledAppsCallback callback);
859
860    // Get the list of all shelf items
861    static void getShelfItems(GetShelfItemsCallback callback);
862
863    // Get the shelf auto hide behavior.
864    // |displayId|: display that contains the shelf.
865    // |callback| is invoked with the shelf auto hide behavior. Possible
866    // behavior values are: "always", "never" or "hidden".
867    static void getShelfAutoHideBehavior(DOMString displayId,
868        GetShelfAutoHideBehaviorCallback callback);
869
870    // Set the shelf auto hide behavior.
871    // |displayId|: display that contains the shelf.
872    // |behavior|: an enum of "always", "never" or "hidden".
873    // |callback|: Called when the operation has completed.
874    static void setShelfAutoHideBehavior(DOMString displayId,
875        DOMString behavior, VoidCallback callback);
876
877    // Get the shelf alignment.
878    // |displayId|: display that contains the shelf.
879    // |callback| is invoked with the shelf alignment type.
880    static void getShelfAlignment(DOMString displayId,
881        GetShelfAlignmentCallback callback);
882
883    // Set the shelf alignment.
884    // |displayId|: display that contains the shelf.
885    // |alignment|: the type of alignment to set.
886    // |callback|: Called when the operation has completed.
887    static void setShelfAlignment(DOMString displayId,
888        ShelfAlignmentType alignment, VoidCallback callback);
889
890    // Create a pin on shelf for the app specified by |appId|.
891    static void pinShelfIcon(DOMString appId, VoidCallback callback);
892
893    // Enter or exit the overview mode.
894    // |start|: whether entering to or exiting from the overview mode.
895    // |callback|: called after the overview mode switch finishes.
896    static void setOverviewModeState(boolean start,
897        SetOverviewModeStateCallback callback);
898
899    // Show virtual keyboard of the current input method if it's available.
900    static void showVirtualKeyboardIfEnabled();
901
902    // Start ARC performance tracing for the active ARC app window.
903    // |callback|: Called when the operation has completed.
904    static void arcAppTracingStart(VoidCallback callback);
905
906    // Stop ARC performance tracing if it was started and analyze results.
907    // |callback|: callback to deliver tracing results.
908    static void arcAppTracingStopAndAnalyze(ArcAppTracingCallback callback);
909
910    // Swap the windows in the split view.
911    // |callback|: Called when the operation has completed.
912    static void swapWindowsInSplitView(VoidCallback callback);
913
914    // Set ARC app window focused.
915    // |packageName|: the package name of the ARC app window.
916    // |callback|: called when the operation has completed.
917    static void setArcAppWindowFocus(DOMString packageName,
918                                     VoidCallback callback);
919
920    // Invokes the callback when the display rotation animation is finished, or
921    // invokes it immediately if it is not animating. The callback argument
922    // is true if the display's rotation is same as |rotation|, or false otherwise.
923    // |displayId|: display that contains the shelf.
924    // |rotation|: the target rotation.
925    // |callback|: called when the operation has completed.
926    static void waitForDisplayRotation(DOMString displayId,
927                                       RotationType rotation,
928                                       WaitForDisplayRotationCallback callback);
929
930    // Get information on all application windows. Callback will be called
931    // with the list of |AppWindowInfo| dictionary.
932    // |callback|: called with window list.
933    static void getAppWindowList(GetAppWindowListCallback callback);
934
935    // Send WM event to change the app window's window state.
936    // |id|: the id of the window
937    // |change|: WM event type to send to the app window.
938    // |callback|: called when the window state is changed.
939    static void setAppWindowState(long id,
940                                  WindowStateChangeDict change,
941                                  WindowStateCallback callback);
942
943    // Closes an app window given by "id".
944    // |id|: the id of the window
945    // |callback|: called when the window state is requested to close.
946    static void closeAppWindow(long id, VoidCallback callback);
947
948    // Installs the Progressive Web App (PWA) that is in the current URL.
949    // |timeout_ms|: Timeout in milliseconds for the operation to complete.
950    // |callback|: called when the operation has completed. Passes the app Id
951    //             of the recently installed PWA as argument.
952    static void installPWAForCurrentURL(
953        long timeout_ms,
954        InstallPWAForCurrentURLCallback callback);
955
956    // Activates shortcut.
957    // |accelerator|: the accelerator to activate.
958    // |callback|: called when the operation has completed.
959    static void activateAccelerator(Accelerator accelerator,
960                                    AcceleratorCallback callback);
961
962    // Wwait until the launcher is transitionto the |launcherState|, if it's not
963    // in that state.
964    // |launcherState|: the target launcher state.
965    // |callback|: called when the operation has completed.
966    static void waitForLauncherState(LauncherStateType launcherState,
967                                     VoidCallback callback);
968
969    // Wait until overview has transitioned to |overviewState|, if it is not in
970    // that state.
971    // |overviewState|: the target overview state.
972    // |callback|: called when overview has reached |overviewState|.
973    static void waitForOverviewState(OverviewStateType overviewState,
974                                     VoidCallback callback);
975
976    // Creates a new desk if the maximum number of desks has not been reached.
977    // |callback|: called to indicate success or failure.
978    static void createNewDesk(DesksCallback callback);
979
980    // Activates the desk at the given |index| triggering the activate-desk
981    // animation.
982    // |index|: the zero-based index of the desk desired to be activated.
983    // |callback|: called indicating success when the animation completes, or
984    // failure when the desk at |index| is already the active desk.
985    static void activateDeskAtIndex(long index, DesksCallback callback);
986
987    // Removes the currently active desk and triggers the remove-desk animation.
988    // |callback|: called indicating success when the animation completes, or
989    // failure if the currently active desk is the last available desk which
990    // cannot be removed.
991    static void removeActiveDesk(DesksCallback callback);
992
993    // Activates the desk at the given |index| by chaining multiple
994    // activate-desk animations.
995    // |index|: the zero-based index of the desk desired to be activated.
996    // |callback|: called indicating success when the animation completes, or
997    // failure when the desk at |index| is already the active desk.
998    static void activateAdjacentDesksToTargetIndex(long index,
999                                                   DesksCallback callback);
1000
1001    // Create mouse events to cause a mouse click.
1002    // |button|: the mouse button for the click event.
1003    // |callback|: called after the mouse click finishes.
1004    static void mouseClick(MouseButton button, VoidCallback callback);
1005
1006    // Create a mouse event to cause mouse pressing. The mouse button stays
1007    // in the pressed state.
1008    // |button|: the mouse button to be pressed.
1009    // |callback|: called after the mouse pressed event is handled.
1010    static void mousePress(MouseButton button, VoidCallback callback);
1011
1012    // Create a mouse event to release a mouse button. This does nothing and
1013    // returns immediately if the specified button is not pressed.
1014    // |button|: the mouse button to be released.
1015    // |callback|: called after the mouse is released.
1016    static void mouseRelease(MouseButton button, VoidCallback callback);
1017
1018    // Create mouse events to move a mouse cursor to the location. This can
1019    // cause a dragging if a button is pressed. It starts from the last mouse
1020    // location. It does not support the move or drag across display boundaries.
1021    // |location|: the target location (in display's coordinate).
1022    // |duration_in_ms|: the duration (in milliseconds) for the mouse movement.
1023    //    The mouse will move linearly. 0 means moving immediately.
1024    // |callback|: called after the mouse move finishes.
1025    static void mouseMove(Location location,
1026                          double duration_in_ms,
1027                          VoidCallback callback);
1028
1029    // Enable/disable metrics reporting in preferences.
1030    // |enabled|: Enable metrics reporting.
1031    // |callback|: Called when the operation has completed.
1032    static void setMetricsEnabled(boolean enabled, VoidCallback callback);
1033
1034    // Starts Chrome tracing.
1035    // |config|: the tracing configuration.
1036    // |callback|: called when tracing has started.
1037    static void startTracing(TraceConfig config, VoidCallback callback);
1038
1039    // Stops Chrome tracing.
1040    // |completeCallback|: called when tracing is complete, with results as a
1041    //     parameter.
1042    static void stopTracing(TraceCompleteCallback completeCallback);
1043
1044    // Sends ARC touch mode enabled or disabled.
1045    // |enable|: whether enabled touch mode.
1046    // |callback|: called when action performed.
1047    static void setArcTouchMode(boolean enabled, VoidCallback callback);
1048
1049    // Fetches ui information of scrollable shelf view for the given shelf
1050    // state. This function does not change scrollable shelf.
1051    // [deprecated="Use getShelfUIInfoForState()"]
1052    static void getScrollableShelfInfoForState(
1053        ScrollableShelfState state,
1054        GetScrollableShelfInfoForStateCallback callback);
1055
1056    // Fetches UI information of shelf (including scrollable shelf and hotseat)
1057    // for the given shelf state. This function does not change any shelf
1058    // component.
1059    static void getShelfUIInfoForState(
1060        ShelfState state,
1061        GetShelfUIInfoForStateCallback callback);
1062
1063    // Sends a WM event to change a window's bounds and/or the display it is on.
1064    // |id|: the id of the window.
1065    // |bounds|: bounds the window should be set to.
1066    // |displayId|: id of display to move the window to.
1067    // |callback|: called when the window bounds are changed.
1068    static void setWindowBounds(
1069        long id,
1070        Bounds bounds,
1071        DOMString displayId,
1072        WindowBoundsCallback callback);
1073
1074    // Starts smoothness tracking for a display. If the display id is not
1075    // specified, the primary display is used. Otherwise, the display specified
1076    // by the display id is used.
1077    static void startSmoothnessTracking(optional DOMString displayId,
1078                                        VoidCallback callback);
1079
1080    // Stops smoothness tracking for a display and report the smoothness. If
1081    // the display id is not specified, the primary display is used. Otherwise,
1082    // the display specified by the display id is used.
1083    static void stopSmoothnessTracking(optional DOMString displayId,
1084                                       StopSmoothnessTrackingCallback callback);
1085
1086    // When neccesary, disables showing the dialog when Switch Access is disabled.
1087    static void disableSwitchAccessDialog();
1088
1089    // Waits for the completion of photo transition animation in ambient mode.
1090    // |numCompletions|: number of completions of the animation.
1091    // |timeout|: the timeout in seconds.
1092    // |callback|: Called when the operation has completed.
1093    static void waitForAmbientPhotoAnimation(
1094        long numCompletions,
1095        long timeout,
1096        VoidCallback callback);
1097
1098    // Disables the automation feature. Note that the event handlers and caches
1099    // of automation nodes still remain in the test extension and so the next
1100    // automation.getDesktop will miss initialization. The caller should ensure
1101    // invalidation of those information (i.e. reloading the entire background
1102    // page).
1103    static void disableAutomation(VoidCallback callback);
1104
1105    // Starts to ui::ThroughputTracker data collection for tracked animations.
1106    static void startThroughputTrackerDataCollection(VoidCallback callback);
1107
1108    // Stops ui::ThroughputTracker data collection and reports the collected
1109    // data since the start.
1110    static void stopThroughputTrackerDataCollection(
1111        StopThroughputTrackerDataCollectionCallback callback);
1112  };
1113
1114  interface Events {
1115    // Fired when the data in ui::Clipboard is changed.
1116    static void onClipboardDataChanged();
1117  };
1118};
1119